diff --git a/src/costmanagement/HISTORY.rst b/src/costmanagement/HISTORY.rst index 596e64a6031..1c139576ba0 100644 --- a/src/costmanagement/HISTORY.rst +++ b/src/costmanagement/HISTORY.rst @@ -1,11 +1,8 @@ -.. :changelog: - -Release History -=============== -0.1.1 -++++++ -* Command group ``az costmanagement`` GA - -0.1.0 -++++++ -* Initial release. +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/costmanagement/azext_costmanagement/__init__.py b/src/costmanagement/azext_costmanagement/__init__.py index 8870243ca42..99ada46c2a7 100644 --- a/src/costmanagement/azext_costmanagement/__init__.py +++ b/src/costmanagement/azext_costmanagement/__init__.py @@ -9,20 +9,23 @@ # -------------------------------------------------------------------------- from azure.cli.core import AzCommandsLoader -# from azext_costmanagement.generated._help import helps # pylint: disable=unused-import -from azext_costmanagement.manual._help import helps # pylint: disable=unused-import +from azext_costmanagement.generated._help import helps # pylint: disable=unused-import +try: + from azext_costmanagement.manual._help import helps # pylint: disable=reimported +except ImportError: + pass 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 + from azext_costmanagement.generated._client_factory import cf_costmanagement_cl 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) + client_factory=cf_costmanagement_cl) + parent = super(CostManagementClientCommandsLoader, self) + parent.__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 diff --git a/src/costmanagement/azext_costmanagement/action.py b/src/costmanagement/azext_costmanagement/action.py index a846b2766c4..d95d53bf711 100644 --- a/src/costmanagement/azext_costmanagement/action.py +++ b/src/costmanagement/azext_costmanagement/action.py @@ -1,17 +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 +# -------------------------------------------------------------------------- +# 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 index 7cdaeed31ca..cfc30c747c7 100644 --- a/src/costmanagement/azext_costmanagement/azext_metadata.json +++ b/src/costmanagement/azext_costmanagement/azext_metadata.json @@ -1,3 +1,4 @@ -{ - "azext.minCliCoreVersion": "2.3.1" +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.15.0" } \ No newline at end of file diff --git a/src/costmanagement/azext_costmanagement/custom.py b/src/costmanagement/azext_costmanagement/custom.py index 7f31674ce96..dbe9d5f9742 100644 --- a/src/costmanagement/azext_costmanagement/custom.py +++ b/src/costmanagement/azext_costmanagement/custom.py @@ -1,17 +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 +# -------------------------------------------------------------------------- +# 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 index ee0c4f36bd0..c9cfdc73e77 100644 --- a/src/costmanagement/azext_costmanagement/generated/__init__.py +++ b/src/costmanagement/azext_costmanagement/generated/__init__.py @@ -1,12 +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__) +# 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 index 623cc620610..f2c855449a2 100644 --- a/src/costmanagement/azext_costmanagement/generated/_client_factory.py +++ b/src/costmanagement/azext_costmanagement/generated/_client_factory.py @@ -1,41 +1,50 @@ -# -------------------------------------------------------------------------- -# 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, - subscription_bound=False, - base_url_bound=True) - - -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 +# -------------------------------------------------------------------------- +# 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_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_costmanagement.vendored_sdks.costmanagement import CostManagementClient + return get_mgmt_service_client(cli_ctx, + CostManagementClient, + subscription_bound=False, + base_url_bound=True) + + +def cf_setting(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).settings + + +def cf_view(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).views + + +def cf_alert(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).alerts + + +def cf_forecast(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).forecast + + +def cf_dimension(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).dimensions + + +def cf_query(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).query + + +def cf_generate_reservation_detail_report(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).generate_reservation_details_report + + +def cf_export(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).exports diff --git a/src/costmanagement/azext_costmanagement/generated/_help.py b/src/costmanagement/azext_costmanagement/generated/_help.py index 13440845a57..b5849178d46 100644 --- a/src/costmanagement/azext_costmanagement/generated/_help.py +++ b/src/costmanagement/azext_costmanagement/generated/_help.py @@ -1,782 +1,1242 @@ -# -------------------------------------------------------------------------- -# 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" -# """ +# -------------------------------------------------------------------------- +# 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 setting'] = """ + type: group + short-summary: Manage setting with costmanagement +""" + +helps['costmanagement setting list'] = """ + type: command + short-summary: "Lists all of the settings that have been customized." + examples: + - name: SettingList + text: |- + az costmanagement setting list +""" + +helps['costmanagement setting show'] = """ + type: command + short-summary: "Retrieves the current value for a specific setting." + examples: + - name: Settings + text: |- + az costmanagement setting show --name "myscope" +""" + +helps['costmanagement setting create'] = """ + type: command + short-summary: "Sets a new value for a specific setting." + parameters: + - name: --cache + short-summary: "Array of scopes with additional details used by Cost Management in the Azure portal." + long-summary: | + Usage: --cache id=XX name=XX channel=XX subchannel=XX parent=XX status=XX + + id: Required. Resource ID used by Resource Manager to uniquely identify the scope. + name: Required. Display name for the scope. + channel: Required. Indicates the account type. Allowed values include: EA, PAYG, Modern, Internal, \ +Unknown. + subchannel: Required. Indicates the type of modern account. Allowed values include: Individual, \ +Enterprise, Partner, Indirect, NotApplicable + parent: Resource ID of the parent scope. For instance, subscription's resource ID for a resource group or \ +a management group resource ID for a subscription. + status: Indicates the status of the scope. Status only applies to subscriptions and billing accounts. + + Multiple actions can be specified by using more than one --cache argument. + examples: + - name: CreateOrUpdateSetting + text: |- + az costmanagement setting create --cache name="72f988bf-86f1-41af-91ab-2d7cd011db47" channel="Modern" \ +id="/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47" \ +parent="/providers/Microsoft.Management/managementGroups/acm" status="enabled" subchannel="NotApplicable" --scope \ +"/subscriptions/00000000-0000-0000-0000-000000000000" --start-on "LastUsed" --name "myscope" +""" + +helps['costmanagement setting update'] = """ + type: command + short-summary: "Sets a new value for a specific setting." + parameters: + - name: --cache + short-summary: "Array of scopes with additional details used by Cost Management in the Azure portal." + long-summary: | + Usage: --cache id=XX name=XX channel=XX subchannel=XX parent=XX status=XX + + id: Required. Resource ID used by Resource Manager to uniquely identify the scope. + name: Required. Display name for the scope. + channel: Required. Indicates the account type. Allowed values include: EA, PAYG, Modern, Internal, \ +Unknown. + subchannel: Required. Indicates the type of modern account. Allowed values include: Individual, \ +Enterprise, Partner, Indirect, NotApplicable + parent: Resource ID of the parent scope. For instance, subscription's resource ID for a resource group or \ +a management group resource ID for a subscription. + status: Indicates the status of the scope. Status only applies to subscriptions and billing accounts. + + Multiple actions can be specified by using more than one --cache argument. +""" + +helps['costmanagement setting delete'] = """ + type: command + short-summary: "Remove the current value for a specific setting and reverts back to the default value, if \ +applicable." + examples: + - name: DeleteSetting + text: |- + az costmanagement setting delete --name "TestSettings" +""" + +helps['costmanagement view'] = """ + type: group + short-summary: Manage view with costmanagement +""" + +helps['costmanagement view list'] = """ + type: command + short-summary: "Lists all views at the given scope. And 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" + - name: PrivateViewList + text: |- + az costmanagement view list +""" + +helps['costmanagement view show'] = """ + type: command + short-summary: "Gets the view for the defined scope by view name. And Gets the view by view name." + examples: + - name: ResourceGroupView + text: |- + az costmanagement view show --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/M\ +YDEVTESTRG" --name "swaggerExample" + - name: PrivateView + text: |- + az costmanagement view show --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 \ +request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. And The \ +operation to Create 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." + parameters: + - name: --kpis + short-summary: "List of KPIs to show in Cost Analysis UI." + long-summary: | + Usage: --kpis type=XX id=XX enabled=XX + + type: KPI type (Forecast, Budget). + id: ID of resource related to metric (budget). + enabled: show the KPI in the UI? + + Multiple actions can be specified by using more than one --kpis argument. + - name: --pivots + short-summary: "Configuration of 3 sub-views in the Cost Analysis UI." + long-summary: | + Usage: --pivots type=XX name=XX + + type: Data type to show in view. + name: Data field to show in view. + + Multiple actions can be specified by using more than one --pivots argument. + - name: --time-period + short-summary: "Has time period for pulling data for the report." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the report. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the report. Report can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. This version supports subscription lowest possible grain. + + Multiple actions can be specified by using more than one --grouping argument. + - name: --sorting + short-summary: "Array of order by expression to use in the report." + long-summary: | + Usage: --sorting direction=XX name=XX + + direction: Direction of sort. + name: Required. The name of the column to sort. + + Multiple actions can be specified by using more than one --sorting argument. + - name: --kpis + short-summary: "List of KPIs to show in Cost Analysis UI." + long-summary: | + Usage: --kpis type=XX id=XX enabled=XX + + type: KPI type (Forecast, Budget). + id: ID of resource related to metric (budget). + enabled: show the KPI in the UI? + + Multiple actions can be specified by using more than one --kpis argument. + - name: --pivots + short-summary: "Configuration of 3 sub-views in the Cost Analysis UI." + long-summary: | + Usage: --pivots type=XX name=XX + + type: Data type to show in view. + name: Data field to show in view. + + Multiple actions can be specified by using more than one --pivots argument. + - name: --time-period + short-summary: "Has time period for pulling data for the report." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the report. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the report. Report can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. This version supports subscription lowest possible grain. + + Multiple actions can be specified by using more than one --grouping argument. + - name: --sorting + short-summary: "Array of order by expression to use in the report." + long-summary: | + Usage: --sorting direction=XX name=XX + + direction: Direction of sort. + name: Required. The name of the column to sort. + + Multiple actions can be specified by using more than one --sorting argument. + examples: + - name: ResourceGroupCreateOrUpdateView + text: |- + 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/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budg\ +ets/swaggerDemo" --metric "ActualCost" --pivots name="ServiceName" type="Dimension" --pivots name="MeterCategory" \ +type="Dimension" --pivots name="swaggerTagKey" type="TagKey" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\ +\\",\\"function\\":\\"Sum\\"}}" --granularity "Daily" --sorting name="UsageDate" direction="Ascending" --timeframe \ +"MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" --name \ +"swaggerExample" + - name: CreateOrUpdatePrivateView + text: |- + 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/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budg\ +ets/swaggerDemo" --metric "ActualCost" --pivots name="ServiceName" type="Dimension" --pivots name="MeterCategory" \ +type="Dimension" --pivots name="swaggerTagKey" type="TagKey" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\ +\\",\\"function\\":\\"Sum\\"}}" --granularity "Daily" --sorting name="UsageDate" direction="Ascending" --timeframe \ +"MonthToDate" --name "swaggerExample" +""" + +helps['costmanagement view update'] = """ + type: command + short-summary: "The operation to 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. Update operation does not require eTag." + parameters: + - name: --kpis + short-summary: "List of KPIs to show in Cost Analysis UI." + long-summary: | + Usage: --kpis type=XX id=XX enabled=XX + + type: KPI type (Forecast, Budget). + id: ID of resource related to metric (budget). + enabled: show the KPI in the UI? + + Multiple actions can be specified by using more than one --kpis argument. + - name: --pivots + short-summary: "Configuration of 3 sub-views in the Cost Analysis UI." + long-summary: | + Usage: --pivots type=XX name=XX + + type: Data type to show in view. + name: Data field to show in view. + + Multiple actions can be specified by using more than one --pivots argument. + - name: --time-period + short-summary: "Has time period for pulling data for the report." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the report. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the report. Report can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. This version supports subscription lowest possible grain. + + Multiple actions can be specified by using more than one --grouping argument. + - name: --sorting + short-summary: "Array of order by expression to use in the report." + long-summary: | + Usage: --sorting direction=XX name=XX + + direction: Direction of sort. + name: Required. The name of the column to sort. + + Multiple actions can be specified by using more than one --sorting argument. +""" + +helps['costmanagement view delete'] = """ + type: command + short-summary: "The operation to delete a view. And The operation to delete a view." + examples: + - name: ResourceGroupDeleteView + text: |- + az costmanagement view delete --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups\ +/MYDEVTESTRG" --name "TestView" + - name: DeletePrivateView + text: |- + az costmanagement view delete --name "TestView" +""" + +helps['costmanagement alert'] = """ + type: group + short-summary: Manage alert with costmanagement +""" + +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 show'] = """ + type: command + short-summary: "Gets the alert for the scope by alert ID." + examples: + - name: ResourceGroupAlerts + text: |- + az costmanagement alert show --alert-id "22222222-2222-2222-2222-222222222222" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" + - name: SubscriptionAlerts + text: |- + az costmanagement alert show --alert-id "22222222-2222-2222-2222-222222222222" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000" +""" + +helps['costmanagement alert dismiss'] = """ + type: command + short-summary: "Dismisses the specified alert." + parameters: + - name: --definition + short-summary: "defines the type of alert" + long-summary: | + Usage: --definition type=XX category=XX criteria=XX + + type: type of alert + category: Alert category + criteria: Criteria that triggered alert + examples: + - name: ResourceGroupAlerts + text: |- + az costmanagement alert dismiss --alert-id "22222222-2222-2222-2222-222222222222" --status "Dismissed" \ +--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" + - name: SubscriptionAlerts + text: |- + az costmanagement alert dismiss --alert-id "22222222-2222-2222-2222-222222222222" --status "Dismissed" \ +--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: Manage forecast with costmanagement +""" + +helps['costmanagement forecast external-cloud-provider-usage'] = """ + type: command + short-summary: "Lists the forecast charges for external cloud provider type defined." + parameters: + - name: --time-period + short-summary: "Has time period for pulling data for the forecast." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the export. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the query. Query can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. + + Multiple actions can be specified by using more than one --grouping argument. + examples: + - name: ExternalBillingAccountForecast + text: |- + az costmanagement forecast external-cloud-provider-usage --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalBillingAccounts" --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dime\ +nsions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe \ +"MonthToDate" + - name: ExternalSubscriptionForecast + text: |- + az costmanagement forecast external-cloud-provider-usage --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalSubscriptions" --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimens\ +ions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe \ +"MonthToDate" +""" + +helps['costmanagement forecast usage'] = """ + type: command + short-summary: "Lists the forecast charges for scope defined." + parameters: + - name: --time-period + short-summary: "Has time period for pulling data for the forecast." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the export. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the query. Query can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. + + Multiple actions can be specified by using more than one --grouping argument. + examples: + - name: BillingAccountForecast + text: |- + az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\"\ +:{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" \ +--include-actual-cost false --include-fresh-partial-cost false --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingProfileForecast + text: |- + az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\"\ +:{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"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" + - name: DepartmentForecast + text: |- + az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\"\ +:{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"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" + - name: EnrollmentAccountForecast + text: |- + az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\"\ +:{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"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" + - name: InvoiceSectionForecast + text: |- + az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\"\ +:{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"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/9876" + - name: ResourceGroupForecast + text: |- + az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\"\ +:{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"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" + - name: SubscriptionForecast + text: |- + az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\"\ +:{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" \ +--include-actual-cost false --include-fresh-partial-cost false --timeframe "MonthToDate" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000" +""" + +helps['costmanagement dimension'] = """ + type: group + short-summary: Manage dimension with costmanagement +""" + +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 \ +\'resourceId\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/100" + - name: BillingAccountDimensionsListWithFilter-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \ +\'resourceId\'" --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 \ +\'resourceId\'" --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 \ +\'resourceId\'" --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 \ +\'resourceId\'" --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 \ +\'resourceId\'" --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 \ +\'resourceId\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSe\ +ctions/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.Management/managementGroups/MyMgId" + - name: ManagementGroupDimensionsListWithFilter-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \ +\'resourceId\'" --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" \ +--external-cloud-provider-type "externalBillingAccounts" + - name: ExternalSubscriptionDimensionList + text: |- + az costmanagement dimension by-external-cloud-provider-type --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalSubscriptions" +""" + +helps['costmanagement query'] = """ + type: group + short-summary: Manage query with costmanagement +""" + +helps['costmanagement query usage'] = """ + type: command + short-summary: "Query the usage data for scope defined." + parameters: + - name: --time-period + short-summary: "Has time period for pulling data for the query." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the export. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the query. Query can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. + + Multiple actions can be specified by using more than one --grouping argument. + examples: + - name: BillingAccountQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/70664866" + - name: BillingAccountQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingAccountQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/70664866" + - name: BillingAccountQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingProfileQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" + - name: BillingProfileQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" + - name: CustomerQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" + - name: CustomerQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" + - name: DepartmentQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/departments/123" + - name: DepartmentQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/departments/123" + - name: EnrollmentAccountQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: EnrollmentAccountQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: InvoiceSectionQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" + - name: InvoiceSectionQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" + - name: ManagementGroupQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Management/managementGroups/MyMgId" + - name: ManagementGroupQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Management/managementGroups/MyMgId" + - name: ResourceGroupQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" + - name: ResourceGroupQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --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" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\ +\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"nam\ +e\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\\ +"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000" + - name: SubscriptionQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\\ +",\\"function\\":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --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." + parameters: + - name: --time-period + short-summary: "Has time period for pulling data for the query." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the export. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the query. Query can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. + + Multiple actions can be specified by using more than one --grouping argument. + examples: + - name: ExternalBillingAccountQueryList + text: |- + az costmanagement query usage-by-external-cloud-provider-type --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalBillingAccounts" --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\ +\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"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" \ +--external-cloud-provider-type "externalSubscriptions" --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe \ +"MonthToDate" +""" + +helps['costmanagement generate-reservation-detail-report'] = """ + type: group + short-summary: Manage generate reservation detail report with costmanagement +""" + +helps['costmanagement generate-reservation-detail-report by-billing-account-id'] = """ + type: command + short-summary: "Generates the reservations details report for provided date range asynchronously based on \ +enrollment id." + examples: + - name: ReservationDetails + text: |- + az costmanagement generate-reservation-detail-report by-billing-account-id --billing-account-id \ +"9845612" --end-date "2020-01-30" --start-date "2020-01-01" +""" + +helps['costmanagement generate-reservation-detail-report by-billing-profile-id'] = """ + type: command + short-summary: "Generates the reservations details report for provided date range asynchronously by billing \ +profile." + examples: + - name: ReservationDetails + text: |- + az costmanagement generate-reservation-detail-report by-billing-profile-id --billing-account-id \ +"00000000-0000-0000-0000-000000000000" --billing-profile-id "CZSFR-SDFXC-DSDF" --end-date "2020-01-30" --start-date \ +"2020-01-01" +""" + +helps['costmanagement export'] = """ + type: group + short-summary: Manage export with costmanagement +""" + +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 export for the defined scope by export name." + examples: + - name: BillingAccountExport + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/1\ +23456" + - name: DepartmentExport + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/1\ +2/departments/1234" + - name: EnrollmentAccountExport + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/1\ +00/enrollmentAccounts/456" + - name: ManagementGroupExport + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Management/managementGrou\ +ps/TestMG" + - name: ResourceGroupExport + text: |- + az costmanagement export show --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000000\ +00000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionExport + text: |- + az costmanagement export show --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000000\ +00000" +""" + +helps['costmanagement export create'] = """ + type: command + short-summary: "The operation to Create 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." + parameters: + - name: --recurrence-period + short-summary: "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." + long-summary: | + Usage: --recurrence-period from=XX to=XX + + from: Required. The start date of recurrence. + to: The end date of recurrence. + - name: --time-period + short-summary: "Has time period for pulling data for the query." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the export. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the query. Query can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. + + Multiple actions can be specified by using more than one --grouping argument. + - name: --destination + short-summary: "Has destination for the export being delivered." + long-summary: | + Usage: --destination resource-id=XX container=XX root-folder-path=XX + + resource-id: Required. The resource id of the storage account where exports will be delivered. + container: Required. The name of the container where exports will be uploaded. + root-folder-path: The name of the directory where exports will be uploaded. + examples: + - name: BillingAccountCreateOrUpdateExport + text: |- + az costmanagement export create --name "TestExport" --type "Usage" --aggregation \ +"{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" \ +columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --filter \ +"{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"E\ +ast US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\\ +",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]\ +}" --grouping name="SubscriptionName" type="Dimension" --grouping name="Environment" type="Tag" --timeframe \ +"MonthToDate" --destination container="exports" resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resour\ +ceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" \ +--recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" \ +--scope "providers/Microsoft.Billing/billingAccounts/123456" + - name: DepartmentCreateOrUpdateExport + text: |- + az costmanagement export create --name "TestExport" --type "Usage" --aggregation \ +"{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" \ +columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --filter \ +"{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"E\ +ast US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\\ +",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]\ +}" --grouping name="SubscriptionName" type="Dimension" --grouping name="Environment" type="Tag" --timeframe \ +"MonthToDate" --destination container="exports" resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resour\ +ceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" \ +--recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" \ +--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234" + - name: EnrollmentAccountCreateOrUpdateExport + text: |- + az costmanagement export create --name "TestExport" --type "Usage" --aggregation \ +"{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" \ +columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --filter \ +"{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"E\ +ast US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\\ +",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]\ +}" --grouping name="SubscriptionName" type="Dimension" --grouping name="Environment" type="Tag" --timeframe \ +"MonthToDate" --destination container="exports" resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resour\ +ceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" \ +--recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" \ +--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: ManagementGroupCreateOrUpdateExport + text: |- + az costmanagement export create --name "TestExport" --type "Usage" --aggregation \ +"{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" \ +columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --filter \ +"{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"E\ +ast US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\\ +",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]\ +}" --grouping name="SubscriptionName" type="Dimension" --grouping name="Environment" type="Tag" --timeframe \ +"MonthToDate" --destination container="exports" resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resour\ +ceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" \ +--recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" \ +--scope "providers/Microsoft.Management/managementGroups/TestMG" + - name: ResourceGroupCreateOrUpdateExport + text: |- + az costmanagement export create --name "TestExport" --type "Usage" --aggregation \ +"{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" \ +columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --filter \ +"{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"E\ +ast US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\\ +",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]\ +}" --grouping name="SubscriptionName" type="Dimension" --grouping name="Environment" type="Tag" --timeframe \ +"MonthToDate" --destination container="exports" resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resour\ +ceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" \ +--recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" \ +--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionCreateOrUpdateExport + text: |- + az costmanagement export create --name "TestExport" --type "Usage" --aggregation \ +"{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" \ +columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --filter \ +"{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"E\ +ast US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\\ +",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]\ +}" --grouping name="SubscriptionName" type="Dimension" --grouping name="Environment" type="Tag" --timeframe \ +"MonthToDate" --destination container="exports" resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resour\ +ceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" \ +--recurrence "Weekly" --recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" \ +--scope "subscriptions/00000000-0000-0000-0000-000000000000" +""" + +helps['costmanagement export update'] = """ + type: command + short-summary: "The operation to 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. Update operation does not require eTag." + parameters: + - name: --recurrence-period + short-summary: "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." + long-summary: | + Usage: --recurrence-period from=XX to=XX + + from: Required. The start date of recurrence. + to: The end date of recurrence. + - name: --time-period + short-summary: "Has time period for pulling data for the query." + long-summary: | + Usage: --time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + - name: --configuration + short-summary: "Has configuration information for the data in the export. The configuration will be ignored if \ +aggregation and grouping are provided." + long-summary: | + Usage: --configuration columns=XX + + 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. + - name: --grouping + short-summary: "Array of group by expression to use in the query. Query can have up to 2 group by clauses." + long-summary: | + Usage: --grouping type=XX name=XX + + type: Required. Has type of the column to group. + name: Required. The name of the column to group. + + Multiple actions can be specified by using more than one --grouping argument. + - name: --destination + short-summary: "Has destination for the export being delivered." + long-summary: | + Usage: --destination resource-id=XX container=XX root-folder-path=XX + + resource-id: Required. The resource id of the storage account where exports will be delivered. + container: Required. The name of the container where exports will be uploaded. + root-folder-path: The name of the directory where exports will be uploaded. +""" + +helps['costmanagement export delete'] = """ + type: command + short-summary: "The operation to delete a export." + examples: + - name: BillingAccountDeleteExport + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts\ +/123456" + - name: DepartmentDeleteExport + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts\ +/12/departments/1234" + - name: EnrollmentAccountDeleteExport + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts\ +/100/enrollmentAccounts/456" + - name: ManagementGroupDeleteExport + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Management/managementGr\ +oups/TestMG" + - name: ResourceGroupDeleteExport + text: |- + az costmanagement export delete --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-00000\ +0000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionDeleteExport + text: |- + az costmanagement export delete --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-00000\ +0000000" +""" + +helps['costmanagement export execute'] = """ + type: command + short-summary: "The operation to execute a export." + examples: + - name: BillingAccountExecuteExport + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/123456" + - name: DepartmentExecuteExport + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/12/departments/1234" + - name: EnrollmentAccountExecuteExport + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/100/enrollmentAccounts/456" + - name: ManagementGroupExecuteExport + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Management/managementG\ +roups/TestMG" + - name: ResourceGroupExecuteExport + text: |- + az costmanagement export execute --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionExecuteExport + text: |- + az costmanagement export execute --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000" +""" + +helps['costmanagement export show-execution-history'] = """ + type: command + short-summary: "The operation to get the execution history of an export for the defined scope by export name." + examples: + - name: BillingAccountExecutionHistoryExport + text: |- + az costmanagement export show-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Billing/billingAccounts/123456" + - name: DepartmentExecutionHistoryExport + text: |- + az costmanagement export show-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Billing/billingAccounts/12/departments/1234" + - name: EnrollmentAccountExecutionHistoryExport + text: |- + az costmanagement export show-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: ManagementGroupExecutionHistoryExport + text: |- + az costmanagement export show-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Management/managementGroups/TestMG" + - name: ResourceGroupExecutionHistoryExport + text: |- + az costmanagement export show-execution-history --name "TestExport" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionExecutionHistoryExport + text: |- + az costmanagement export show-execution-history --name "TestExport" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000" +""" diff --git a/src/costmanagement/azext_costmanagement/generated/_params.py b/src/costmanagement/azext_costmanagement/generated/_params.py index 367e16f0a57..9d01a0f0cbb 100644 --- a/src/costmanagement/azext_costmanagement/generated/_params.py +++ b/src/costmanagement/azext_costmanagement/generated/_params.py @@ -1,467 +1,683 @@ -# -------------------------------------------------------------------------- -# 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, _): - pass - - # 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('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('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('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('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.') +# -------------------------------------------------------------------------- +# 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 azure.cli.core.commands.parameters import ( + get_three_state_flag, + get_enum_type +) +from azure.cli.core.commands.validators import validate_file_or_dict +from azext_costmanagement.action import ( + AddCache, + AddKpis, + AddPivots, + AddViewsTimePeriod, + AddViewsConfiguration, + AddViewsGrouping, + AddSorting, + AddDefinition, + AddForecastTimePeriod, + AddForecastConfiguration, + AddForecastGrouping, + AddRecurrencePeriod, + AddDestination +) + + +def load_arguments(self, _): + + with self.argument_context('costmanagement setting show') as c: + c.argument('setting_name', options_list=['--name', '-n', '--setting-name'], type=str, help='Name of the ' + 'setting. Allowed values: myscope') + + with self.argument_context('costmanagement setting create') as c: + c.argument('setting_name', options_list=['--name', '-n', '--setting-name'], type=str, help='Name of the ' + 'setting. Allowed values: myscope') + c.argument('scope', type=str, help='Sets the default scope the current user will see when they sign into Azure ' + 'Cost Management in the Azure portal.') + c.argument('start_on', arg_type=get_enum_type(['LastUsed', 'ScopePicker', 'SpecificScope']), help='Indicates ' + 'what scope Cost Management in the Azure portal should default to. Allowed values: LastUsed.') + c.argument('cache', action=AddCache, nargs='+', help='Array of scopes with additional details used by Cost ' + 'Management in the Azure portal.') + + with self.argument_context('costmanagement setting update') as c: + c.argument('setting_name', options_list=['--name', '-n', '--setting-name'], type=str, help='Name of the ' + 'setting. Allowed values: myscope') + c.argument('scope', type=str, help='Sets the default scope the current user will see when they sign into Azure ' + 'Cost Management in the Azure portal.') + c.argument('start_on', arg_type=get_enum_type(['LastUsed', 'ScopePicker', 'SpecificScope']), help='Indicates ' + 'what scope Cost Management in the Azure portal should default to. Allowed values: LastUsed.') + c.argument('cache', action=AddCache, nargs='+', help='Array of scopes with additional details used by Cost ' + 'Management in the Azure portal.') + c.ignore('parameters') + + with self.argument_context('costmanagement setting delete') as c: + c.argument('setting_name', options_list=['--name', '-n', '--setting-name'], type=str, help='Name of the ' + 'setting. Allowed values: myscope') + + with self.argument_context('costmanagement view list') as c: + c.argument('scope', type=str, help='The scope associated with view operations. This includes ' + '\'subscriptions/{subscriptionId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourc' + 'eGroups/{resourceGroupName}\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccount' + 's/{billingAccountId}\' for Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/departments/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/bi' + 'llingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount ' + 'scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingPro' + 'fileId}\' for BillingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId' + '}/invoiceSections/{invoiceSectionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/m' + 'anagementGroups/{managementGroupId}\' for Management Group scope, \'providers/Microsoft.CostManagem' + 'ent/externalBillingAccounts/{externalBillingAccountName}\' for External Billing Account scope and ' + '\'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}\' for ' + 'External Subscription scope.') + + with self.argument_context('costmanagement view show') as c: + c.argument('scope', type=str, help='The scope associated with view operations. This includes ' + '\'subscriptions/{subscriptionId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourc' + 'eGroups/{resourceGroupName}\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccount' + 's/{billingAccountId}\' for Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/departments/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/bi' + 'llingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount ' + 'scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingPro' + 'fileId}\' for BillingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId' + '}/invoiceSections/{invoiceSectionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/m' + 'anagementGroups/{managementGroupId}\' for Management Group scope, \'providers/Microsoft.CostManagem' + 'ent/externalBillingAccounts/{externalBillingAccountName}\' for External Billing Account scope and ' + '\'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}\' for ' + 'External Subscription scope.') + c.argument('view_name', options_list=['--name', '-n', '--view-name'], type=str, help='View name') + + with self.argument_context('costmanagement view create') as c: + c.argument('scope', type=str, help='The scope associated with view operations. This includes ' + '\'subscriptions/{subscriptionId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourc' + 'eGroups/{resourceGroupName}\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccount' + 's/{billingAccountId}\' for Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/departments/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/bi' + 'llingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount ' + 'scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingPro' + 'fileId}\' for BillingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId' + '}/invoiceSections/{invoiceSectionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/m' + 'anagementGroups/{managementGroupId}\' for Management Group scope, \'providers/Microsoft.CostManagem' + 'ent/externalBillingAccounts/{externalBillingAccountName}\' for External Billing Account scope and ' + '\'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}\' for ' + 'External Subscription scope.') + c.argument('view_name', options_list=['--name', '-n', '--view-name'], type=str, help='View name') + c.argument('e_tag', type=str, help='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.') + c.argument('display_name', type=str, help='User input name of the view. Required.') + c.argument('view_properties_scope', type=str, help='Cost Management scope to save the view on. This includes ' + '\'subscriptions/{subscriptionId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourc' + 'eGroups/{resourceGroupName}\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccount' + 's/{billingAccountId}\' for Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/departments/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/bi' + 'llingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount ' + 'scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingPro' + 'fileId}\' for BillingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId' + '}/invoiceSections/{invoiceSectionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/m' + 'anagementGroups/{managementGroupId}\' for Management Group scope, \'/providers/Microsoft.CostManage' + 'ment/externalBillingAccounts/{externalBillingAccountName}\' for ExternalBillingAccount scope, and ' + '\'/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}\' for ' + 'ExternalSubscription scope.') + 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.') + c.argument('pivots', action=AddPivots, nargs='+', + help='Configuration of 3 sub-views in the Cost Analysis UI.') + c.argument('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.', arg_group='Query') + c.argument('time_period', action=AddViewsTimePeriod, nargs='+', help='Has time period for pulling data for the ' + 'report.', arg_group='Query') + c.argument('granularity', arg_type=get_enum_type(['Daily', 'Monthly']), help='The granularity of rows in the ' + 'report.', arg_group='Query Data Set') + c.argument('configuration', action=AddViewsConfiguration, nargs='+', help='Has configuration information for ' + 'the data in the report. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Query Data Set') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Query Data ' + 'Set') + c.argument('grouping', action=AddViewsGrouping, nargs='+', help='Array of group by expression to use in the ' + 'report. Report can have up to 2 group by clauses.', arg_group='Query Data Set') + c.argument('sorting', action=AddSorting, nargs='+', help='Array of order by expression to use in the report.', + arg_group='Query Data Set') + c.argument('filter_', options_list=['--filter'], type=validate_file_or_dict, help='Has filter expression to ' + 'use in the report. Expected value: json-string/@json-file.', arg_group='Query Data Set') + + with self.argument_context('costmanagement view update') as c: + c.argument('view_name', options_list=['--name', '-n', '--view-name'], type=str, help='View name') + c.argument('e_tag', type=str, help='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.') + c.argument('display_name', type=str, help='User input name of the view. Required.') + c.argument('scope', type=str, help='Cost Management scope to save the view on. This includes ' + '\'subscriptions/{subscriptionId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourc' + 'eGroups/{resourceGroupName}\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccount' + 's/{billingAccountId}\' for Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/departments/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/bi' + 'llingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount ' + 'scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingPro' + 'fileId}\' for BillingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId' + '}/invoiceSections/{invoiceSectionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/m' + 'anagementGroups/{managementGroupId}\' for Management Group scope, \'/providers/Microsoft.CostManage' + 'ment/externalBillingAccounts/{externalBillingAccountName}\' for ExternalBillingAccount scope, and ' + '\'/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}\' for ' + 'ExternalSubscription scope.') + 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.') + c.argument('pivots', action=AddPivots, nargs='+', + help='Configuration of 3 sub-views in the Cost Analysis UI.') + c.argument('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.', arg_group='Query') + c.argument('time_period', action=AddViewsTimePeriod, nargs='+', help='Has time period for pulling data for the ' + 'report.', arg_group='Query') + c.argument('granularity', arg_type=get_enum_type(['Daily', 'Monthly']), help='The granularity of rows in the ' + 'report.', arg_group='Query Data Set') + c.argument('configuration', action=AddViewsConfiguration, nargs='+', help='Has configuration information for ' + 'the data in the report. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Query Data Set') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Query Data ' + 'Set') + c.argument('grouping', action=AddViewsGrouping, nargs='+', help='Array of group by expression to use in the ' + 'report. Report can have up to 2 group by clauses.', arg_group='Query Data Set') + c.argument('sorting', action=AddSorting, nargs='+', help='Array of order by expression to use in the report.', + arg_group='Query Data Set') + c.argument('filter_', options_list=['--filter'], type=validate_file_or_dict, help='Has filter expression to ' + 'use in the report. Expected value: json-string/@json-file.', arg_group='Query Data Set') + c.ignore('parameters') + + with self.argument_context('costmanagement view delete') as c: + c.argument('scope', type=str, help='The scope associated with view operations. This includes ' + '\'subscriptions/{subscriptionId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourc' + 'eGroups/{resourceGroupName}\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccount' + 's/{billingAccountId}\' for Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/departments/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/bi' + 'llingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount ' + 'scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingPro' + 'fileId}\' for BillingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId' + '}/invoiceSections/{invoiceSectionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/m' + 'anagementGroups/{managementGroupId}\' for Management Group scope, \'providers/Microsoft.CostManagem' + 'ent/externalBillingAccounts/{externalBillingAccountName}\' for External Billing Account scope and ' + '\'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}\' for ' + 'External Subscription scope.') + c.argument('view_name', options_list=['--name', '-n', '--view-name'], type=str, help='View name') + + with self.argument_context('costmanagement alert list') as c: + c.argument('scope', type=str, help='The scope associated with alerts operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + + with self.argument_context('costmanagement alert show') as c: + c.argument('scope', type=str, help='The scope associated with alerts operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('alert_id', type=str, help='Alert ID') + + with self.argument_context('costmanagement alert dismiss') as c: + c.argument('scope', type=str, help='The scope associated with alerts operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('alert_id', type=str, help='Alert ID') + c.argument('definition', action=AddDefinition, nargs='+', help='defines the type of alert') + c.argument('description', type=str, help='Alert description') + c.argument('source', arg_type=get_enum_type(['Preset', 'User']), help='Source of alert') + c.argument('cost_entity_id', type=str, help='related budget') + c.argument('status', arg_type=get_enum_type(['None', 'Active', 'Overridden', 'Resolved', 'Dismissed']), + help='alert status') + c.argument('creation_time', type=str, help='dateTime in which alert was created') + c.argument('close_time', type=str, help='dateTime in which alert was closed') + c.argument('modification_time', type=str, help='dateTime in which alert was last modified') + c.argument('status_modification_user_name', type=str, help='') + c.argument('status_modification_time', type=str, help='dateTime in which the alert status was last modified') + c.argument('time_grain_type', arg_type=get_enum_type(['None', 'Monthly', 'Quarterly', 'Annually', + 'BillingMonth', 'BillingQuarter', 'BillingAnnual']), + help='Type of timegrain cadence', arg_group='Details') + c.argument('period_start_date', type=str, help='datetime of periodStartDate', arg_group='Details') + c.argument('triggered_by', type=str, help='notificationId that triggered this alert', arg_group='Details') + c.argument('resource_group_filter', type=validate_file_or_dict, help='array of resourceGroups to filter by ' + 'Expected value: json-string/@json-file.', arg_group='Details') + c.argument('resource_filter', type=validate_file_or_dict, help='array of resources to filter by Expected ' + 'value: json-string/@json-file.', arg_group='Details') + c.argument('meter_filter', type=validate_file_or_dict, help='array of meters to filter by Expected value: ' + 'json-string/@json-file.', arg_group='Details') + c.argument('tag_filter', type=validate_file_or_dict, help='tags to filter by Expected value: ' + 'json-string/@json-file.', arg_group='Details') + c.argument('threshold', type=float, help='notification threshold percentage as a decimal which activated this ' + 'alert', arg_group='Details') + c.argument('operator', arg_type=get_enum_type(['None', 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo', + 'LessThan', 'LessThanOrEqualTo']), help='operator used to ' + 'compare currentSpend with amount', arg_group='Details') + c.argument('amount', type=float, help='budget threshold amount', arg_group='Details') + c.argument('unit', type=str, help='unit of currency being used', arg_group='Details') + c.argument('current_spend', type=float, help='current spend', arg_group='Details') + c.argument('contact_emails', nargs='+', help='list of emails to contact', arg_group='Details') + c.argument('contact_groups', nargs='+', help='list of action groups to broadcast to', arg_group='Details') + c.argument('contact_roles', nargs='+', help='list of contact roles', arg_group='Details') + c.argument('overriding_alert', type=str, help='overriding alert', arg_group='Details') + + with self.argument_context('costmanagement alert list-external') as c: + c.argument('external_cloud_provider_type', arg_type=get_enum_type(['externalSubscriptions', + 'externalBillingAccounts']), help='The ' + 'external cloud provider type associated with dimension/query operations. This includes ' + '\'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidated ' + 'account.') + c.argument('external_cloud_provider_id', type=str, 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_', options_list=['--filter'], type=str, help='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\'.') + c.argument('external_cloud_provider_type', arg_type=get_enum_type(['externalSubscriptions', + 'externalBillingAccounts']), help='The ' + 'external cloud provider type associated with dimension/query operations. This includes ' + '\'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidated ' + 'account.') + c.argument('external_cloud_provider_id', type=str, 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', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The ' + 'time frame for pulling data for the forecast. If custom, then a specific time period must be ' + 'provided.') + c.argument('time_period', action=AddForecastTimePeriod, nargs='+', help='Has time period for pulling data for ' + 'the forecast.') + c.argument('include_actual_cost', arg_type=get_three_state_flag(), help='a boolean determining if actualCost ' + 'will be included') + c.argument('include_fresh_partial_cost', arg_type=get_three_state_flag(), help='a boolean determining if ' + 'FreshPartialCost will be included') + c.argument('configuration', action=AddForecastConfiguration, nargs='+', help='Has configuration information ' + 'for the data in the export. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Dataset') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Dataset') + c.argument('grouping', action=AddForecastGrouping, nargs='+', help='Array of group by expression to use in the ' + 'query. Query can have up to 2 group by clauses.', arg_group='Dataset') + c.argument('query_filter', type=validate_file_or_dict, help='The filter expression to use in the query. Please ' + 'reference our Query API REST documentation for how to properly format the filter. Expected value: ' + 'json-string/@json-file.', arg_group='Dataset') + + with self.argument_context('costmanagement forecast usage') as c: + c.argument('filter_', options_list=['--filter'], type=str, help='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\'.') + c.argument('scope', type=str, help='The scope associated with forecast operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + 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', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The ' + 'time frame for pulling data for the forecast. If custom, then a specific time period must be ' + 'provided.') + c.argument('time_period', action=AddForecastTimePeriod, nargs='+', help='Has time period for pulling data for ' + 'the forecast.') + c.argument('include_actual_cost', arg_type=get_three_state_flag(), help='a boolean determining if actualCost ' + 'will be included') + c.argument('include_fresh_partial_cost', arg_type=get_three_state_flag(), help='a boolean determining if ' + 'FreshPartialCost will be included') + c.argument('configuration', action=AddForecastConfiguration, nargs='+', help='Has configuration information ' + 'for the data in the export. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Dataset') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Dataset') + c.argument('grouping', action=AddForecastGrouping, nargs='+', help='Array of group by expression to use in the ' + 'query. Query can have up to 2 group by clauses.', arg_group='Dataset') + c.argument('query_filter', type=validate_file_or_dict, help='The filter expression to use in the query. Please ' + 'reference our Query API REST documentation for how to properly format the filter. Expected value: ' + 'json-string/@json-file.', arg_group='Dataset') + + with self.argument_context('costmanagement dimension list') as c: + c.argument('scope', type=str, help='The scope associated with dimension operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope, \'/providers/Microsoft.Billing/billingAccount' + 's/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId}\' for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/billingProfiles/{billingProfileId}\' for billingProfile scope, ' + '\'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + '/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and \'providers/Microsoft.Billing/b' + 'illingAccounts/{billingAccountId}/customers/{customerId}\' specific for partners.') + c.argument('filter_', options_list=['--filter'], type=str, help='May be used to filter dimensions by ' + 'properties/category, properties/usageStart, properties/usageEnd. Supported operators are ' + '\'eq\',\'lt\', \'gt\', \'le\', \'ge\'.') + c.argument('expand', type=str, help='May be used to expand the properties/data within a dimension category. By ' + 'default, data is not included when listing dimensions.') + c.argument('skiptoken', type=str, help='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.') + c.argument('top', type=int, 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', + 'externalBillingAccounts']), help='The ' + 'external cloud provider type associated with dimension/query operations. This includes ' + '\'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidated ' + 'account.') + c.argument('external_cloud_provider_id', type=str, help='This can be \'{externalSubscriptionId}\' for linked ' + 'account or \'{externalBillingAccountId}\' for consolidated account used with dimension/query ' + 'operations.') + c.argument('filter_', options_list=['--filter'], type=str, help='May be used to filter dimensions by ' + 'properties/category, properties/usageStart, properties/usageEnd. Supported operators are ' + '\'eq\',\'lt\', \'gt\', \'le\', \'ge\'.') + c.argument('expand', type=str, help='May be used to expand the properties/data within a dimension category. By ' + 'default, data is not included when listing dimensions.') + c.argument('skiptoken', type=str, help='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.') + c.argument('top', type=int, 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', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + 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', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The ' + 'time frame for pulling data for the query. If custom, then a specific time period must be ' + 'provided.') + c.argument('time_period', action=AddForecastTimePeriod, nargs='+', help='Has time period for pulling data for ' + 'the query.') + c.argument('configuration', action=AddForecastConfiguration, nargs='+', help='Has configuration information ' + 'for the data in the export. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Dataset') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Dataset') + c.argument('grouping', action=AddForecastGrouping, nargs='+', help='Array of group by expression to use in the ' + 'query. Query can have up to 2 group by clauses.', arg_group='Dataset') + c.argument('filter_', options_list=['--filter'], type=validate_file_or_dict, help='The filter expression to ' + 'use in the query. Please reference our Query API REST documentation for how to properly format the ' + 'filter. Expected value: json-string/@json-file.', arg_group='Dataset') + + 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', + 'externalBillingAccounts']), help='The ' + 'external cloud provider type associated with dimension/query operations. This includes ' + '\'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidated ' + 'account.') + c.argument('external_cloud_provider_id', type=str, 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', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The ' + 'time frame for pulling data for the query. If custom, then a specific time period must be ' + 'provided.') + c.argument('time_period', action=AddForecastTimePeriod, nargs='+', help='Has time period for pulling data for ' + 'the query.') + c.argument('configuration', action=AddForecastConfiguration, nargs='+', help='Has configuration information ' + 'for the data in the export. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Dataset') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Dataset') + c.argument('grouping', action=AddForecastGrouping, nargs='+', help='Array of group by expression to use in the ' + 'query. Query can have up to 2 group by clauses.', arg_group='Dataset') + c.argument('filter_', options_list=['--filter'], type=validate_file_or_dict, help='The filter expression to ' + 'use in the query. Please reference our Query API REST documentation for how to properly format the ' + 'filter. Expected value: json-string/@json-file.', arg_group='Dataset') + + with self.argument_context('costmanagement generate-reservation-detail-report by-billing-account-id') as c: + c.argument('billing_account_id', type=str, help='Enrollment ID (Legacy BillingAccount ID)') + c.argument('start_date', type=str, help='Start Date') + c.argument('end_date', type=str, help='End Date') + + with self.argument_context('costmanagement generate-reservation-detail-report by-billing-profile-id') as c: + c.argument('billing_account_id', type=str, help='BillingAccount ID') + c.argument('billing_profile_id', type=str, help='BillingProfile ID') + c.argument('start_date', type=str, help='Start Date') + c.argument('end_date', type=str, help='End Date') + + with self.argument_context('costmanagement export list') as c: + c.argument('scope', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + + with self.argument_context('costmanagement export show') as c: + c.argument('scope', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('export_name', options_list=['--name', '-n', '--export-name'], type=str, help='Export Name.') + + with self.argument_context('costmanagement export create') as c: + c.argument('scope', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('export_name', options_list=['--name', '-n', '--export-name'], type=str, help='Export Name.') + c.argument('e_tag', type=str, help='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.') + c.argument('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.', arg_group='Schedule') + c.argument('recurrence', arg_type=get_enum_type(['Daily', 'Weekly', 'Monthly', 'Annually']), help='The ' + 'schedule recurrence.', arg_group='Schedule') + c.argument('recurrence_period', action=AddRecurrencePeriod, 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.', arg_group='Schedule') + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), + help='The type of the query.', arg_group='Definition') + c.argument('timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The ' + 'time frame for pulling data for the query. If custom, then a specific time period must be ' + 'provided.', arg_group='Definition') + c.argument('time_period', action=AddForecastTimePeriod, nargs='+', help='Has time period for pulling data for ' + 'the query.', arg_group='Definition') + c.argument('configuration', action=AddForecastConfiguration, nargs='+', help='Has configuration information ' + 'for the data in the export. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Definition Data Set') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Definition ' + 'Data Set') + c.argument('grouping', action=AddForecastGrouping, nargs='+', help='Array of group by expression to use in the ' + 'query. Query can have up to 2 group by clauses.', arg_group='Definition Data Set') + c.argument('filter_', options_list=['--filter'], type=validate_file_or_dict, help='The filter expression to ' + 'use in the query. Please reference our Query API REST documentation for how to properly format the ' + 'filter. Expected value: json-string/@json-file.', arg_group='Definition Data Set') + c.argument('destination', action=AddDestination, nargs='+', help='Has destination for the export being ' + 'delivered.', arg_group='Delivery Info') + + with self.argument_context('costmanagement export update') as c: + c.argument('scope', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('export_name', options_list=['--name', '-n', '--export-name'], type=str, help='Export Name.') + c.argument('e_tag', type=str, help='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.') + c.argument('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.', arg_group='Schedule') + c.argument('recurrence', arg_type=get_enum_type(['Daily', 'Weekly', 'Monthly', 'Annually']), help='The ' + 'schedule recurrence.', arg_group='Schedule') + c.argument('recurrence_period', action=AddRecurrencePeriod, 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.', arg_group='Schedule') + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), + help='The type of the query.', arg_group='Definition') + c.argument('timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The ' + 'time frame for pulling data for the query. If custom, then a specific time period must be ' + 'provided.', arg_group='Definition') + c.argument('time_period', action=AddForecastTimePeriod, nargs='+', help='Has time period for pulling data for ' + 'the query.', arg_group='Definition') + c.argument('configuration', action=AddForecastConfiguration, nargs='+', help='Has configuration information ' + 'for the data in the export. The configuration will be ignored if aggregation and grouping are ' + 'provided.', arg_group='Definition Data Set') + c.argument('aggregation', type=validate_file_or_dict, help='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. Expected value: json-string/@json-file.', arg_group='Definition ' + 'Data Set') + c.argument('grouping', action=AddForecastGrouping, nargs='+', help='Array of group by expression to use in the ' + 'query. Query can have up to 2 group by clauses.', arg_group='Definition Data Set') + c.argument('filter_', options_list=['--filter'], type=validate_file_or_dict, help='The filter expression to ' + 'use in the query. Please reference our Query API REST documentation for how to properly format the ' + 'filter. Expected value: json-string/@json-file.', arg_group='Definition Data Set') + c.argument('destination', action=AddDestination, nargs='+', help='Has destination for the export being ' + 'delivered.', arg_group='Delivery Info') + c.ignore('parameters') + + with self.argument_context('costmanagement export delete') as c: + c.argument('scope', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('export_name', options_list=['--name', '-n', '--export-name'], type=str, help='Export Name.') + + with self.argument_context('costmanagement export execute') as c: + c.argument('scope', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('export_name', options_list=['--name', '-n', '--export-name'], type=str, help='Export Name.') + + with self.argument_context('costmanagement export show-execution-history') as c: + c.argument('scope', type=str, help='The scope associated with query and export operations. This includes ' + '\'/subscriptions/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/reso' + 'urceGroups/{resourceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAcc' + 'ounts/{billingAccountId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAcco' + 'unts/{billingAccountId}/departments/{departmentId}\' for Department scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAcc' + 'ountId}\' for EnrollmentAccount scope, \'/providers/Microsoft.Management/managementGroups/{manageme' + 'ntGroupId} for Management Group scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/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.') + c.argument('export_name', options_list=['--name', '-n', '--export-name'], type=str, help='Export Name.') diff --git a/src/costmanagement/azext_costmanagement/generated/_validators.py b/src/costmanagement/azext_costmanagement/generated/_validators.py index 7536d0531ea..b33a44c1ebf 100644 --- a/src/costmanagement/azext_costmanagement/generated/_validators.py +++ b/src/costmanagement/azext_costmanagement/generated/_validators.py @@ -1,23 +1,9 @@ -# -------------------------------------------------------------------------- -# 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 - ) +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/src/costmanagement/azext_costmanagement/generated/action.py b/src/costmanagement/azext_costmanagement/generated/action.py index e56edb2b2fb..7e1744cb466 100644 --- a/src/costmanagement/azext_costmanagement/generated/action.py +++ b/src/costmanagement/azext_costmanagement/generated/action.py @@ -1,214 +1,375 @@ -# -------------------------------------------------------------------------- -# 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) - if hasattr(namespace, 'definition_time_period'): - namespace.definition_time_period = action - if hasattr(namespace, 'time_period'): - 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) - if hasattr(namespace, 'dataset_configuration'): - namespace.dataset_configuration = action - if hasattr(namespace, 'definition_dataset_configuration'): - namespace.definition_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 +# -------------------------------------------------------------------------- +# 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 collections import defaultdict +from knack.util import CLIError + + +class AddCache(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddCache, 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 == 'id': + d['id'] = v[0] + elif kl == 'name': + d['name'] = v[0] + elif kl == 'channel': + d['channel'] = v[0] + elif kl == 'subchannel': + d['subchannel'] = v[0] + elif kl == 'parent': + d['parent'] = v[0] + elif kl == 'status': + d['status'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter cache. All possible keys are: id, name, ' + 'channel, subchannel, parent, status'.format(k)) + return d + + +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] + else: + raise CLIError('Unsupported Key {} is provided for parameter kpis. All possible keys are: type, id, ' + 'enabled'.format(k)) + 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] + else: + raise CLIError('Unsupported Key {} is provided for parameter pivots. All possible keys are: type, name' + .format(k)) + return d + + +class AddViewsTimePeriod(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] + else: + raise CLIError('Unsupported Key {} is provided for parameter time_period. All possible keys are: from, ' + 'to'.format(k)) + return d + + +class AddViewsConfiguration(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.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 + else: + raise CLIError('Unsupported Key {} is provided for parameter configuration. All possible keys are: ' + 'columns'.format(k)) + return d + + +class AddViewsGrouping(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddViewsGrouping, 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] + else: + raise CLIError('Unsupported Key {} is provided for parameter grouping. All possible keys are: type, ' + 'name'.format(k)) + return d + + +class AddSorting(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddSorting, 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 == 'direction': + d['direction'] = v[0] + elif kl == 'name': + d['name'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter sorting. All possible keys are: ' + 'direction, name'.format(k)) + return d + + +class AddDefinition(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.definition = 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 == 'type': + d['type'] = v[0] + elif kl == 'category': + d['category'] = v[0] + elif kl == 'criteria': + d['criteria'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter definition. All possible keys are: type, ' + 'category, criteria'.format(k)) + return d + + +class AddForecastTimePeriod(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] + else: + raise CLIError('Unsupported Key {} is provided for parameter time_period. All possible keys are: from, ' + 'to'.format(k)) + return d + + +class AddForecastConfiguration(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.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 + else: + raise CLIError('Unsupported Key {} is provided for parameter configuration. All possible keys are: ' + 'columns'.format(k)) + return d + + +class AddForecastGrouping(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddForecastGrouping, 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] + else: + raise CLIError('Unsupported Key {} is provided for parameter grouping. All possible keys are: type, ' + 'name'.format(k)) + return d + + +class AddRecurrencePeriod(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.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] + else: + raise CLIError('Unsupported Key {} is provided for parameter recurrence_period. All possible keys are: ' + 'from, to'.format(k)) + return d + + +class AddDestination(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.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] + else: + raise CLIError('Unsupported Key {} is provided for parameter destination. All possible keys are: ' + 'resource-id, container, root-folder-path'.format(k)) + return d diff --git a/src/costmanagement/azext_costmanagement/generated/commands.py b/src/costmanagement/azext_costmanagement/generated/commands.py index 8a61dbaec20..04165081d56 100644 --- a/src/costmanagement/azext_costmanagement/generated/commands.py +++ b/src/costmanagement/azext_costmanagement/generated/commands.py @@ -1,83 +1,110 @@ -# -------------------------------------------------------------------------- -# 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, _): - pass - -# 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') +# -------------------------------------------------------------------------- +# 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-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_costmanagement.generated._client_factory import cf_setting + costmanagement_setting = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._settings_operations#SettingsOper' + 'ations.{}', + client_factory=cf_setting) + with self.command_group('costmanagement setting', costmanagement_setting, client_factory=cf_setting) as g: + g.custom_command('list', 'costmanagement_setting_list') + g.custom_show_command('show', 'costmanagement_setting_show') + g.custom_command('create', 'costmanagement_setting_create') + g.generic_update_command('update', custom_func_name='costmanagement_setting_update') + g.custom_command('delete', 'costmanagement_setting_delete', confirmation=True) + + from azext_costmanagement.generated._client_factory import cf_view + costmanagement_view = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._views_operations#ViewsOperations' + '.{}', + client_factory=cf_view) + with self.command_group('costmanagement view', costmanagement_view, client_factory=cf_view) 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.generic_update_command('update', custom_func_name='costmanagement_view_update') + g.custom_command('delete', 'costmanagement_view_delete', confirmation=True) + + from azext_costmanagement.generated._client_factory import cf_alert + costmanagement_alert = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._alerts_operations#AlertsOperatio' + 'ns.{}', + client_factory=cf_alert) + with self.command_group('costmanagement alert', costmanagement_alert, client_factory=cf_alert) as g: + g.custom_command('list', 'costmanagement_alert_list') + g.custom_show_command('show', 'costmanagement_alert_show') + g.custom_command('dismiss', 'costmanagement_alert_dismiss') + 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) 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._dimensions_operations#Dimensions' + 'Operations.{}', + client_factory=cf_dimension) + with self.command_group('costmanagement dimension', costmanagement_dimension, client_factory=cf_dimension) 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) 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_generate_reservation_detail_report + costmanagement_generate_reservation_detail_report = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._generate_reservation_details_rep' + 'ort_operations#GenerateReservationDetailsReportOperations.{}', + client_factory=cf_generate_reservation_detail_report) + with self.command_group('costmanagement generate-reservation-detail-report', + costmanagement_generate_reservation_detail_report, + client_factory=cf_generate_reservation_detail_report) as g: + g.custom_command('by-billing-account-id', 'costmanagement_generate_reservation_detail_report_by_billing_account' + '_id') + g.custom_command('by-billing-profile-id', 'costmanagement_generate_reservation_detail_report_by_billing_profile' + '_id') + + from azext_costmanagement.generated._client_factory import cf_export + costmanagement_export = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._exports_operations#ExportsOperat' + 'ions.{}', + client_factory=cf_export) + with self.command_group('costmanagement export', costmanagement_export, client_factory=cf_export) 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.generic_update_command('update', custom_func_name='costmanagement_export_update') + g.custom_command('delete', 'costmanagement_export_delete', confirmation=True) + g.custom_command('execute', 'costmanagement_export_execute') + g.custom_command('show-execution-history', 'costmanagement_export_show_execution_history') + + with self.command_group('costmanagement', is_experimental=True): + pass diff --git a/src/costmanagement/azext_costmanagement/generated/custom.py b/src/costmanagement/azext_costmanagement/generated/custom.py index 2c3fce143c8..f51c160c980 100644 --- a/src/costmanagement/azext_costmanagement/generated/custom.py +++ b/src/costmanagement/azext_costmanagement/generated/custom.py @@ -1,328 +1,552 @@ -# -------------------------------------------------------------------------- -# 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, -# e_tag=None, -# 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, -# e_tag=e_tag, -# 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, -# e_tag=None, -# 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, -# e_tag=e_tag, -# 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) +# -------------------------------------------------------------------------- +# 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=unused-argument + + +def costmanagement_setting_list(client): + return client.list() + + +def costmanagement_setting_show(client, + setting_name): + return client.get(setting_name=setting_name) + + +def costmanagement_setting_create(client, + setting_name, + scope=None, + start_on=None, + cache=None): + parameters = {} + parameters['scope'] = scope + parameters['start_on'] = start_on + parameters['cache'] = cache + return client.create_or_update(setting_name=setting_name, + parameters=parameters) + + +def costmanagement_setting_update(instance, + setting_name, + scope=None, + start_on=None, + cache=None): + if scope is not None: + instance.scope = scope + if start_on is not None: + instance.start_on = start_on + if cache is not None: + instance.cache = cache + return instance + + +def costmanagement_setting_delete(client, + setting_name): + return client.delete(setting_name=setting_name) + + +def costmanagement_view_list(client, + scope=None): + if scope is not None: + return client.list_by_scope(scope=scope) + return client.list() + + +def costmanagement_view_show(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(client, + view_name, + scope=None, + e_tag=None, + display_name=None, + view_properties_scope=None, + chart=None, + accumulated=None, + metric=None, + kpis=None, + pivots=None, + timeframe=None, + time_period=None, + granularity=None, + configuration=None, + aggregation=None, + grouping=None, + sorting=None, + filter_=None): + parameters = {} + parameters['e_tag'] = e_tag + parameters['display_name'] = display_name + parameters['scope'] = view_properties_scope + parameters['chart'] = chart + parameters['accumulated'] = accumulated + parameters['metric'] = metric + parameters['kpis'] = kpis + parameters['pivots'] = pivots + parameters['type_properties_query_type'] = "Usage" + parameters['timeframe'] = timeframe + parameters['time_period'] = time_period + parameters['data_set'] = {} + parameters['data_set']['granularity'] = granularity + parameters['data_set']['configuration'] = configuration + parameters['data_set']['aggregation'] = aggregation + parameters['data_set']['grouping'] = grouping + parameters['data_set']['sorting'] = sorting + parameters['data_set']['filter'] = filter_ + parameters = {} + parameters['e_tag'] = e_tag + parameters['display_name'] = display_name + parameters['scope'] = scope + parameters['chart'] = chart + parameters['accumulated'] = accumulated + parameters['metric'] = metric + parameters['kpis'] = kpis + parameters['pivots'] = pivots + parameters['type_properties_query_type'] = "Usage" + parameters['timeframe'] = timeframe + parameters['time_period'] = time_period + parameters['data_set'] = {} + parameters['data_set']['granularity'] = granularity + parameters['data_set']['configuration'] = configuration + parameters['data_set']['aggregation'] = aggregation + parameters['data_set']['grouping'] = grouping + parameters['data_set']['sorting'] = sorting + parameters['data_set']['filter'] = filter_ + if scope is not None and view_name is not None: + return client.create_or_update_by_scope(scope=scope, + view_name=view_name, + parameters=parameters) + return client.create_or_update(view_name=view_name, + parameters=parameters) + + +def costmanagement_view_update(instance, + view_name, + e_tag=None, + display_name=None, + scope=None, + chart=None, + accumulated=None, + metric=None, + kpis=None, + pivots=None, + timeframe=None, + time_period=None, + granularity=None, + configuration=None, + aggregation=None, + grouping=None, + sorting=None, + filter_=None): + if e_tag is not None: + instance.e_tag = e_tag + if display_name is not None: + instance.display_name = display_name + if scope is not None: + instance.scope = scope + if chart is not None: + instance.chart = chart + if accumulated is not None: + instance.accumulated = accumulated + if metric is not None: + instance.metric = metric + if kpis is not None: + instance.kpis = kpis + if pivots is not None: + instance.pivots = pivots + if "Usage" is not None: + instance.type_properties_query_type = "Usage" + if timeframe is not None: + instance.timeframe = timeframe + if time_period is not None: + instance.time_period = time_period + if granularity is not None: + instance.data_set.granularity = granularity + if configuration is not None: + instance.data_set.configuration = configuration + if aggregation is not None: + instance.data_set.aggregation = aggregation + if grouping is not None: + instance.data_set.grouping = grouping + if sorting is not None: + instance.data_set.sorting = sorting + if filter_ is not None: + instance.data_set.filter = filter_ + return instance + + +def costmanagement_view_delete(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(client, + scope): + return client.list(scope=scope) + + +def costmanagement_alert_show(client, + scope, + alert_id): + return client.get(scope=scope, + alert_id=alert_id) + + +def costmanagement_alert_dismiss(client, + scope, + alert_id, + definition=None, + description=None, + source=None, + cost_entity_id=None, + status=None, + creation_time=None, + close_time=None, + modification_time=None, + status_modification_user_name=None, + status_modification_time=None, + time_grain_type=None, + period_start_date=None, + triggered_by=None, + resource_group_filter=None, + resource_filter=None, + meter_filter=None, + tag_filter=None, + threshold=None, + operator=None, + amount=None, + unit=None, + current_spend=None, + contact_emails=None, + contact_groups=None, + contact_roles=None, + overriding_alert=None): + parameters = {} + parameters['definition'] = definition + parameters['description'] = description + parameters['source'] = source + parameters['cost_entity_id'] = cost_entity_id + parameters['status'] = status + parameters['creation_time'] = creation_time + parameters['close_time'] = close_time + parameters['modification_time'] = modification_time + parameters['status_modification_user_name'] = status_modification_user_name + parameters['status_modification_time'] = status_modification_time + parameters['details'] = {} + parameters['details']['time_grain_type'] = time_grain_type + parameters['details']['period_start_date'] = period_start_date + parameters['details']['triggered_by'] = triggered_by + parameters['details']['resource_group_filter'] = resource_group_filter + parameters['details']['resource_filter'] = resource_filter + parameters['details']['meter_filter'] = meter_filter + parameters['details']['tag_filter'] = tag_filter + parameters['details']['threshold'] = threshold + parameters['details']['operator'] = operator + parameters['details']['amount'] = amount + parameters['details']['unit'] = unit + parameters['details']['current_spend'] = current_spend + parameters['details']['contact_emails'] = contact_emails + parameters['details']['contact_groups'] = contact_groups + parameters['details']['contact_roles'] = contact_roles + parameters['details']['overriding_alert'] = overriding_alert + return client.dismiss(scope=scope, + alert_id=alert_id, + parameters=parameters) + + +def costmanagement_alert_list_external(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(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, + configuration=None, + aggregation=None, + grouping=None, + query_filter=None): + parameters = {} + parameters['type'] = type_ + parameters['timeframe'] = timeframe + parameters['time_period'] = time_period + parameters['include_actual_cost'] = include_actual_cost + parameters['include_fresh_partial_cost'] = include_fresh_partial_cost + parameters['dataset'] = {} + parameters['dataset']['granularity'] = "Daily" + parameters['dataset']['configuration'] = configuration + parameters['dataset']['aggregation'] = aggregation + parameters['dataset']['grouping'] = grouping + parameters['dataset']['filter'] = query_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, + parameters=parameters) + + +def costmanagement_forecast_usage(client, + scope, + type_, + timeframe, + filter_=None, + time_period=None, + include_actual_cost=None, + include_fresh_partial_cost=None, + configuration=None, + aggregation=None, + grouping=None, + query_filter=None): + parameters = {} + parameters['type'] = type_ + parameters['timeframe'] = timeframe + parameters['time_period'] = time_period + parameters['include_actual_cost'] = include_actual_cost + parameters['include_fresh_partial_cost'] = include_fresh_partial_cost + parameters['dataset'] = {} + parameters['dataset']['granularity'] = "Daily" + parameters['dataset']['configuration'] = configuration + parameters['dataset']['aggregation'] = aggregation + parameters['dataset']['grouping'] = grouping + parameters['dataset']['filter'] = query_filter + return client.usage(filter=filter_, + scope=scope, + parameters=parameters) + + +def costmanagement_dimension_list(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(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(client, + scope, + type_, + timeframe, + time_period=None, + configuration=None, + aggregation=None, + grouping=None, + filter_=None): + parameters = {} + parameters['type'] = type_ + parameters['timeframe'] = timeframe + parameters['time_period'] = time_period + parameters['dataset'] = {} + parameters['dataset']['granularity'] = "Daily" + parameters['dataset']['configuration'] = configuration + parameters['dataset']['aggregation'] = aggregation + parameters['dataset']['grouping'] = grouping + parameters['dataset']['filter'] = filter_ + return client.usage(scope=scope, + parameters=parameters) + + +def costmanagement_query_usage_by_external_cloud_provider_type(client, + external_cloud_provider_type, + external_cloud_provider_id, + type_, + timeframe, + time_period=None, + configuration=None, + aggregation=None, + grouping=None, + filter_=None): + parameters = {} + parameters['type'] = type_ + parameters['timeframe'] = timeframe + parameters['time_period'] = time_period + parameters['dataset'] = {} + parameters['dataset']['granularity'] = "Daily" + parameters['dataset']['configuration'] = configuration + parameters['dataset']['aggregation'] = aggregation + parameters['dataset']['grouping'] = grouping + parameters['dataset']['filter'] = 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, + parameters=parameters) + + +def costmanagement_generate_reservation_detail_report_by_billing_account_id(client, + billing_account_id, + start_date, + end_date): + return client.begin_by_billing_account_id(billing_account_id=billing_account_id, + start_date=start_date, + end_date=end_date) + + +def costmanagement_generate_reservation_detail_report_by_billing_profile_id(client, + billing_account_id, + billing_profile_id, + start_date, + end_date): + return client.begin_by_billing_profile_id(billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + start_date=start_date, + end_date=end_date) + + +def costmanagement_export_list(client, + scope): + return client.list(scope=scope) + + +def costmanagement_export_show(client, + scope, + export_name): + return client.get(scope=scope, + export_name=export_name) + + +def costmanagement_export_create(client, + scope, + export_name, + e_tag=None, + status=None, + recurrence=None, + recurrence_period=None, + type_=None, + timeframe=None, + time_period=None, + configuration=None, + aggregation=None, + grouping=None, + filter_=None, + destination=None): + parameters = {} + parameters['e_tag'] = e_tag + parameters['format'] = "Csv" + parameters['schedule'] = {} + parameters['schedule']['status'] = status + parameters['schedule']['recurrence'] = recurrence + parameters['schedule']['recurrence_period'] = recurrence_period + parameters['definition'] = {} + parameters['definition']['type'] = type_ + parameters['definition']['timeframe'] = timeframe + parameters['definition']['time_period'] = time_period + parameters['definition']['data_set'] = {} + parameters['definition']['data_set']['granularity'] = "Daily" + parameters['definition']['data_set']['configuration'] = configuration + parameters['definition']['data_set']['aggregation'] = aggregation + parameters['definition']['data_set']['grouping'] = grouping + parameters['definition']['data_set']['filter'] = filter_ + parameters['delivery_info'] = {} + parameters['delivery_info']['destination'] = destination + return client.create_or_update(scope=scope, + export_name=export_name, + parameters=parameters) + + +def costmanagement_export_update(instance, + scope, + export_name, + e_tag=None, + status=None, + recurrence=None, + recurrence_period=None, + type_=None, + timeframe=None, + time_period=None, + configuration=None, + aggregation=None, + grouping=None, + filter_=None, + destination=None): + if e_tag is not None: + instance.e_tag = e_tag + if "Csv" is not None: + instance.format = "Csv" + if status is not None: + instance.schedule.status = status + if recurrence is not None: + instance.schedule.recurrence = recurrence + if recurrence_period is not None: + instance.schedule.recurrence_period = recurrence_period + if type_ is not None: + instance.definition.type = type_ + if timeframe is not None: + instance.definition.timeframe = timeframe + if time_period is not None: + instance.definition.time_period = time_period + if "Daily" is not None: + instance.definition.data_set.granularity = "Daily" + if configuration is not None: + instance.definition.data_set.configuration = configuration + if aggregation is not None: + instance.definition.data_set.aggregation = aggregation + if grouping is not None: + instance.definition.data_set.grouping = grouping + if filter_ is not None: + instance.definition.data_set.filter = filter_ + if destination is not None: + instance.delivery_info.destination = destination + return instance + + +def costmanagement_export_delete(client, + scope, + export_name): + return client.delete(scope=scope, + export_name=export_name) + + +def costmanagement_export_execute(client, + scope, + export_name): + return client.execute(scope=scope, + export_name=export_name) + + +def costmanagement_export_show_execution_history(client, + scope, + export_name): + return client.get_execution_history(scope=scope, + export_name=export_name) diff --git a/src/costmanagement/azext_costmanagement/manual/__init__.py b/src/costmanagement/azext_costmanagement/manual/__init__.py index ee0c4f36bd0..c9cfdc73e77 100644 --- a/src/costmanagement/azext_costmanagement/manual/__init__.py +++ b/src/costmanagement/azext_costmanagement/manual/__init__.py @@ -1,12 +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__) +# 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 index fe1bd438b46..70488e93851 100644 --- a/src/costmanagement/azext_costmanagement/tests/__init__.py +++ b/src/costmanagement/azext_costmanagement/tests/__init__.py @@ -1,49 +1,116 @@ -# 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 +# 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 logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() + 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) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/costmanagement/azext_costmanagement/tests/latest/__init__.py b/src/costmanagement/azext_costmanagement/tests/latest/__init__.py index ee0c4f36bd0..c9cfdc73e77 100644 --- a/src/costmanagement/azext_costmanagement/tests/latest/__init__.py +++ b/src/costmanagement/azext_costmanagement/tests/latest/__init__.py @@ -1,12 +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__) +# 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/example_steps.py b/src/costmanagement/azext_costmanagement/tests/latest/example_steps.py new file mode 100644 index 00000000000..fb8055829ce --- /dev/null +++ b/src/costmanagement/azext_costmanagement/tests/latest/example_steps.py @@ -0,0 +1,1610 @@ +# -------------------------------------------------------------------------- +# 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 .. import try_manual + + +# EXAMPLE: /Alerts/get/BillingAccountAlerts +@try_manual +def step_alert_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=checks) + + +# EXAMPLE: /Alerts/get/BillingProfileAlerts +@try_manual +def step_alert_list2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=checks) + + +# EXAMPLE: /Alerts/get/DepartmentAlerts +@try_manual +def step_alert_list3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"', + checks=checks) + + +# EXAMPLE: /Alerts/get/EnrollmentAccountAlerts +@try_manual +def step_alert_list4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Alerts/get/ExternalBillingAccountAlerts +@try_manual +def step_alert_list_external(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list-external ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts"', + checks=checks) + + +# EXAMPLE: /Alerts/get/ExternalSubscriptionAlerts +@try_manual +def step_alert_list_external2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list-external ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions"', + checks=checks) + + +# EXAMPLE: /Alerts/get/InvoiceSectionAlerts +@try_manual +def step_alert_list5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=checks) + + +# EXAMPLE: /Alerts/get/ResourceGroupAlerts +@try_manual +def step_alert_list6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=checks) + + +# EXAMPLE: /Alerts/get/SubscriptionAlerts +@try_manual +def step_alert_list7(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Alerts/patch/ResourceGroupAlerts +@try_manual +def step_alert_dismiss(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert dismiss ' + '--alert-id "22222222-2222-2222-2222-222222222222" ' + '--status "Dismissed" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=checks) + + +# EXAMPLE: /Alerts/patch/SubscriptionAlerts +@try_manual +def step_alert_dismiss2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement alert dismiss ' + '--alert-id "22222222-2222-2222-2222-222222222222" ' + '--status "Dismissed" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsList-Legacy +@try_manual +def step_dimension_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsList-Modern +@try_manual +def step_dimension_list2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListExpandAndTop-Legacy +@try_manual +def step_dimension_list3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListExpandAndTop-Modern +@try_manual +def step_dimension_list4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListWithFilter-Legacy +@try_manual +def step_dimension_list5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListWithFilter-Modern +@try_manual +def step_dimension_list6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingProfileDimensionsList-Modern +@try_manual +def step_dimension_list7(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingProfileDimensionsListExpandAndTop-Modern +@try_manual +def step_dimension_list8(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/BillingProfileDimensionsListWithFilter-Modern +@try_manual +def step_dimension_list9(test, rg, checks=None): + if checks is None: + checks = [] + 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=checks) + + +# EXAMPLE: /Dimensions/get/CustomerDimensionsList-Modern +@try_manual +def step_dimension_list10(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/CustomerDimensionsListExpandAndTop-Modern +@try_manual +def step_dimension_list11(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/CustomerDimensionsListWithFilter-Modern +@try_manual +def step_dimension_list12(test, rg, checks=None): + if checks is None: + checks = [] + 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=checks) + + +# EXAMPLE: /Dimensions/get/DepartmentDimensionsList-Legacy +@try_manual +def step_dimension_list13(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/DepartmentDimensionsListExpandAndTop-Legacy +@try_manual +def step_dimension_list14(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/DepartmentDimensionsListWithFilter-Legacy +@try_manual +def step_dimension_list15(test, rg, checks=None): + if checks is None: + checks = [] + 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=checks) + + +# EXAMPLE: /Dimensions/get/EnrollmentAccountDimensionsList-Legacy +@try_manual +def step_dimension_list16(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/EnrollmentAccountDimensionsListExpandAndTop-Legacy +@try_manual +def step_dimension_list17(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/EnrollmentAccountDimensionsListWithFilter-Legacy +@try_manual +def step_dimension_list18(test, rg, checks=None): + if checks is None: + checks = [] + 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=checks) + + +# EXAMPLE: /Dimensions/get/ExternalBillingAccountDimensionList +@try_manual +def step_dimension_by_external_cloud_provider_type(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/ExternalSubscriptionDimensionList +@try_manual +def step_dimension_by_external_cloud_provider_type2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/InvoiceSectionDimensionsList-Modern +@try_manual +def step_dimension_list19(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/InvoiceSectionDimensionsListExpandAndTop-Modern +@try_manual +def step_dimension_list20(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/InvoiceSectionDimensionsListWithFilter-Modern +@try_manual +def step_dimension_list21(test, rg, checks=None): + if checks is None: + checks = [] + 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=checks) + + +# EXAMPLE: /Dimensions/get/ManagementGroupDimensionsList-Legacy +@try_manual +def step_dimension_list22(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/ManagementGroupDimensionsListExpandAndTop-Legacy +@try_manual +def step_dimension_list23(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/ManagementGroupDimensionsListWithFilter-Legacy +@try_manual +def step_dimension_list24(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/ResourceGroupDimensionsList-Legacy +@try_manual +def step_dimension_list25(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando"', + checks=checks) + + +# EXAMPLE: /Dimensions/get/SubscriptionDimensionsList-Legacy +@try_manual +def step_dimension_list26(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Exports/put/BillingAccountCreateOrUpdateExport +@try_manual +def step_export_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--type "Usage" ' + '--aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" ' + 'columns="PreTaxCost" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--grouping name="SubscriptionName" type="Dimension" ' + '--grouping name="Environment" type="Tag" ' + '--timeframe "MonthToDate" ' + '--destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGroups/{rg}/provi' + 'ders/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--recurrence "Weekly" ' + '--recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=checks) + + +# EXAMPLE: /Exports/put/DepartmentCreateOrUpdateExport +@try_manual +def step_export_create2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--type "Usage" ' + '--aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" ' + 'columns="PreTaxCost" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--grouping name="SubscriptionName" type="Dimension" ' + '--grouping name="Environment" type="Tag" ' + '--timeframe "MonthToDate" ' + '--destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGroups/{rg}/provi' + 'ders/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--recurrence "Weekly" ' + '--recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=checks) + + +# EXAMPLE: /Exports/put/EnrollmentAccountCreateOrUpdateExport +@try_manual +def step_export_create3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--type "Usage" ' + '--aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" ' + 'columns="PreTaxCost" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--grouping name="SubscriptionName" type="Dimension" ' + '--grouping name="Environment" type="Tag" ' + '--timeframe "MonthToDate" ' + '--destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGroups/{rg}/provi' + 'ders/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--recurrence "Weekly" ' + '--recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Exports/put/ManagementGroupCreateOrUpdateExport +@try_manual +def step_export_create4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--type "Usage" ' + '--aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" ' + 'columns="PreTaxCost" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--grouping name="SubscriptionName" type="Dimension" ' + '--grouping name="Environment" type="Tag" ' + '--timeframe "MonthToDate" ' + '--destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGroups/{rg}/provi' + 'ders/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--recurrence "Weekly" ' + '--recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--status "Active" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=checks) + + +# EXAMPLE: /Exports/put/ResourceGroupCreateOrUpdateExport +@try_manual +def step_export_create5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--type "Usage" ' + '--aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" ' + 'columns="PreTaxCost" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--grouping name="SubscriptionName" type="Dimension" ' + '--grouping name="Environment" type="Tag" ' + '--timeframe "MonthToDate" ' + '--destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGroups/{rg}/provi' + 'ders/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--recurrence "Weekly" ' + '--recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--status "Active" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=checks) + + +# EXAMPLE: /Exports/put/SubscriptionCreateOrUpdateExport +@try_manual +def step_export_create6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--type "Usage" ' + '--aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--configuration columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" ' + 'columns="PreTaxCost" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--grouping name="SubscriptionName" type="Dimension" ' + '--grouping name="Environment" type="Tag" ' + '--timeframe "MonthToDate" ' + '--destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGroups/{rg}/provi' + 'ders/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--recurrence "Weekly" ' + '--recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--status "Active" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Exports/get/BillingAccountExecutionHistoryExport +@try_manual +def step_export_show_execution_history(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=checks) + + +# EXAMPLE: /Exports/get/BillingAccountExport +@try_manual +def step_export_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=checks) + + +# EXAMPLE: /Exports/get/BillingAccountExportList +@try_manual +def step_export_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=checks) + + +# EXAMPLE: /Exports/get/DepartmentExecutionHistoryExport +@try_manual +def step_export_show_execution_history2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=checks) + + +# EXAMPLE: /Exports/get/DepartmentExport +@try_manual +def step_export_show2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=checks) + + +# EXAMPLE: /Exports/get/DepartmentExportList +@try_manual +def step_export_list2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/123"', + checks=checks) + + +# EXAMPLE: /Exports/get/EnrollmentAccountExecutionHistoryExport +@try_manual +def step_export_show_execution_history3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Exports/get/EnrollmentAccountExport +@try_manual +def step_export_show3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Exports/get/EnrollmentAccountExportList +@try_manual +def step_export_list3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Exports/get/ManagementGroupExecutionHistoryExport +@try_manual +def step_export_show_execution_history4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=checks) + + +# EXAMPLE: /Exports/get/ManagementGroupExport +@try_manual +def step_export_show4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=checks) + + +# EXAMPLE: /Exports/get/ManagementGroupExportList +@try_manual +def step_export_list4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=checks) + + +# EXAMPLE: /Exports/get/ResourceGroupExecutionHistoryExport +@try_manual +def step_export_show_execution_history5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show-execution-history ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=checks) + + +# EXAMPLE: /Exports/get/ResourceGroupExport +@try_manual +def step_export_show5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=checks) + + +# EXAMPLE: /Exports/get/ResourceGroupExportList +@try_manual +def step_export_list5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=checks) + + +# EXAMPLE: /Exports/get/SubscriptionExecutionHistoryExport +@try_manual +def step_export_show_execution_history6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show-execution-history ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Exports/get/SubscriptionExport +@try_manual +def step_export_show6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Exports/get/SubscriptionExportList +@try_manual +def step_export_list6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Exports/post/BillingAccountExecuteExport +@try_manual +def step_export_execute(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=checks) + + +# EXAMPLE: /Exports/post/DepartmentExecuteExport +@try_manual +def step_export_execute2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=checks) + + +# EXAMPLE: /Exports/post/EnrollmentAccountExecuteExport +@try_manual +def step_export_execute3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Exports/post/ManagementGroupExecuteExport +@try_manual +def step_export_execute4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=checks) + + +# EXAMPLE: /Exports/post/ResourceGroupExecuteExport +@try_manual +def step_export_execute5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=checks) + + +# EXAMPLE: /Exports/post/SubscriptionExecuteExport +@try_manual +def step_export_execute6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Exports/delete/BillingAccountDeleteExport +@try_manual +def step_export_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=checks) + + +# EXAMPLE: /Exports/delete/DepartmentDeleteExport +@try_manual +def step_export_delete2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=checks) + + +# EXAMPLE: /Exports/delete/EnrollmentAccountDeleteExport +@try_manual +def step_export_delete3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Exports/delete/ManagementGroupDeleteExport +@try_manual +def step_export_delete4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=checks) + + +# EXAMPLE: /Exports/delete/ResourceGroupDeleteExport +@try_manual +def step_export_delete5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=checks) + + +# EXAMPLE: /Exports/delete/SubscriptionDeleteExport +@try_manual +def step_export_delete6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Forecast/post/BillingAccountForecast +@try_manual +def step_forecast_usage(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"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=checks) + + +# EXAMPLE: /Forecast/post/BillingProfileForecast +@try_manual +def step_forecast_usage2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"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=checks) + + +# EXAMPLE: /Forecast/post/DepartmentForecast +@try_manual +def step_forecast_usage3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"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=checks) + + +# EXAMPLE: /Forecast/post/EnrollmentAccountForecast +@try_manual +def step_forecast_usage4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"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=checks) + + +# EXAMPLE: /Forecast/post/ExternalBillingAccountForecast +@try_manual +def step_forecast_external_cloud_provider_usage(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast external-cloud-provider-usage ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts" ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":' + '\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=checks) + + +# EXAMPLE: /Forecast/post/ExternalSubscriptionForecast +@try_manual +def step_forecast_external_cloud_provider_usage2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast external-cloud-provider-usage ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions" ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":' + '\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=checks) + + +# EXAMPLE: /Forecast/post/InvoiceSectionForecast +@try_manual +def step_forecast_usage5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"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=checks) + + +# EXAMPLE: /Forecast/post/ResourceGroupForecast +@try_manual +def step_forecast_usage6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"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=checks) + + +# EXAMPLE: /Forecast/post/SubscriptionForecast +@try_manual +def step_forecast_usage7(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--query-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operat' + 'or\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"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=checks) + + +# EXAMPLE: /GenerateReservationDetailsReport/post/ReservationDetails +@try_manual +def step_generate_reservation_detail(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement generate-reservation-detail-report by-billing-account-id ' + '--billing-account-id "9845612" ' + '--end-date "2020-01-30" ' + '--start-date "2020-01-01"', + checks=checks) + + +# EXAMPLE: /Query/post/BillingAccountQuery-Legacy +@try_manual +def step_query_usage(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/70664866"', + checks=checks) + + +# EXAMPLE: /Query/post/BillingAccountQuery-Modern +@try_manual +def step_query_usage2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=checks) + + +# EXAMPLE: /Query/post/BillingAccountQueryGrouping-Legacy +@try_manual +def step_query_usage3(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/70664866"', + checks=checks) + + +# EXAMPLE: /Query/post/BillingAccountQueryGrouping-Modern +@try_manual +def step_query_usage4(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=checks) + + +# EXAMPLE: /Query/post/BillingProfileQuery-Modern +@try_manual +def step_query_usage5(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=checks) + + +# EXAMPLE: /Query/post/BillingProfileQueryGrouping-Modern +@try_manual +def step_query_usage6(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=checks) + + +# EXAMPLE: /Query/post/CustomerQuery-Modern +@try_manual +def step_query_usage7(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=checks) + + +# EXAMPLE: /Query/post/CustomerQueryGrouping-Modern +@try_manual +def step_query_usage8(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=checks) + + +# EXAMPLE: /Query/post/DepartmentQuery-Legacy +@try_manual +def step_query_usage9(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=checks) + + +# EXAMPLE: /Query/post/DepartmentQueryGrouping-Legacy +@try_manual +def step_query_usage10(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=checks) + + +# EXAMPLE: /Query/post/EnrollmentAccountQuery-Legacy +@try_manual +def step_query_usage11(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Query/post/EnrollmentAccountQueryGrouping-Legacy +@try_manual +def step_query_usage12(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=checks) + + +# EXAMPLE: /Query/post/ExternalBillingAccountQueryList +@try_manual +def step_query_usage_by_external_cloud_provider_type(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage-by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts" ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=checks) + + +# EXAMPLE: /Query/post/ExternalSubscriptionsQuery +@try_manual +def step_query_usage_by_external_cloud_provider_type2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage-by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions" ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=checks) + + +# EXAMPLE: /Query/post/InvoiceSectionQuery-Modern +@try_manual +def step_query_usage13(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=checks) + + +# EXAMPLE: /Query/post/InvoiceSectionQueryGrouping-Modern +@try_manual +def step_query_usage14(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=checks) + + +# EXAMPLE: /Query/post/ManagementGroupQuery-Legacy +@try_manual +def step_query_usage15(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=checks) + + +# EXAMPLE: /Query/post/ManagementGroupQueryGrouping-Legacy +@try_manual +def step_query_usage16(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=checks) + + +# EXAMPLE: /Query/post/ResourceGroupQuery-Legacy +@try_manual +def step_query_usage17(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=checks) + + +# EXAMPLE: /Query/post/ResourceGroupQueryGrouping-Legacy +@try_manual +def step_query_usage18(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceType" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=checks) + + +# EXAMPLE: /Query/post/SubscriptionQuery-Legacy +@try_manual +def step_query_usage19(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimensions\\":{{\\"name\\":\\"ResourceLocation\\",\\"operator\\":' + '\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tags\\":{{\\"name\\":\\"Environment\\",' + '\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimensions\\":{{\\"name\\":\\"Res' + 'ourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Query/post/SubscriptionQueryGrouping-Legacy +@try_manual +def step_query_usage20(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=checks) + + +# EXAMPLE: /Settings/put/CreateOrUpdateSetting +@try_manual +def step_setting_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement setting create ' + '--cache name="72f988bf-86f1-41af-91ab-2d7cd011db47" channel="Modern" id="/providers/Microsoft.Management/' + 'managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47" parent="/providers/Microsoft.Management/management' + 'Groups/acm" status="enabled" subchannel="NotApplicable" ' + '--scope "/subscriptions/{subscription_id}" ' + '--start-on "LastUsed" ' + '--name "{mySetting}"', + checks=checks) + + +# EXAMPLE: /Settings/get/SettingList +@try_manual +def step_setting_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement setting list', + checks=checks) + + +# EXAMPLE: /Settings/get/Settings +@try_manual +def step_setting_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement setting show ' + '--name "{mySetting}"', + checks=checks) + + +# EXAMPLE: /Settings/delete/DeleteSetting +@try_manual +def step_setting_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement setting delete -y ' + '--name "{mySetting2}"', + checks=checks) + + +# EXAMPLE: /Views/put/CreateOrUpdatePrivateView +@try_manual +def step_view_create(test, rg, checks=None): + if checks is None: + checks = [] + 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" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--granularity "Daily" ' + '--sorting name="UsageDate" direction="Ascending" ' + '--timeframe "MonthToDate" ' + '--name "{myView}"', + checks=checks) + + +# EXAMPLE: /Views/put/ResourceGroupCreateOrUpdateView +@try_manual +def step_view_create2(test, rg, checks=None): + if checks is None: + checks = [] + 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" ' + '--aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--granularity "Daily" ' + '--sorting name="UsageDate" direction="Ascending" ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--name "{myView}"', + checks=checks) + + +# EXAMPLE: /Views/get/PrivateView +@try_manual +def step_view_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement view show ' + '--name "{myView}"', + checks=checks) + + +# EXAMPLE: /Views/get/PrivateViewList +@try_manual +def step_view_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement view list', + checks=checks) + + +# EXAMPLE: /Views/get/ResourceGroupView +@try_manual +def step_view_show2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement view show ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--name "{myView}"', + checks=checks) + + +# EXAMPLE: /Views/get/ResourceGroupViewList +@try_manual +def step_view_list2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement view list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=checks) + + +# EXAMPLE: /Views/delete/DeletePrivateView +@try_manual +def step_view_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement view delete -y ' + '--name "{myView2}"', + checks=checks) + + +# EXAMPLE: /Views/delete/ResourceGroupDeleteView +@try_manual +def step_view_delete2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az costmanagement view delete -y ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--name "{myView2}"', + checks=checks) + diff --git a/src/costmanagement/azext_costmanagement/tests/latest/preparers.py b/src/costmanagement/azext_costmanagement/tests/latest/preparers.py deleted file mode 100644 index 3d6672de64f..00000000000 --- a/src/costmanagement/azext_costmanagement/tests/latest/preparers.py +++ /dev/null @@ -1,116 +0,0 @@ -# -------------------------------------------------------------------------- -# 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_export.py b/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_export.py deleted file mode 100644 index 65614e4cb2f..00000000000 --- a/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_export.py +++ /dev/null @@ -1,221 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -from azure.cli.testsdk import ScenarioTest -from azure.cli.testsdk import ResourceGroupPreparer, StorageAccountPreparer - - -class CostManagementExportTest(ScenarioTest): - """ - Those command results may be different every time after you run if running in live mode, - because of the cost is changing as we are creating and deleting resources under this subscription. - """ - - @ResourceGroupPreparer(name_prefix='test_export_create') - @StorageAccountPreparer(name_prefix='test_export_create'.replace('_', '')) - def test_export_create_in_subscription_scope(self, resource_group, storage_account): - self.kwargs.update({ - 'scope': '/subscriptions/{}'.format(self.get_subscription_id()), - }) - - export_name = 'ep-01' - storage_container = 'export' - timeframe = 'TheLastMonth' - storage_account_id = '/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/{account_name}'.format( - sub=self.get_subscription_id(), - rg=resource_group, - account_name=storage_account - ) - - self.kwargs.update({ - 'export_name': export_name, - 'storage_account_id': storage_account_id, - 'storage_container': storage_container, - 'timeframe': timeframe - }) - - creation_data = self.cmd('costmanagement export create ' - '--scope {scope} ' - '--name {export_name} ' - '--storage-account-id {storage_account_id} ' - '--storage-container {storage_container} ' - '--timeframe {timeframe} ').get_output_in_json() - self._test_export_create_in_subscription_scope_assertions(creation_data, - export_name, - storage_container, - storage_account_id, - timeframe) - - # show an export - show_data = self.cmd('costmanagement export show --scope {scope} --name {export_name}').get_output_in_json() - self._test_export_create_in_subscription_scope_assertions(show_data, - export_name, - storage_container, - storage_account_id, - timeframe) - - # list exports - list_data = self.cmd('costmanagement export list --scope {scope}').get_output_in_json() - self.assertEqual(len(list_data), 1) - self._test_export_create_in_subscription_scope_assertions(list_data[0], - export_name, - storage_container, - storage_account_id, - timeframe) - - self.cmd('costmanagement export delete -y --scope {scope} --name {export_name}') - - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('costmanagement export show --scope {scope} --name {export_name}') - - def _test_export_create_in_subscription_scope_assertions(self, data, export_name, storage_container, storage_account_id, timeframe): - self.assertEqual(data['name'], export_name) - self.assertIsNone(data['aggregation'], None) - self.assertIsNone(data['configuration'], None) - self.assertDictEqual(data['destination'], { - 'container': storage_container, - 'resourceId': storage_account_id, - 'rootFolderPath': None - }) - self.assertEqual(data['typePropertiesDefinitionType'], 'Usage') - self.assertIsNone(data['recurrence']) - self.assertIsNone(data['recurrencePeriod']) - self.assertEqual(data['status'], 'Inactive') - self.assertIsNone(data['timePeriod']) - self.assertEqual(data['timeframe'], timeframe) - - @ResourceGroupPreparer(name_prefix='test_export_schedule') - @StorageAccountPreparer(name_prefix='test_export_schedule'.replace('_', '')) - def test_export_create_with_schedule_in_subscription_scope(self, resource_group, storage_account): - self.kwargs.update({ - 'scope': '/subscriptions/{}'.format(self.get_subscription_id()), - }) - - export_name = 'ep-02' - storage_container = 'export' - timeframe = 'TheLastMonth' - storage_account_id = '/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/{account_name}'.format( - sub=self.get_subscription_id(), - rg=resource_group, - account_name=storage_account - ) - - self.kwargs.update({ - 'export_name': export_name, - 'storage_account_id': storage_account_id, - 'storage_container': storage_container, - 'timeframe': timeframe - }) - - creation_data = self.cmd('costmanagement export create ' - '--scope {scope} ' - '--name {export_name} ' - '--storage-account-id {storage_account_id} ' - '--storage-container {storage_container} ' - '--timeframe {timeframe} ' - '--recurrence "Weekly" ' - '--recurrence-period from="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" ' - '--schedule-status Active').get_output_in_json() - self._test_export_create_with_schedule_in_subscription_scope_assertions(creation_data, - export_name, - storage_container, - storage_account_id, - timeframe) - - # show an export - show_data = self.cmd('costmanagement export show --scope {scope} --name {export_name}').get_output_in_json() - self._test_export_create_with_schedule_in_subscription_scope_assertions(show_data, - export_name, - storage_container, - storage_account_id, - timeframe) - - # list exports - list_data = self.cmd('costmanagement export list --scope {scope}').get_output_in_json() - self.assertEqual(len(list_data), 1) - self._test_export_create_with_schedule_in_subscription_scope_assertions(list_data[0], - export_name, - storage_container, - storage_account_id, - timeframe) - - self.cmd('costmanagement export delete -y --scope {scope} --name {export_name}') - - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('costmanagement export show --scope {scope} --name {export_name}') - - def _test_export_create_with_schedule_in_subscription_scope_assertions(self, data, export_name, storage_container, storage_account_id, timeframe): - self.assertEqual(data['name'], export_name) - self.assertIsNone(data['aggregation'], None) - self.assertIsNone(data['configuration'], None) - self.assertDictEqual(data['destination'], { - 'container': storage_container, - 'resourceId': storage_account_id, - 'rootFolderPath': None - }) - self.assertEqual(data['typePropertiesDefinitionType'], 'Usage') # default is Usage - self.assertEqual(data['recurrence'], 'Weekly') - self.assertDictEqual(data['recurrencePeriod'], { - "fromProperty": "2020-06-01T00:00:00+00:00", - "to": "2020-10-31T00:00:00+00:00" - }) - self.assertEqual(data['status'], 'Active') - self.assertIsNone(data['timePeriod']) - self.assertEqual(data['timeframe'], timeframe) - - @ResourceGroupPreparer(name_prefix='test_update_schedule') - @StorageAccountPreparer(name_prefix='test_update_schedule'.replace('_', '')) - def test_update_with_timeperiod_in_subscription_scope(self, resource_group, storage_account): - self.kwargs.update({ - 'scope': '/subscriptions/{}'.format(self.get_subscription_id()), - }) - - export_name = 'ep-03' - storage_container = 'export' - timeframe = 'TheLastMonth' - storage_account_id = '/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/{account_name}'.format( - sub=self.get_subscription_id(), - rg=resource_group, - account_name=storage_account - ) - - self.kwargs.update({ - 'export_name': export_name, - 'storage_account_id': storage_account_id, - 'storage_container': storage_container, - 'timeframe': timeframe, - 'time_period': 'from="2020-08-01T00:00:00Z" to="2020-10-31T00:00:00Z"' - }) - - creation_data = self.cmd('costmanagement export create ' - '--scope {scope} ' - '--name {export_name} ' - '--storage-account-id {storage_account_id} ' - '--storage-container {storage_container} ' - '--timeframe {timeframe} ').get_output_in_json() - self._test_export_create_in_subscription_scope_assertions(creation_data, - export_name, - storage_container, - storage_account_id, - timeframe) - - timeframe = 'TheLastBillingMonth' - self.kwargs.update({ - 'timeframe': timeframe, - }) - - update_data = self.cmd('costmanagement export update ' - '--scope {scope} ' - '--name {export_name} ' - '--recurrence-period {time_period} ' - '--timeframe {timeframe} ').get_output_in_json() - self.assertEqual(update_data['timeframe'], timeframe) - self.assertDictEqual(update_data['recurrencePeriod'], { - "fromProperty": "2020-08-01T00:00:00+00:00", - "to": "2020-10-31T00:00:00+00:00" - }) - - self.cmd('costmanagement export delete -y --scope {scope} --name {export_name}') diff --git a/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_query.py b/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_query.py deleted file mode 100644 index c123331f3fb..00000000000 --- a/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_query.py +++ /dev/null @@ -1,139 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -from azure.cli.testsdk import ScenarioTest -from azure.cli.testsdk import ResourceGroupPreparer - - -class CostManagementQueryTest(ScenarioTest): - """ - Those command results may be different every time after you run if running in live mode, - because of the billing is changing as we are creating and deleting resources under this subscription. - """ - - @ResourceGroupPreparer(name_prefix='test_query_without_dataset_') - def test_cm_query_in_subscription_scope(self, resource_group): - - usage_types = ['ActualCost', 'AmortizedCost', 'Usage'] - timeframes = ['BillingMonthToDate', 'MonthToDate', 'TheLastBillingMonth', - 'TheLastMonth', 'WeekToDate'] - - for usage_type in usage_types: - for timeframe in timeframes: - self.kwargs.update({ - 'usgae_type': usage_type, - 'timeframe': timeframe, - 'scope': '/subscriptions/{}'.format(self.get_subscription_id()) - }) - - cost_data = self.cmd('costmanagement query --type {usgae_type} --timeframe {timeframe} --scope {scope}').get_output_in_json() - - self.assertEqual(cost_data['type'], 'Microsoft.CostManagement/query') - - # assert data columns, by default, there is no actual cost data but 2 columns "UsageDate" and "Currency" - self.assertEqual(len(cost_data['columns']), 2) - self.assertEqual(cost_data['columns'][0]['name'], 'UsageDate') - self.assertEqual(cost_data['columns'][0]['type'], 'Number') - self.assertEqual(cost_data['columns'][1]['name'], "Currency") - self.assertEqual(cost_data['columns'][1]['type'], 'String') - - @ResourceGroupPreparer(name_prefix='test_data_aggregation_in_subscription_scope') - def test_data_aggregation_in_subscription_scope(self, resource_group): - self.kwargs.update({ - 'scope': '/subscriptions/{}'.format(self.get_subscription_id()), - }) - - usage_type = 'ActualCost' - timeframe = 'TheLastMonth' - aggregation_expression = '\'{"totalCost": {"name": "PreTaxCost", "function": "Sum"}}\'' - - self.kwargs.update({ - 'usage_type': usage_type, - 'timeframe': timeframe, - 'aggregation_expression': aggregation_expression - }) - - cost_data = self.cmd('costmanagement query ' - '--type {usage_type} ' - '--timeframe {timeframe} ' - '--scope {scope} ' - '--dataset-aggregation {aggregation_expression}').get_output_in_json() - - self.assertEqual(cost_data['type'], 'Microsoft.CostManagement/query') - - self.assertEqual(len(cost_data['columns']), 3) - self.assertEqual(cost_data['columns'][0]['name'], 'PreTaxCost') - self.assertEqual(cost_data['columns'][0]['type'], 'Number') - - self.assertEqual(len(cost_data['rows']), 30) - - @ResourceGroupPreparer(name_prefix='test_cm_query_in_subscription_scope_custome_timeframe') - def test_data_aggregation_in_subscription_scope_custome_timeframe(self, resource_group): - self.kwargs.update({ - 'scope': '/subscriptions/{}'.format(self.get_subscription_id()), - }) - - timeframe = 'Custom' - aggregation_expression = '\'{"totalCost": {"name": "PreTaxCost", "function": "Sum"}}\'' - time_period = 'from=2020-03-01T00:00:00 to=2020-05-09T00:00:00 ' - - self.kwargs.update({ - 'usgae_type': 'ActualCost', - 'timeframe': timeframe, - 'time_period': time_period, - 'aggregation_expression': aggregation_expression - }) - - cost_data = self.cmd('costmanagement query ' - '--type {usgae_type} ' - '--timeframe {timeframe} ' - '--time-period {time_period} ' - '--scope {scope} ' - '--dataset-aggregation {aggregation_expression}').get_output_in_json() - - self.assertEqual(cost_data['type'], 'Microsoft.CostManagement/query') - - self.assertEqual(len(cost_data['columns']), 3) - self.assertEqual(cost_data['columns'][0]['name'], 'PreTaxCost') - self.assertEqual(cost_data['columns'][0]['type'], 'Number') - - self.assertEqual(len(cost_data['rows']), 70) - self.assertEqual(cost_data['rows'][0], [186.758302, 20200301, 'USD']) - - @ResourceGroupPreparer(name_prefix='test_data_filter_in_subscription_scopde') - def test_data_grouping_in_subscription_scopde(self, resource_group): - self.kwargs.update({ - 'scope': '/subscriptions/{}'.format(self.get_subscription_id()), - }) - - usage_type = 'ActualCost' - timeframe = 'TheLastMonth' - aggregation_expression = '\'{"totalCost": {"name": "PreTaxCost", "function": "Sum"}}\'' - dataset_grouping = 'name="ResourceGroup" type="Dimension"' - - self.kwargs.update({ - 'usage_type': usage_type, - 'timeframe': timeframe, - 'aggregation_expression': aggregation_expression, - 'dataset_grouping': dataset_grouping - }) - - cost_data = self.cmd('costmanagement query ' - '--type {usage_type} ' - '--timeframe {timeframe} ' - '--scope {scope} ' - '--dataset-aggregation {aggregation_expression} ' - '--dataset-grouping {dataset_grouping}').get_output_in_json() - - self.assertEqual(cost_data['type'], 'Microsoft.CostManagement/query') - - self.assertEqual(len(cost_data['columns']), 4) - self.assertEqual(cost_data['columns'][0]['name'], 'PreTaxCost') - self.assertEqual(cost_data['columns'][0]['type'], 'Number') - self.assertEqual(cost_data['columns'][2]['name'], 'ResourceGroup') - self.assertEqual(cost_data['columns'][2]['type'], 'String') - - self.assertEqual(len(cost_data['rows']), 1000) diff --git a/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py b/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py index cb6650d6d38..a6f797a7cdd 100644 --- a/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py +++ b/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py @@ -1,1363 +1,495 @@ -# -------------------------------------------------------------------------- -# 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: /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: /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/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/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/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/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: /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: /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: /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/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/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=[]) - - -# @try_manual -# def cleanup(test, rg): -# pass - - -# @try_manual -# def call_scenario(test, rg): -# setup(test, rg) -# step__exports_put_billingaccountcreateorupdateexport(test, rg) -# step__alerts_get_billingaccountalerts(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_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_managementgroupexecutionhistoryexport(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__alerts_get_billingprofilealerts(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__exports_delete_departmentdeleteexport(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_billingaccountdeleteexport(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({ -# 'TestExport': 'TestExport', -# }) - -# call_scenario(self, rg) +# -------------------------------------------------------------------------- +# 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 azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import ResourceGroupPreparer +from azure.cli.testsdk import StorageAccountPreparer +from .example_steps import step_alert_list +from .example_steps import step_alert_list2 +from .example_steps import step_alert_list3 +from .example_steps import step_alert_list4 +from .example_steps import step_alert_list_external +from .example_steps import step_alert_list_external2 +from .example_steps import step_alert_list5 +from .example_steps import step_alert_list6 +from .example_steps import step_alert_list7 +from .example_steps import step_alert_dismiss +from .example_steps import step_alert_dismiss2 +from .example_steps import step_dimension_list +from .example_steps import step_dimension_list2 +from .example_steps import step_dimension_list3 +from .example_steps import step_dimension_list4 +from .example_steps import step_dimension_list5 +from .example_steps import step_dimension_list6 +from .example_steps import step_dimension_list7 +from .example_steps import step_dimension_list8 +from .example_steps import step_dimension_list9 +from .example_steps import step_dimension_list10 +from .example_steps import step_dimension_list11 +from .example_steps import step_dimension_list12 +from .example_steps import step_dimension_list13 +from .example_steps import step_dimension_list14 +from .example_steps import step_dimension_list15 +from .example_steps import step_dimension_list16 +from .example_steps import step_dimension_list17 +from .example_steps import step_dimension_list18 +from .example_steps import step_dimension_by_external_cloud_provider_type +from .example_steps import step_dimension_by_external_cloud_provider_type2 +from .example_steps import step_dimension_list19 +from .example_steps import step_dimension_list20 +from .example_steps import step_dimension_list21 +from .example_steps import step_dimension_list22 +from .example_steps import step_dimension_list23 +from .example_steps import step_dimension_list24 +from .example_steps import step_dimension_list25 +from .example_steps import step_dimension_list26 +from .example_steps import step_export_create +from .example_steps import step_export_create2 +from .example_steps import step_export_create3 +from .example_steps import step_export_create4 +from .example_steps import step_export_create5 +from .example_steps import step_export_create6 +from .example_steps import step_export_show_execution_history +from .example_steps import step_export_show +from .example_steps import step_export_list +from .example_steps import step_export_show_execution_history2 +from .example_steps import step_export_show2 +from .example_steps import step_export_list2 +from .example_steps import step_export_show_execution_history3 +from .example_steps import step_export_show3 +from .example_steps import step_export_list3 +from .example_steps import step_export_show_execution_history4 +from .example_steps import step_export_show4 +from .example_steps import step_export_list4 +from .example_steps import step_export_show_execution_history5 +from .example_steps import step_export_show5 +from .example_steps import step_export_list5 +from .example_steps import step_export_show_execution_history6 +from .example_steps import step_export_show6 +from .example_steps import step_export_list6 +from .example_steps import step_export_execute +from .example_steps import step_export_execute2 +from .example_steps import step_export_execute3 +from .example_steps import step_export_execute4 +from .example_steps import step_export_execute5 +from .example_steps import step_export_execute6 +from .example_steps import step_export_delete +from .example_steps import step_export_delete2 +from .example_steps import step_export_delete3 +from .example_steps import step_export_delete4 +from .example_steps import step_export_delete5 +from .example_steps import step_export_delete6 +from .example_steps import step_forecast_usage +from .example_steps import step_forecast_usage2 +from .example_steps import step_forecast_usage3 +from .example_steps import step_forecast_usage4 +from .example_steps import step_forecast_external_cloud_provider_usage +from .example_steps import step_forecast_external_cloud_provider_usage2 +from .example_steps import step_forecast_usage5 +from .example_steps import step_forecast_usage6 +from .example_steps import step_forecast_usage7 +from .example_steps import step_generate_reservation_detail +from .example_steps import step_query_usage +from .example_steps import step_query_usage2 +from .example_steps import step_query_usage3 +from .example_steps import step_query_usage4 +from .example_steps import step_query_usage5 +from .example_steps import step_query_usage6 +from .example_steps import step_query_usage7 +from .example_steps import step_query_usage8 +from .example_steps import step_query_usage9 +from .example_steps import step_query_usage10 +from .example_steps import step_query_usage11 +from .example_steps import step_query_usage12 +from .example_steps import step_query_usage_by_external_cloud_provider_type +from .example_steps import step_query_usage_by_external_cloud_provider_type2 +from .example_steps import step_query_usage13 +from .example_steps import step_query_usage14 +from .example_steps import step_query_usage15 +from .example_steps import step_query_usage16 +from .example_steps import step_query_usage17 +from .example_steps import step_query_usage18 +from .example_steps import step_query_usage19 +from .example_steps import step_query_usage20 +from .example_steps import step_setting_create +from .example_steps import step_setting_list +from .example_steps import step_setting_show +from .example_steps import step_setting_delete +from .example_steps import step_view_create +from .example_steps import step_view_create2 +from .example_steps import step_view_show +from .example_steps import step_view_list +from .example_steps import step_view_show2 +from .example_steps import step_view_list2 +from .example_steps import step_view_delete +from .example_steps import step_view_delete2 +from .. import ( + try_manual, + raise_if, + calc_coverage +) + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +# Env setup_scenario +@try_manual +def setup_scenario(test, rg): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test, rg): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test, rg): + setup_scenario(test, rg) + step_alert_list(test, rg, checks=[]) + step_alert_list2(test, rg, checks=[]) + step_alert_list3(test, rg, checks=[]) + step_alert_list4(test, rg, checks=[]) + step_alert_list_external(test, rg, checks=[]) + step_alert_list_external2(test, rg, checks=[]) + step_alert_list5(test, rg, checks=[]) + step_alert_list6(test, rg, checks=[]) + step_alert_list6(test, rg, checks=[]) + step_alert_list7(test, rg, checks=[]) + step_alert_list7(test, rg, checks=[]) + step_alert_dismiss(test, rg, checks=[]) + step_alert_dismiss2(test, rg, checks=[]) + step_dimension_list(test, rg, checks=[]) + step_dimension_list2(test, rg, checks=[]) + step_dimension_list3(test, rg, checks=[]) + step_dimension_list4(test, rg, checks=[]) + step_dimension_list5(test, rg, checks=[]) + step_dimension_list6(test, rg, checks=[]) + step_dimension_list7(test, rg, checks=[]) + step_dimension_list8(test, rg, checks=[]) + step_dimension_list9(test, rg, checks=[]) + step_dimension_list10(test, rg, checks=[]) + step_dimension_list11(test, rg, checks=[]) + step_dimension_list12(test, rg, checks=[]) + step_dimension_list13(test, rg, checks=[]) + step_dimension_list14(test, rg, checks=[]) + step_dimension_list15(test, rg, checks=[]) + step_dimension_list16(test, rg, checks=[]) + step_dimension_list17(test, rg, checks=[]) + step_dimension_list18(test, rg, checks=[]) + step_dimension_by_external_cloud_provider_type(test, rg, checks=[]) + step_dimension_by_external_cloud_provider_type2(test, rg, checks=[]) + step_dimension_list19(test, rg, checks=[]) + step_dimension_list20(test, rg, checks=[]) + step_dimension_list21(test, rg, checks=[]) + step_dimension_list22(test, rg, checks=[]) + step_dimension_list23(test, rg, checks=[]) + step_dimension_list24(test, rg, checks=[]) + step_dimension_list25(test, rg, checks=[]) + step_dimension_list26(test, rg, checks=[]) + step_export_create(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.name", "PreTaxCost", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.function", "Sum", case_sensitive=False), + test.check("definition.timeframe", "MonthToDate", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + test.check("schedule.recurrence", "Weekly", case_sensitive=False), + test.check("schedule.recurrencePeriod.from", "2018-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2018-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + step_export_create2(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.name", "PreTaxCost", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.function", "Sum", case_sensitive=False), + test.check("definition.timeframe", "MonthToDate", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + test.check("schedule.recurrence", "Weekly", case_sensitive=False), + test.check("schedule.recurrencePeriod.from", "2018-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2018-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + step_export_create3(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.name", "PreTaxCost", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.function", "Sum", case_sensitive=False), + test.check("definition.timeframe", "MonthToDate", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + test.check("schedule.recurrence", "Weekly", case_sensitive=False), + test.check("schedule.recurrencePeriod.from", "2018-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2018-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + step_export_create4(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.name", "PreTaxCost", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.function", "Sum", case_sensitive=False), + test.check("definition.timeframe", "MonthToDate", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + test.check("schedule.recurrence", "Weekly", case_sensitive=False), + test.check("schedule.recurrencePeriod.from", "2018-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2018-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + step_export_create5(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.name", "PreTaxCost", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.function", "Sum", case_sensitive=False), + test.check("definition.timeframe", "MonthToDate", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + test.check("schedule.recurrence", "Weekly", case_sensitive=False), + test.check("schedule.recurrencePeriod.from", "2018-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2018-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + step_export_create6(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.name", "PreTaxCost", case_sensitive=False), + test.check("definition..dataSet.aggregation.costSum.function", "Sum", case_sensitive=False), + test.check("definition.timeframe", "MonthToDate", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + test.check("schedule.recurrence", "Weekly", case_sensitive=False), + test.check("schedule.recurrencePeriod.from", "2018-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2018-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + step_export_show_execution_history(test, rg, checks=[]) + step_export_show(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + step_export_list(test, rg, checks=[]) + step_export_show_execution_history2(test, rg, checks=[]) + step_export_show2(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + step_export_list2(test, rg, checks=[]) + step_export_show_execution_history3(test, rg, checks=[]) + step_export_show3(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + step_export_list3(test, rg, checks=[]) + step_export_show_execution_history4(test, rg, checks=[]) + step_export_show4(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + step_export_list4(test, rg, checks=[]) + step_export_show_execution_history5(test, rg, checks=[]) + step_export_show5(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + step_export_list5(test, rg, checks=[]) + step_export_show_execution_history6(test, rg, checks=[]) + step_export_show6(test, rg, checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "Usage", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/provide" + "rs/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + step_export_list6(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_export_execute(test, rg, checks=[]) + step_export_execute2(test, rg, checks=[]) + step_export_execute3(test, rg, checks=[]) + step_export_execute4(test, rg, checks=[]) + step_export_execute5(test, rg, checks=[]) + step_export_execute6(test, rg, checks=[]) + step_export_delete(test, rg, checks=[]) + step_export_delete2(test, rg, checks=[]) + step_export_delete3(test, rg, checks=[]) + step_export_delete4(test, rg, checks=[]) + step_export_delete5(test, rg, checks=[]) + step_export_delete6(test, rg, checks=[]) + step_forecast_usage(test, rg, checks=[]) + step_forecast_usage2(test, rg, checks=[]) + step_forecast_usage3(test, rg, checks=[]) + step_forecast_usage4(test, rg, checks=[]) + step_forecast_external_cloud_provider_usage(test, rg, checks=[]) + step_forecast_external_cloud_provider_usage2(test, rg, checks=[]) + step_forecast_usage5(test, rg, checks=[]) + step_forecast_usage6(test, rg, checks=[]) + step_forecast_usage7(test, rg, checks=[]) + step_generate_reservation_detail(test, rg, checks=[]) + step_generate_reservation_detail(test, rg, checks=[]) + step_query_usage(test, rg, checks=[]) + step_query_usage2(test, rg, checks=[]) + step_query_usage3(test, rg, checks=[]) + step_query_usage4(test, rg, checks=[]) + step_query_usage5(test, rg, checks=[]) + step_query_usage6(test, rg, checks=[]) + step_query_usage7(test, rg, checks=[]) + step_query_usage8(test, rg, checks=[]) + step_query_usage9(test, rg, checks=[]) + step_query_usage10(test, rg, checks=[]) + step_query_usage11(test, rg, checks=[]) + step_query_usage12(test, rg, checks=[]) + step_query_usage_by_external_cloud_provider_type(test, rg, checks=[]) + step_query_usage_by_external_cloud_provider_type2(test, rg, checks=[]) + step_query_usage13(test, rg, checks=[]) + step_query_usage14(test, rg, checks=[]) + step_query_usage15(test, rg, checks=[]) + step_query_usage16(test, rg, checks=[]) + step_query_usage17(test, rg, checks=[]) + step_query_usage18(test, rg, checks=[]) + step_query_usage19(test, rg, checks=[]) + step_query_usage20(test, rg, checks=[]) + step_setting_create(test, rg, checks=[ + test.check("scope", "/subscriptions/{subscription_id}", case_sensitive=False), + test.check("startOn", "LastUsed", case_sensitive=False), + test.check("name", "{mySetting}", case_sensitive=False), + ]) + step_setting_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_setting_show(test, rg, checks=[ + test.check("scope", "/subscriptions/{subscription_id}", case_sensitive=False), + test.check("startOn", "LastUsed", case_sensitive=False), + test.check("name", "{mySetting}", case_sensitive=False), + ]) + step_setting_delete(test, rg, checks=[]) + step_view_create(test, rg, checks=[ + test.check("accumulated", "true", case_sensitive=False), + test.check("chart", "Table", case_sensitive=False), + test.check("displayName", "swagger Example", case_sensitive=False), + test.check("metric", "ActualCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.name", "PreTaxCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.function", "Sum", case_sensitive=False), + test.check("query..dataSet.granularity", "Daily", case_sensitive=False), + test.check("query.timeframe", "MonthToDate", case_sensitive=False), + test.check("name", "{myView}", case_sensitive=False), + ]) + step_view_create2(test, rg, checks=[ + test.check("accumulated", "true", case_sensitive=False), + test.check("chart", "Table", case_sensitive=False), + test.check("displayName", "swagger Example", case_sensitive=False), + test.check("metric", "ActualCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.name", "PreTaxCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.function", "Sum", case_sensitive=False), + test.check("query..dataSet.granularity", "Daily", case_sensitive=False), + test.check("query.timeframe", "MonthToDate", case_sensitive=False), + test.check("name", "{myView}", case_sensitive=False), + ]) + step_view_show(test, rg, checks=[ + test.check("eTag", "\"1d4ff9fe66f1d10\"", case_sensitive=False), + test.check("accumulated", "true", case_sensitive=False), + test.check("chart", "Table", case_sensitive=False), + test.check("displayName", "swagger Example", case_sensitive=False), + test.check("metric", "ActualCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.name", "PreTaxCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.function", "Sum", case_sensitive=False), + test.check("query..dataSet.granularity", "Daily", case_sensitive=False), + test.check("query.timeframe", "MonthToDate", case_sensitive=False), + test.check("name", "{myView}", case_sensitive=False), + ]) + step_view_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_view_show2(test, rg, checks=[ + test.check("eTag", "\"1d4ff9fe66f1d10\"", case_sensitive=False), + test.check("accumulated", "true", case_sensitive=False), + test.check("chart", "Table", case_sensitive=False), + test.check("displayName", "swagger Example", case_sensitive=False), + test.check("metric", "ActualCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.name", "PreTaxCost", case_sensitive=False), + test.check("query..dataSet.aggregation.totalCost.function", "Sum", case_sensitive=False), + test.check("query..dataSet.granularity", "Daily", case_sensitive=False), + test.check("query.timeframe", "MonthToDate", case_sensitive=False), + test.check("name", "{myView}", case_sensitive=False), + ]) + step_view_list2(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_view_delete(test, rg, checks=[]) + step_view_delete2(test, rg, checks=[]) + cleanup_scenario(test, rg) + + +# Test class for Scenario +@try_manual +class CostmanagementScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(CostmanagementScenarioTest, self).__init__(*args, **kwargs) + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'mySetting': 'myscope', + 'mySetting2': 'TestSettings', + 'myView': 'swaggerExample', + 'myView2': 'TestView', + 'myExport': 'TestExport', + }) + + + @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_Scenario(self, rg): + call_scenario(self, rg) + calc_coverage(__file__) + raise_if() + diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py index ee0c4f36bd0..c9cfdc73e77 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py @@ -1,12 +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__) +# 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 index 80154bae521..ebf3b35fe49 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/__init__.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/__init__.py @@ -7,13 +7,10 @@ # -------------------------------------------------------------------------- from ._cost_management_client import CostManagementClient -from ._version import VERSION - -__version__ = VERSION __all__ = ['CostManagementClient'] try: - from .patch import patch_sdk + from ._patch import patch_sdk # type: ignore 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 index 8625677aaa9..9afffad9628 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_configuration.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_configuration.py @@ -10,8 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies - -from ._version import VERSION +from azure.mgmt.core.policies import ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -19,6 +18,7 @@ from azure.core.credentials import TokenCredential +VERSION = "unknown" class CostManagementClientConfiguration(Configuration): """Configuration for CostManagementClient. @@ -42,8 +42,8 @@ def __init__( 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.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'costmanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -55,6 +55,7 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**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) 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 index 0cdba0c257e..e1cb4fc948e 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_cost_management_client.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_cost_management_client.py @@ -15,37 +15,46 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional + from azure.core.credentials import TokenCredential + from ._configuration import CostManagementClientConfiguration -from .operations import ViewOperations -from .operations import AlertOperations +from .operations import SettingsOperations +from .operations import ViewsOperations +from .operations import AlertsOperations from .operations import ForecastOperations -from .operations import DimensionOperations +from .operations import DimensionsOperations from .operations import QueryOperations -from .operations import ExportOperations -from .operations import OperationOperations +from .operations import GenerateReservationDetailsReportOperations +from .operations import Operations +from .operations import ExportsOperations 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 settings: SettingsOperations operations + :vartype settings: cost_management_client.operations.SettingsOperations + :ivar views: ViewsOperations operations + :vartype views: cost_management_client.operations.ViewsOperations + :ivar alerts: AlertsOperations operations + :vartype alerts: cost_management_client.operations.AlertsOperations :ivar forecast: ForecastOperations operations - :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations - :ivar dimension: DimensionOperations operations - :vartype dimension: azure.mgmt.costmanagement.operations.DimensionOperations + :vartype forecast: cost_management_client.operations.ForecastOperations + :ivar dimensions: DimensionsOperations operations + :vartype dimensions: cost_management_client.operations.DimensionsOperations :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 + :vartype query: cost_management_client.operations.QueryOperations + :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations operations + :vartype generate_reservation_details_report: cost_management_client.operations.GenerateReservationDetailsReportOperations + :ivar operations: Operations operations + :vartype operations: cost_management_client.operations.Operations + :ivar exports: ExportsOperations operations + :vartype exports: cost_management_client.operations.ExportsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -64,19 +73,23 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.view = ViewOperations( + self.settings = SettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.views = ViewsOperations( self._client, self._config, self._serialize, self._deserialize) - self.alert = AlertOperations( + self.alerts = AlertsOperations( self._client, self._config, self._serialize, self._deserialize) self.forecast = ForecastOperations( self._client, self._config, self._serialize, self._deserialize) - self.dimension = DimensionOperations( + self.dimensions = DimensionsOperations( self._client, self._config, self._serialize, self._deserialize) self.query = QueryOperations( self._client, self._config, self._serialize, self._deserialize) - self.export = ExportOperations( + self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( + self.exports = ExportsOperations( self._client, self._config, self._serialize, self._deserialize) def close(self): diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_version.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_version.py deleted file mode 100644 index dbf4c577231..00000000000 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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 index 5e5f35e29c0..7dec206f98a 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/__init__.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._cost_management_client_async import CostManagementClient +from ._cost_management_client 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.py similarity index 84% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration.py index 15d87f41cbf..d1bc15d3008 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration.py @@ -10,13 +10,13 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies - -from .._version import VERSION +from azure.mgmt.core.policies import ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential + from azure.core.credentials_async import AsyncTokenCredential +VERSION = "unknown" class CostManagementClientConfiguration(Configuration): """Configuration for CostManagementClient. @@ -39,8 +39,8 @@ def __init__( 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.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'costmanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -51,6 +51,7 @@ def _configure( 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.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**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) 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.py similarity index 50% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_cost_management_client_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_cost_management_client.py index 0f81334bb70..08837363759 100644 --- 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.py @@ -6,42 +6,53 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import CostManagementClientConfiguration +from .operations import SettingsOperations +from .operations import ViewsOperations +from .operations import AlertsOperations +from .operations import ForecastOperations +from .operations import DimensionsOperations +from .operations import QueryOperations +from .operations import GenerateReservationDetailsReportOperations +from .operations import Operations +from .operations import ExportsOperations from .. import models 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 settings: SettingsOperations operations + :vartype settings: cost_management_client.aio.operations.SettingsOperations + :ivar views: ViewsOperations operations + :vartype views: cost_management_client.aio.operations.ViewsOperations + :ivar alerts: AlertsOperations operations + :vartype alerts: cost_management_client.aio.operations.AlertsOperations :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 + :vartype forecast: cost_management_client.aio.operations.ForecastOperations + :ivar dimensions: DimensionsOperations operations + :vartype dimensions: cost_management_client.aio.operations.DimensionsOperations :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 + :vartype query: cost_management_client.aio.operations.QueryOperations + :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations operations + :vartype generate_reservation_details_report: cost_management_client.aio.operations.GenerateReservationDetailsReportOperations + :ivar operations: Operations operations + :vartype operations: cost_management_client.aio.operations.Operations + :ivar exports: ExportsOperations operations + :vartype exports: cost_management_client.aio.operations.ExportsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -59,19 +70,23 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.view = ViewOperations( + self.settings = SettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.views = ViewsOperations( self._client, self._config, self._serialize, self._deserialize) - self.alert = AlertOperations( + self.alerts = AlertsOperations( self._client, self._config, self._serialize, self._deserialize) self.forecast = ForecastOperations( self._client, self._config, self._serialize, self._deserialize) - self.dimension = DimensionOperations( + self.dimensions = DimensionsOperations( self._client, self._config, self._serialize, self._deserialize) self.query = QueryOperations( self._client, self._config, self._serialize, self._deserialize) - self.export = ExportOperations( + self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( + self.exports = ExportsOperations( self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/__init__.py new file mode 100644 index 00000000000..c70a4cb564c --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/__init__.py @@ -0,0 +1,29 @@ +# 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 ._settings_operations import SettingsOperations +from ._views_operations import ViewsOperations +from ._alerts_operations import AlertsOperations +from ._forecast_operations import ForecastOperations +from ._dimensions_operations import DimensionsOperations +from ._query_operations import QueryOperations +from ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations +from ._operations import Operations +from ._exports_operations import ExportsOperations + +__all__ = [ + 'SettingsOperations', + 'ViewsOperations', + 'AlertsOperations', + 'ForecastOperations', + 'DimensionsOperations', + 'QueryOperations', + 'GenerateReservationDetailsReportOperations', + 'Operations', + 'ExportsOperations', +] diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_alerts_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_alerts_operations.py new file mode 100644 index 00000000000..47ad31d7a58 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_alerts_operations.py @@ -0,0 +1,325 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AlertsOperations: + """AlertsOperations 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: ~cost_management_client.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: ~cost_management_client.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(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'} # type: ignore + + async def get( + self, + scope: str, + alert_id: str, + **kwargs + ) -> "models.Alert": + """Gets the alert for the scope by alert ID. + + :param scope: The scope associated with alerts operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param alert_id: Alert ID. + :type alert_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Alert, or the result of cls(response) + :rtype: ~cost_management_client.models.Alert + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Alert"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Alert', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} # type: ignore + + async def dismiss( + self, + scope: str, + alert_id: str, + parameters: "models.DismissAlertPayload", + **kwargs + ) -> "models.Alert": + """Dismisses the specified alert. + + :param scope: The scope associated with alerts operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param alert_id: Alert ID. + :type alert_id: str + :param parameters: Parameters supplied to the Dismiss Alert operation. + :type parameters: ~cost_management_client.models.DismissAlertPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Alert, or the result of cls(response) + :rtype: ~cost_management_client.models.Alert + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Alert"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.dismiss.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DismissAlertPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(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('Alert', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + dismiss.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} # type: ignore + + 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 ~cost_management_client.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: ~cost_management_client.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.list_external.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(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'} # type: ignore 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/_dimensions_operations.py similarity index 56% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_dimension_operations_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_dimensions_operations.py index 9e7580d0894..6a002505df4 100644 --- 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/_dimensions_operations.py @@ -5,11 +5,11 @@ # 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 +from typing import Any, AsyncIterable, 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.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,14 +19,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DimensionOperations: - """DimensionOperations async operations. +class DimensionsOperations: + """DimensionsOperations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,76 +49,80 @@ def list( skiptoken: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> "models.DimensionsListResult": + ) -> AsyncIterable["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. + '/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'. + 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. + 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. + 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 + :return: An iterator like instance of either DimensionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~cost_management_client.models.DimensionsListResultor None] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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) + + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -134,7 +138,7 @@ async def get_next(next_link=None): pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: 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) @@ -144,7 +148,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/dimensions'} + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/dimensions'} # type: ignore def by_external_cloud_provider_type( self, @@ -155,67 +159,71 @@ def by_external_cloud_provider_type( skiptoken: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> "models.DimensionsListResult": + ) -> AsyncIterable["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 + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~cost_management_client.models.ExternalCloudProviderType :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or - '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + '{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'. + 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. + 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. + 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 + :return: An iterator like instance of either DimensionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.by_external_cloud_provider_type.metadata['url'] + url = self.by_external_cloud_provider_type.metadata['url'] # type: ignore 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') + 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) + + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -241,4 +249,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} + by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} # type: ignore 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/_exports_operations.py similarity index 75% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_export_operations_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_exports_operations.py index 4d14c7ab9a2..22bf4853478 100644 --- 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/_exports_operations.py @@ -5,10 +5,10 @@ # 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 +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.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -18,14 +18,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ExportOperations: - """ExportOperations async operations. +class ExportsOperations: + """ExportsOperations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -65,16 +65,20 @@ async def list( 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 + :return: ExportListResult, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } @@ -86,9 +90,8 @@ async def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -101,10 +104,10 @@ async def list( deserialized = self._deserialize('ExportListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} # type: ignore async def get( self, @@ -134,16 +137,20 @@ async def get( :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 + :return: Export, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -156,9 +163,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -171,30 +177,21 @@ async def get( deserialized = self._deserialize('Export', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} # type: ignore async def create_or_update( self, scope: str, export_name: str, - e_tag: Optional[str] = None, - 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, + parameters: "models.Export", **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. + """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, @@ -215,52 +212,24 @@ async def create_or_update( :type scope: str :param export_name: Export Name. :type export_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 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 + :param parameters: Parameters supplied to the CreateOrUpdate Export operation. + :type parameters: ~cost_management_client.models.Export :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 + :return: Export, or the result of cls(response) + :rtype: ~cost_management_client.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(e_tag=e_tag, 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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -274,14 +243,12 @@ async def create_or_update( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'Export') + 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 @@ -290,7 +257,6 @@ async def create_or_update( 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) @@ -298,10 +264,10 @@ async def create_or_update( deserialized = self._deserialize('Export', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} # type: ignore async def delete( self, @@ -331,16 +297,20 @@ async def delete( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -353,8 +323,8 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -365,9 +335,9 @@ async def delete( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + delete.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} # type: ignore async def execute( self, @@ -397,16 +367,20 @@ async def execute( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.execute.metadata['url'] + url = self.execute.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -419,8 +393,8 @@ async def execute( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -431,9 +405,9 @@ async def execute( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - execute.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run'} + execute.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run'} # type: ignore async def get_execution_history( self, @@ -463,16 +437,20 @@ async def get_execution_history( :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 + :return: ExportExecutionListResult, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get_execution_history.metadata['url'] + url = self.get_execution_history.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -485,9 +463,8 @@ async def get_execution_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -500,7 +477,7 @@ async def get_execution_history( deserialized = self._deserialize('ExportExecutionListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_history.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory'} + get_execution_history.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory'} # type: ignore 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/_forecast_operations.py similarity index 55% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_forecast_operations_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_forecast_operations.py index 50b4a7cf64c..11f7f7f97cf 100644 --- 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/_forecast_operations.py @@ -5,10 +5,10 @@ # 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 +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.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -25,7 +25,7 @@ class ForecastOperations: 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -43,18 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def usage( self, scope: str, - type: Union[str, "models.ForecastType"], - timeframe: Union[str, "models.ForecastTimeframeType"], + parameters: "models.ForecastDefinition", 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": + ) -> Optional["models.QueryResult"]: """Lists the forecast charges for scope defined. :param scope: The scope associated with forecast operations. This includes @@ -74,47 +66,28 @@ async def usage( '/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 parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. + :type parameters: ~cost_management_client.models.ForecastDefinition :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str - :param 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 + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.models.QueryResult or None :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) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.QueryResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.usage.metadata['url'] + url = self.usage.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } @@ -129,44 +102,36 @@ async def usage( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ForecastDefinition') + 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]: + 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) - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} # type: ignore 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"], + parameters: "models.ForecastDefinition", 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. @@ -174,51 +139,32 @@ async def external_cloud_provider_usage( :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 + :type external_cloud_provider_type: str or ~cost_management_client.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 parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. + :type parameters: ~cost_management_client.models.ForecastDefinition :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str - :param 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 + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.external_cloud_provider_usage.metadata['url'] + url = self.external_cloud_provider_usage.metadata['url'] # type: ignore 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'), @@ -234,14 +180,12 @@ async def external_cloud_provider_usage( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ForecastDefinition') + 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 @@ -253,7 +197,7 @@ async def external_cloud_provider_usage( deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} + external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_generate_reservation_details_report_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_generate_reservation_details_report_operations.py new file mode 100644 index 00000000000..4910a72c8b0 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_generate_reservation_details_report_operations.py @@ -0,0 +1,302 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GenerateReservationDetailsReportOperations: + """GenerateReservationDetailsReportOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~cost_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _by_billing_account_id_initial( + self, + billing_account_id: str, + start_date: str, + end_date: str, + **kwargs + ) -> Optional["models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self._by_billing_account_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _by_billing_account_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore + + async def begin_by_billing_account_id( + self, + billing_account_id: str, + start_date: str, + end_date: str, + **kwargs + ) -> AsyncLROPoller["models.OperationStatus"]: + """Generates the reservations details report for provided date range asynchronously based on + enrollment id. + + :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). + :type billing_account_id: str + :param start_date: Start Date. + :type start_date: str + :param end_date: End Date. + :type end_date: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~cost_management_client.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._by_billing_account_id_initial( + billing_account_id=billing_account_id, + start_date=start_date, + end_date=end_date, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_by_billing_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore + + async def _by_billing_profile_id_initial( + self, + billing_account_id: str, + billing_profile_id: str, + start_date: str, + end_date: str, + **kwargs + ) -> Optional["models.OperationStatus"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self._by_billing_profile_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _by_billing_profile_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore + + async def begin_by_billing_profile_id( + self, + billing_account_id: str, + billing_profile_id: str, + start_date: str, + end_date: str, + **kwargs + ) -> AsyncLROPoller["models.OperationStatus"]: + """Generates the reservations details report for provided date range asynchronously by billing + profile. + + :param billing_account_id: BillingAccount ID. + :type billing_account_id: str + :param billing_profile_id: BillingProfile ID. + :type billing_profile_id: str + :param start_date: Start Date. + :type start_date: str + :param end_date: End Date. + :type end_date: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~cost_management_client.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._by_billing_profile_id_initial( + billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + start_date=start_date, + end_date=end_date, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_by_billing_profile_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_operation_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_operations.py similarity index 69% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_operation_operations_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_operations.py index 3100d06cf5b..2e8656ce5e2 100644 --- 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/_operations.py @@ -5,11 +5,11 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,14 +19,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations: - """OperationOperations async operations. +class Operations: + """Operations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,35 +44,39 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> "models.OperationListResult": + ) -> AsyncIterable["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 + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -98,4 +102,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.CostManagement/operations'} + list.metadata = {'url': '/providers/Microsoft.CostManagement/operations'} # type: ignore 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/_query_operations.py similarity index 60% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_alert_operations_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_query_operations.py index db9ca7b4425..3e3752b5d52 100644 --- 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/_query_operations.py @@ -8,7 +8,7 @@ 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.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -18,14 +18,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AlertOperations: - """AlertOperations async operations. +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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,14 +40,15 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def list( + async def usage( self, scope: str, + parameters: "models.QueryDefinition", **kwargs - ) -> "models.AlertsResult": - """Lists the alerts for scope defined. + ) -> Optional["models.QueryResult"]: + """Query the usage data for scope defined. - :param scope: The scope associated with alerts operations. This includes + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and @@ -64,17 +65,24 @@ async def list( '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. :type scope: str + :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. + :type parameters: ~cost_management_client.models.QueryDefinition :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 + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.models.QueryResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.QueryResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.list.metadata['url'] + url = self.usage.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } @@ -86,52 +94,65 @@ async def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + 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]: + 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) - deserialized = self._deserialize('AlertsResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts'} + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/query'} # type: ignore - async def list_external( + async def usage_by_external_cloud_provider_type( self, external_cloud_provider_type: Union[str, "models.ExternalCloudProviderType"], external_cloud_provider_id: str, + parameters: "models.QueryDefinition", **kwargs - ) -> "models.AlertsResult": - """Lists the Alerts for external cloud provider type defined. + ) -> "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 + :type external_cloud_provider_type: str or ~cost_management_client.models.ExternalCloudProviderType :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. :type external_cloud_provider_id: str + :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. + :type parameters: ~cost_management_client.models.QueryDefinition :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 + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.models.QueryResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.list_external.metadata['url'] + url = self.usage_by_external_cloud_provider_type.metadata['url'] # type: ignore 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'), @@ -144,10 +165,13 @@ async def list_external( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + 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 @@ -156,10 +180,10 @@ async def list_external( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AlertsResult', pipeline_response) + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_external.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts'} + usage_by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_settings_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_settings_operations.py new file mode 100644 index 00000000000..c19d6a79ec7 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_settings_operations.py @@ -0,0 +1,273 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SettingsOperations: + """SettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~cost_management_client.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 + ) -> AsyncIterable["models.SettingsListResult"]: + """Lists all of the settings that have been customized. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SettingsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~cost_management_client.models.SettingsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SettingsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SettingsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.CostManagement/settings'} # type: ignore + + async def get( + self, + setting_name: str, + **kwargs + ) -> "models.Setting": + """Retrieves the current value for a specific setting. + + :param setting_name: Name of the setting. Allowed values: myscope. + :type setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Setting, or the result of cls(response) + :rtype: ~cost_management_client.models.Setting + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Setting"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Setting', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore + + async def create_or_update( + self, + setting_name: str, + parameters: "models.Setting", + **kwargs + ) -> "models.Setting": + """Sets a new value for a specific setting. + + :param setting_name: Name of the setting. Allowed values: myscope. + :type setting_name: str + :param parameters: Body supplied to the CreateOrUpdate setting operation. + :type parameters: ~cost_management_client.models.Setting + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Setting, or the result of cls(response) + :rtype: ~cost_management_client.models.Setting + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Setting"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Setting') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Setting', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore + + async def delete( + self, + setting_name: str, + **kwargs + ) -> None: + """Remove the current value for a specific setting and reverts back to the default value, if + applicable. + + :param setting_name: Name of the setting. Allowed values: myscope. + :type setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_view_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_views_operations.py similarity index 62% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_view_operations_async.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations/_views_operations.py index c606c6c32da..90a41b753b1 100644 --- 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/_views_operations.py @@ -5,11 +5,11 @@ # 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 +from typing import Any, AsyncIterable, 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.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,14 +19,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ViewOperations: - """ViewOperations async operations. +class ViewsOperations: + """ViewsOperations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,35 +44,39 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> "models.ViewListResult": + ) -> AsyncIterable["models.ViewListResult"]: """Lists all views by tenant and object. :keyword callable cls: A custom type or function that will be passed the direct response - :return: ViewListResult or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.ViewListResult + :return: An iterator like instance of either ViewListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~cost_management_client.models.ViewListResultor None] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -88,7 +92,7 @@ async def get_next(next_link=None): pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: 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) @@ -98,63 +102,67 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.CostManagement/views'} + list.metadata = {'url': '/providers/Microsoft.CostManagement/views'} # type: ignore def list_by_scope( self, scope: str, **kwargs - ) -> "models.ViewListResult": + ) -> AsyncIterable["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. + '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 + :return: An iterator like instance of either ViewListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~cost_management_client.models.ViewListResultor None] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_scope.metadata['url'] + url = self.list_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, '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') + + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -170,7 +178,7 @@ async def get_next(next_link=None): pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: 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) @@ -180,7 +188,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} + list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} # type: ignore async def get( self, @@ -192,16 +200,20 @@ async def get( :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'viewName': self._serialize.url("view_name", view_name, 'str'), } @@ -213,9 +225,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -228,85 +239,41 @@ async def get( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore 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, + parameters: "models.View", **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. + """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 + :param parameters: Parameters supplied to the CreateOrUpdate View operation. + :type parameters: ~cost_management_client.models.View :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'viewName': self._serialize.url("view_name", view_name, 'str'), } @@ -319,14 +286,12 @@ async def create_or_update( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'View') + 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 @@ -335,7 +300,6 @@ async def create_or_update( 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) @@ -343,10 +307,10 @@ async def create_or_update( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore async def delete( self, @@ -358,16 +322,20 @@ async def delete( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'viewName': self._serialize.url("view_name", view_name, 'str'), } @@ -379,8 +347,8 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -391,9 +359,9 @@ async def delete( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + delete.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore async def get_by_scope( self, @@ -424,16 +392,20 @@ async def get_by_scope( :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get_by_scope.metadata['url'] + url = self.get_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str'), 'viewName': self._serialize.url("view_name", view_name, 'str'), @@ -446,9 +418,8 @@ async def get_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -461,29 +432,21 @@ async def get_by_scope( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore 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, + parameters: "models.View", **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. + """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, @@ -505,60 +468,24 @@ async def create_or_update_by_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 + :param parameters: Parameters supplied to the CreateOrUpdate View operation. + :type parameters: ~cost_management_client.models.View :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update_by_scope.metadata['url'] + url = self.create_or_update_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str'), 'viewName': self._serialize.url("view_name", view_name, 'str'), @@ -572,14 +499,12 @@ async def create_or_update_by_scope( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'View') + 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 @@ -588,7 +513,6 @@ async def create_or_update_by_scope( 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) @@ -596,10 +520,10 @@ async def create_or_update_by_scope( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore async def delete_by_scope( self, @@ -630,16 +554,20 @@ async def delete_by_scope( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.delete_by_scope.metadata['url'] + url = self.delete_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str'), 'viewName': self._serialize.url("view_name", view_name, 'str'), @@ -652,8 +580,8 @@ async def delete_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -664,6 +592,6 @@ async def delete_by_scope( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore 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 deleted file mode 100644 index e2738b1b3eb..00000000000 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._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/_query_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_query_operations_async.py deleted file mode 100644 index 994fc5fa69f..00000000000 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_query_operations_async.py +++ /dev/null @@ -1,233 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, 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/models/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py index 86b6667b5a5..66933e43c0f 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py @@ -11,31 +11,41 @@ from ._models_py3 import AlertPropertiesDefinition from ._models_py3 import AlertPropertiesDetails from ._models_py3 import AlertsResult + from ._models_py3 import CacheItem from ._models_py3 import CommonExportProperties from ._models_py3 import Dimension from ._models_py3 import DimensionsListResult + from ._models_py3 import DismissAlertPayload from ._models_py3 import ErrorDetails from ._models_py3 import ErrorResponse from ._models_py3 import Export + from ._models_py3 import ExportDefinition from ._models_py3 import ExportDeliveryDestination + from ._models_py3 import ExportDeliveryInfo 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 ExportSchedule from ._models_py3 import ForecastDefinition from ._models_py3 import KpiProperties from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult + from ._models_py3 import OperationStatus from ._models_py3 import PivotProperties from ._models_py3 import ProxyResource + from ._models_py3 import ProxySettingResource from ._models_py3 import QueryAggregation from ._models_py3 import QueryColumn from ._models_py3 import QueryComparisonExpression + from ._models_py3 import QueryDataset from ._models_py3 import QueryDatasetConfiguration + from ._models_py3 import QueryDatasetautogenerated from ._models_py3 import QueryDefinition from ._models_py3 import QueryFilter + from ._models_py3 import QueryFilterautogenerated from ._models_py3 import QueryGrouping from ._models_py3 import QueryResult from ._models_py3 import QueryTimePeriod @@ -48,6 +58,9 @@ from ._models_py3 import ReportConfigSorting from ._models_py3 import ReportConfigTimePeriod from ._models_py3 import Resource + from ._models_py3 import Setting + from ._models_py3 import SettingsListResult + from ._models_py3 import Status from ._models_py3 import View from ._models_py3 import ViewListResult except (SyntaxError, ImportError): @@ -55,31 +68,41 @@ from ._models import AlertPropertiesDefinition # type: ignore from ._models import AlertPropertiesDetails # type: ignore from ._models import AlertsResult # type: ignore + from ._models import CacheItem # type: ignore from ._models import CommonExportProperties # type: ignore from ._models import Dimension # type: ignore from ._models import DimensionsListResult # type: ignore + from ._models import DismissAlertPayload # type: ignore from ._models import ErrorDetails # type: ignore from ._models import ErrorResponse # type: ignore from ._models import Export # type: ignore + from ._models import ExportDefinition # type: ignore from ._models import ExportDeliveryDestination # type: ignore + from ._models import ExportDeliveryInfo # 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 ExportSchedule # type: ignore from ._models import ForecastDefinition # type: ignore from ._models import KpiProperties # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore + from ._models import OperationStatus # type: ignore from ._models import PivotProperties # type: ignore from ._models import ProxyResource # type: ignore + from ._models import ProxySettingResource # type: ignore from ._models import QueryAggregation # type: ignore from ._models import QueryColumn # type: ignore from ._models import QueryComparisonExpression # type: ignore + from ._models import QueryDataset # type: ignore from ._models import QueryDatasetConfiguration # type: ignore + from ._models import QueryDatasetautogenerated # type: ignore from ._models import QueryDefinition # type: ignore from ._models import QueryFilter # type: ignore + from ._models import QueryFilterautogenerated # type: ignore from ._models import QueryGrouping # type: ignore from ._models import QueryResult # type: ignore from ._models import QueryTimePeriod # type: ignore @@ -92,11 +115,21 @@ from ._models import ReportConfigSorting # type: ignore from ._models import ReportConfigTimePeriod # type: ignore from ._models import Resource # type: ignore + from ._models import Setting # type: ignore + from ._models import SettingsListResult # type: ignore + from ._models import Status # type: ignore from ._models import View # type: ignore from ._models import ViewListResult # type: ignore from ._cost_management_client_enums import ( AccumulatedType, + AlertCategory, + AlertCriteria, + AlertOperator, + AlertSource, + AlertStatus, + AlertTimeGrainType, + AlertType, ChartType, ExecutionStatus, ExecutionType, @@ -104,8 +137,12 @@ ExternalCloudProviderType, ForecastTimeframeType, ForecastType, + FormatType, + FunctionType, + GranularityType, KpiType, MetricType, + OperationStatusType, OperatorType, PivotType, QueryColumnType, @@ -114,6 +151,8 @@ ReportConfigSortingDirection, ReportGranularityType, ReportTimeframeType, + ReportType, + SettingsPropertiesStartOn, StatusType, TimeframeType, ) @@ -123,31 +162,41 @@ 'AlertPropertiesDefinition', 'AlertPropertiesDetails', 'AlertsResult', + 'CacheItem', 'CommonExportProperties', 'Dimension', 'DimensionsListResult', + 'DismissAlertPayload', 'ErrorDetails', 'ErrorResponse', 'Export', + 'ExportDefinition', 'ExportDeliveryDestination', + 'ExportDeliveryInfo', 'ExportExecution', 'ExportExecutionListResult', 'ExportListResult', 'ExportProperties', 'ExportRecurrencePeriod', + 'ExportSchedule', 'ForecastDefinition', 'KpiProperties', 'Operation', 'OperationDisplay', 'OperationListResult', + 'OperationStatus', 'PivotProperties', 'ProxyResource', + 'ProxySettingResource', 'QueryAggregation', 'QueryColumn', 'QueryComparisonExpression', + 'QueryDataset', 'QueryDatasetConfiguration', + 'QueryDatasetautogenerated', 'QueryDefinition', 'QueryFilter', + 'QueryFilterautogenerated', 'QueryGrouping', 'QueryResult', 'QueryTimePeriod', @@ -160,9 +209,19 @@ 'ReportConfigSorting', 'ReportConfigTimePeriod', 'Resource', + 'Setting', + 'SettingsListResult', + 'Status', 'View', 'ViewListResult', 'AccumulatedType', + 'AlertCategory', + 'AlertCriteria', + 'AlertOperator', + 'AlertSource', + 'AlertStatus', + 'AlertTimeGrainType', + 'AlertType', 'ChartType', 'ExecutionStatus', 'ExecutionType', @@ -170,8 +229,12 @@ 'ExternalCloudProviderType', 'ForecastTimeframeType', 'ForecastType', + 'FormatType', + 'FunctionType', + 'GranularityType', 'KpiType', 'MetricType', + 'OperationStatusType', 'OperatorType', 'PivotType', 'QueryColumnType', @@ -180,6 +243,8 @@ 'ReportConfigSortingDirection', 'ReportGranularityType', 'ReportTimeframeType', + 'ReportType', + 'SettingsPropertiesStartOn', '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 index 833645db5a5..eac0fd7748f 100644 --- 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 @@ -6,169 +6,313 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - -class AccumulatedType(str, Enum): +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccumulatedType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Show costs accumulated over time. """ - true = "true" - false = "false" + TRUE = "true" + FALSE = "false" + +class AlertCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Alert category + """ + + COST = "Cost" + USAGE = "Usage" + BILLING = "Billing" + SYSTEM = "System" + +class AlertCriteria(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Criteria that triggered alert + """ + + COST_THRESHOLD_EXCEEDED = "CostThresholdExceeded" + USAGE_THRESHOLD_EXCEEDED = "UsageThresholdExceeded" + CREDIT_THRESHOLD_APPROACHING = "CreditThresholdApproaching" + CREDIT_THRESHOLD_REACHED = "CreditThresholdReached" + QUOTA_THRESHOLD_APPROACHING = "QuotaThresholdApproaching" + QUOTA_THRESHOLD_REACHED = "QuotaThresholdReached" + MULTI_CURRENCY = "MultiCurrency" + FORECAST_COST_THRESHOLD_EXCEEDED = "ForecastCostThresholdExceeded" + FORECAST_USAGE_THRESHOLD_EXCEEDED = "ForecastUsageThresholdExceeded" + INVOICE_DUE_DATE_APPROACHING = "InvoiceDueDateApproaching" + INVOICE_DUE_DATE_REACHED = "InvoiceDueDateReached" + CROSS_CLOUD_NEW_DATA_AVAILABLE = "CrossCloudNewDataAvailable" + CROSS_CLOUD_COLLECTION_ERROR = "CrossCloudCollectionError" + GENERAL_THRESHOLD_ERROR = "GeneralThresholdError" + +class AlertOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """operator used to compare currentSpend with amount + """ + + NONE = "None" + EQUAL_TO = "EqualTo" + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL_TO = "GreaterThanOrEqualTo" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL_TO = "LessThanOrEqualTo" + +class AlertSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Source of alert + """ + + PRESET = "Preset" + USER = "User" + +class AlertStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """alert status + """ + + NONE = "None" + ACTIVE = "Active" + OVERRIDDEN = "Overridden" + RESOLVED = "Resolved" + DISMISSED = "Dismissed" + +class AlertTimeGrainType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of timegrain cadence + """ + + NONE = "None" + MONTHLY = "Monthly" + QUARTERLY = "Quarterly" + ANNUALLY = "Annually" + BILLING_MONTH = "BillingMonth" + BILLING_QUARTER = "BillingQuarter" + BILLING_ANNUAL = "BillingAnnual" + +class AlertType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """type of alert + """ -class ChartType(str, Enum): + BUDGET = "Budget" + INVOICE = "Invoice" + CREDIT = "Credit" + QUOTA = "Quota" + GENERAL = "General" + X_CLOUD = "xCloud" + BUDGET_FORECAST = "BudgetForecast" + +class ChartType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Chart type of the main view in Cost Analysis. Required. """ - area = "Area" - line = "Line" - stacked_column = "StackedColumn" - grouped_column = "GroupedColumn" - table = "Table" + AREA = "Area" + LINE = "Line" + STACKED_COLUMN = "StackedColumn" + GROUPED_COLUMN = "GroupedColumn" + TABLE = "Table" -class ExecutionStatus(str, Enum): +class ExecutionStatus(with_metaclass(_CaseInsensitiveEnumMeta, 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" + QUEUED = "Queued" + IN_PROGRESS = "InProgress" + COMPLETED = "Completed" + FAILED = "Failed" + TIMEOUT = "Timeout" + NEW_DATA_NOT_AVAILABLE = "NewDataNotAvailable" + DATA_NOT_AVAILABLE = "DataNotAvailable" -class ExecutionType(str, Enum): +class ExecutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of the export execution. """ - on_demand = "OnDemand" - scheduled = "Scheduled" + ON_DEMAND = "OnDemand" + SCHEDULED = "Scheduled" -class ExportType(str, Enum): +class ExportType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of the query. """ - usage = "Usage" - actual_cost = "ActualCost" - amortized_cost = "AmortizedCost" + USAGE = "Usage" + ACTUAL_COST = "ActualCost" + AMORTIZED_COST = "AmortizedCost" -class ExternalCloudProviderType(str, Enum): +class ExternalCloudProviderType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - external_subscriptions = "externalSubscriptions" - external_billing_accounts = "externalBillingAccounts" + EXTERNAL_SUBSCRIPTIONS = "externalSubscriptions" + EXTERNAL_BILLING_ACCOUNTS = "externalBillingAccounts" -class ForecastTimeframeType(str, Enum): +class ForecastTimeframeType(with_metaclass(_CaseInsensitiveEnumMeta, 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" + 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): +class ForecastType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of the forecast. """ - usage = "Usage" - actual_cost = "ActualCost" - amortized_cost = "AmortizedCost" + USAGE = "Usage" + ACTUAL_COST = "ActualCost" + AMORTIZED_COST = "AmortizedCost" + +class FormatType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The format of the export being delivered. + """ + + CSV = "Csv" + +class FunctionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the aggregation function to use. + """ + + AVG = "Avg" + MAX = "Max" + MIN = "Min" + SUM = "Sum" + +class GranularityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The granularity of rows in the query. + """ + + DAILY = "Daily" -class KpiType(str, Enum): +class KpiType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """KPI type (Forecast, Budget). """ - forecast = "Forecast" - budget = "Budget" + FORECAST = "Forecast" + BUDGET = "Budget" -class MetricType(str, Enum): +class MetricType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Metric to use when displaying costs. """ - actual_cost = "ActualCost" - amortized_cost = "AmortizedCost" - ahub = "AHUB" + ACTUAL_COST = "ActualCost" + AMORTIZED_COST = "AmortizedCost" + AHUB = "AHUB" -class OperatorType(str, Enum): +class OperationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the long running operation. + """ + + RUNNING = "Running" + COMPLETED = "Completed" + FAILED = "Failed" + +class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The operator to use for comparison. """ - in_enum = "In" - contains = "Contains" + IN_ENUM = "In" + CONTAINS = "Contains" -class PivotType(str, Enum): +class PivotType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Data type to show in view. """ - dimension = "Dimension" - tag_key = "TagKey" + DIMENSION = "Dimension" + TAG_KEY = "TagKey" -class QueryColumnType(str, Enum): +class QueryColumnType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of the column in the export. """ - tag = "Tag" - dimension = "Dimension" + TAG = "Tag" + DIMENSION = "Dimension" -class RecurrenceType(str, Enum): +class RecurrenceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The schedule recurrence. """ - daily = "Daily" - weekly = "Weekly" - monthly = "Monthly" - annually = "Annually" + DAILY = "Daily" + WEEKLY = "Weekly" + MONTHLY = "Monthly" + ANNUALLY = "Annually" -class ReportConfigColumnType(str, Enum): +class ReportConfigColumnType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of the column in the report. """ - tag = "Tag" - dimension = "Dimension" + TAG = "Tag" + DIMENSION = "Dimension" -class ReportConfigSortingDirection(str, Enum): +class ReportConfigSortingDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Direction of sort. """ - ascending = "Ascending" - descending = "Descending" + ASCENDING = "Ascending" + DESCENDING = "Descending" -class ReportGranularityType(str, Enum): +class ReportGranularityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The granularity of rows in the report. """ - daily = "Daily" - monthly = "Monthly" + DAILY = "Daily" + MONTHLY = "Monthly" -class ReportTimeframeType(str, Enum): +class ReportTimeframeType(with_metaclass(_CaseInsensitiveEnumMeta, 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" + WEEK_TO_DATE = "WeekToDate" + MONTH_TO_DATE = "MonthToDate" + YEAR_TO_DATE = "YearToDate" + CUSTOM = "Custom" + +class ReportType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """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. + """ + + USAGE = "Usage" + +class SettingsPropertiesStartOn(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates what scope Cost Management in the Azure portal should default to. Allowed values: + LastUsed. + """ + + LAST_USED = "LastUsed" + SCOPE_PICKER = "ScopePicker" + SPECIFIC_SCOPE = "SpecificScope" -class StatusType(str, Enum): +class StatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The status of the schedule. Whether active or not. If inactive, the export's scheduled execution is paused. """ - active = "Active" - inactive = "Inactive" + ACTIVE = "Active" + INACTIVE = "Inactive" -class TimeframeType(str, Enum): +class TimeframeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The time frame for pulling data for the query. If custom, then a specific time period must be 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" + 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 index b1fa942dab2..962b1e7e2ed 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models.py @@ -64,17 +64,18 @@ class Alert(Resource): :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 + :type definition: ~cost_management_client.models.AlertPropertiesDefinition :param description: Alert description. :type description: str - :param source: Source of alert. - :type source: str + :param source: Source of alert. Possible values include: "Preset", "User". + :type source: str or ~cost_management_client.models.AlertSource :param details: Alert details. - :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :type details: ~cost_management_client.models.AlertPropertiesDetails :param cost_entity_id: related budget. :type cost_entity_id: str - :param status: alert status. - :type status: str + :param status: alert status. Possible values include: "None", "Active", "Overridden", + "Resolved", "Dismissed". + :type status: str or ~cost_management_client.models.AlertStatus :param creation_time: dateTime in which alert was created. :type creation_time: str :param close_time: dateTime in which alert was closed. @@ -133,12 +134,18 @@ def __init__( 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 + :param type: type of alert. Possible values include: "Budget", "Invoice", "Credit", "Quota", + "General", "xCloud", "BudgetForecast". + :type type: str or ~cost_management_client.models.AlertType + :param category: Alert category. Possible values include: "Cost", "Usage", "Billing", "System". + :type category: str or ~cost_management_client.models.AlertCategory + :param criteria: Criteria that triggered alert. Possible values include: + "CostThresholdExceeded", "UsageThresholdExceeded", "CreditThresholdApproaching", + "CreditThresholdReached", "QuotaThresholdApproaching", "QuotaThresholdReached", + "MultiCurrency", "ForecastCostThresholdExceeded", "ForecastUsageThresholdExceeded", + "InvoiceDueDateApproaching", "InvoiceDueDateReached", "CrossCloudNewDataAvailable", + "CrossCloudCollectionError", "GeneralThresholdError". + :type criteria: str or ~cost_management_client.models.AlertCriteria """ _attribute_map = { @@ -160,8 +167,9 @@ def __init__( class AlertPropertiesDetails(msrest.serialization.Model): """Alert details. - :param time_grain_type: Type of timegrain cadence. - :type time_grain_type: str + :param time_grain_type: Type of timegrain cadence. Possible values include: "None", "Monthly", + "Quarterly", "Annually", "BillingMonth", "BillingQuarter", "BillingAnnual". + :type time_grain_type: str or ~cost_management_client.models.AlertTimeGrainType :param period_start_date: datetime of periodStartDate. :type period_start_date: str :param triggered_by: notificationId that triggered this alert. @@ -176,8 +184,9 @@ class AlertPropertiesDetails(msrest.serialization.Model): :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 operator: operator used to compare currentSpend with amount. Possible values include: + "None", "EqualTo", "GreaterThan", "GreaterThanOrEqualTo", "LessThan", "LessThanOrEqualTo". + :type operator: str or ~cost_management_client.models.AlertOperator :param amount: budget threshold amount. :type amount: float :param unit: unit of currency being used. @@ -242,7 +251,7 @@ class AlertsResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.Alert] :ivar next_link: URL to get the next set of alerts results if there are any. :vartype next_link: str """ @@ -266,80 +275,90 @@ def __init__( self.next_link = None +class CacheItem(msrest.serialization.Model): + """CacheItem. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID used by Resource Manager to uniquely identify the scope. + :type id: str + :param name: Required. Display name for the scope. + :type name: str + :param channel: Required. Indicates the account type. Allowed values include: EA, PAYG, Modern, + Internal, Unknown. + :type channel: str + :param subchannel: Required. Indicates the type of modern account. Allowed values include: + Individual, Enterprise, Partner, Indirect, NotApplicable. + :type subchannel: str + :param parent: Resource ID of the parent scope. For instance, subscription's resource ID for a + resource group or a management group resource ID for a subscription. + :type parent: str + :param status: Indicates the status of the scope. Status only applies to subscriptions and + billing accounts. + :type status: str + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'channel': {'required': True}, + 'subchannel': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'channel': {'key': 'channel', 'type': 'str'}, + 'subchannel': {'key': 'subchannel', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CacheItem, self).__init__(**kwargs) + self.id = kwargs['id'] + self.name = kwargs['name'] + self.channel = kwargs['channel'] + self.subchannel = kwargs['subchannel'] + self.parent = kwargs.get('parent', None) + self.status = kwargs.get('status', None) + + class CommonExportProperties(msrest.serialization.Model): """The common properties of the export. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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 format: The format of the export being delivered. Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~cost_management_client.models.ExportDeliveryInfo + :param definition: Required. Has definition for the export. + :type definition: ~cost_management_client.models.ExportDefinition """ _validation = { - 'format': {'constant': True}, - 'type': {'required': True}, - 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, - 'destination': {'required': True}, + 'delivery_info': {'required': True}, + 'definition': {'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'}, + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, } - 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'] + self.format = kwargs.get('format', None) + self.delivery_info = kwargs['delivery_info'] + self.definition = kwargs['definition'] class Dimension(Resource): @@ -428,7 +447,7 @@ class DimensionsListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.Dimension] """ _validation = { @@ -447,6 +466,66 @@ def __init__( self.value = None +class DismissAlertPayload(msrest.serialization.Model): + """The request payload to update an alert. + + :param definition: defines the type of alert. + :type definition: ~cost_management_client.models.AlertPropertiesDefinition + :param description: Alert description. + :type description: str + :param source: Source of alert. Possible values include: "Preset", "User". + :type source: str or ~cost_management_client.models.AlertSource + :param details: Alert details. + :type details: ~cost_management_client.models.AlertPropertiesDetails + :param cost_entity_id: related budget. + :type cost_entity_id: str + :param status: alert status. Possible values include: "None", "Active", "Overridden", + "Resolved", "Dismissed". + :type status: str or ~cost_management_client.models.AlertStatus + :param creation_time: dateTime in which alert was created. + :type creation_time: str + :param close_time: dateTime in which alert was closed. + :type close_time: str + :param modification_time: dateTime in which alert was last modified. + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was last modified. + :type status_modification_time: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DismissAlertPayload, self).__init__(**kwargs) + self.definition = kwargs.get('definition', None) + self.description = kwargs.get('description', None) + self.source = kwargs.get('source', None) + self.details = kwargs.get('details', None) + self.cost_entity_id = kwargs.get('cost_entity_id', None) + self.status = kwargs.get('status', None) + self.creation_time = kwargs.get('creation_time', None) + self.close_time = kwargs.get('close_time', None) + self.modification_time = kwargs.get('modification_time', None) + self.status_modification_user_name = kwargs.get('status_modification_user_name', None) + self.status_modification_time = kwargs.get('status_modification_time', None) + + class ErrorDetails(msrest.serialization.Model): """The details of the error. @@ -478,19 +557,19 @@ def __init__( 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. + """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: +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. +* + 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 + :type error: ~cost_management_client.models.ErrorDetails """ _attribute_map = { @@ -559,51 +638,20 @@ class Export(ProxyResource): :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. :type e_tag: str - :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 + :param format: The format of the export being delivered. Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param delivery_info: Has delivery information for the export. + :type delivery_info: ~cost_management_client.models.ExportDeliveryInfo + :param definition: Has definition for the export. + :type definition: ~cost_management_client.models.ExportDefinition + :param schedule: Has schedule information for the export. + :type schedule: ~cost_management_client.models.ExportSchedule """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'format': {'constant': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, } _attribute_map = { @@ -612,39 +660,61 @@ class Export(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'e_tag': {'key': 'eTag', '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" + 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, + } 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.format = kwargs.get('format', None) + self.delivery_info = kwargs.get('delivery_info', None) + self.definition = kwargs.get('definition', None) + self.schedule = kwargs.get('schedule', None) + + +class ExportDefinition(msrest.serialization.Model): + """The definition of a query. + + 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 ~cost_management_client.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 ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param data_set: Has definition for data in this query. + :type data_set: ~cost_management_client.models.QueryDatasetautogenerated + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'QueryDatasetautogenerated'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDefinition, 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.get('destination', None) - self.status = kwargs.get('status', None) - self.recurrence = kwargs.get('recurrence', None) - self.recurrence_period = kwargs.get('recurrence_period', None) + self.data_set = kwargs.get('data_set', None) class ExportDeliveryDestination(msrest.serialization.Model): @@ -682,6 +752,31 @@ def __init__( self.root_folder_path = kwargs.get('root_folder_path', None) +class ExportDeliveryInfo(msrest.serialization.Model): + """The delivery information associated with a export. + + All required parameters must be populated in order to send to Azure. + + :param destination: Required. Has destination for the export being delivered. + :type destination: ~cost_management_client.models.ExportDeliveryDestination + """ + + _validation = { + 'destination': {'required': True}, + } + + _attribute_map = { + 'destination': {'key': 'destination', 'type': 'ExportDeliveryDestination'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDeliveryInfo, self).__init__(**kwargs) + self.destination = kwargs['destination'] + + class ExportExecution(Resource): """A export execution. @@ -697,10 +792,10 @@ class ExportExecution(Resource): :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 + :type execution_type: str or ~cost_management_client.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 + :type status: str or ~cost_management_client.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 @@ -713,7 +808,7 @@ class ExportExecution(Resource): :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 + :type run_settings: ~cost_management_client.models.CommonExportProperties """ _validation = { @@ -759,7 +854,7 @@ class ExportExecutionListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.ExportExecution] """ _validation = { @@ -784,7 +879,7 @@ class ExportListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.Export] """ _validation = { @@ -806,84 +901,36 @@ def __init__( class ExportProperties(CommonExportProperties): """The properties of the export. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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 + :param format: The format of the export being delivered. Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~cost_management_client.models.ExportDeliveryInfo + :param definition: Required. Has definition for the export. + :type definition: ~cost_management_client.models.ExportDefinition + :param schedule: Has schedule information for the export. + :type schedule: ~cost_management_client.models.ExportSchedule """ _validation = { - 'format': {'constant': True}, - 'type': {'required': True}, - 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, - 'destination': {'required': True}, + 'delivery_info': {'required': True}, + 'definition': {'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" + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + 'schedule': {'key': 'schedule', 'type': 'ExportSchedule'}, + } 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) + self.schedule = kwargs.get('schedule', None) class ExportRecurrencePeriod(msrest.serialization.Model): @@ -915,64 +962,79 @@ def __init__( self.to = kwargs.get('to', None) +class ExportSchedule(msrest.serialization.Model): + """The schedule associated with a export. + + All required parameters must be populated in order to send to Azure. + + :param status: The status of the schedule. Whether active or not. If inactive, the export's + scheduled execution is paused. Possible values include: "Active", "Inactive". + :type status: str or ~cost_management_client.models.StatusType + :param recurrence: Required. The schedule recurrence. Possible values include: "Daily", + "Weekly", "Monthly", "Annually". + :type recurrence: str or ~cost_management_client.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: ~cost_management_client.models.ExportRecurrencePeriod + """ + + _validation = { + 'recurrence': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'recurrence': {'key': 'recurrence', 'type': 'str'}, + 'recurrence_period': {'key': 'recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportSchedule, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.recurrence = kwargs['recurrence'] + self.recurrence_period = kwargs.get('recurrence_period', 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 + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.models.ForecastTimeframeType :param time_period: Has time period for pulling data for the forecast. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param dataset: Required. Has definition for data in this forecast. + :type dataset: ~cost_management_client.models.QueryDataset :param include_actual_cost: a boolean determining if actualCost will be included. :type include_actual_cost: bool :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. :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}, + 'dataset': {'required': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, '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 @@ -981,19 +1043,16 @@ def __init__( self.type = kwargs['type'] self.timeframe = kwargs['timeframe'] self.time_period = kwargs.get('time_period', None) + self.dataset = kwargs['dataset'] 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 + :type type: str or ~cost_management_client.models.KpiType :param id: ID of resource related to metric (budget). :type id: str :param enabled: show the KPI in the UI?. @@ -1024,7 +1083,7 @@ class Operation(msrest.serialization.Model): :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 + :type display: ~cost_management_client.models.OperationDisplay """ _validation = { @@ -1087,7 +1146,7 @@ class OperationListResult(msrest.serialization.Model): :ivar value: List of cost management operations supported by the Microsoft.CostManagement resource provider. - :vartype value: list[~azure.mgmt.costmanagement.models.Operation] + :vartype value: list[~cost_management_client.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1111,11 +1170,38 @@ def __init__( self.next_link = None +class OperationStatus(msrest.serialization.Model): + """The status of the long running operation. + + :param status: The status of the long running operation. + :type status: ~cost_management_client.models.Status + :param report_url: The URL to download the generated report. + :type report_url: str + :param valid_until: The time at which report URL becomes invalid. + :type valid_until: ~datetime.datetime + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'Status'}, + 'report_url': {'key': 'properties.reportUrl', 'type': 'str'}, + 'valid_until': {'key': 'properties.validUntil', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationStatus, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.report_url = kwargs.get('report_url', None) + self.valid_until = kwargs.get('valid_until', None) + + class PivotProperties(msrest.serialization.Model): """Each pivot must contain a 'type' and 'name'. :param type: Data type to show in view. Possible values include: "Dimension", "TagKey". - :type type: str or ~azure.mgmt.costmanagement.models.PivotType + :type type: str or ~cost_management_client.models.PivotType :param name: Data field to show in view. :type name: str """ @@ -1134,22 +1220,61 @@ def __init__( self.name = kwargs.get('name', None) -class QueryAggregation(msrest.serialization.Model): - """The aggregation expression to be used in the query. +class ProxySettingResource(msrest.serialization.Model): + """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxySettingResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = None + self.type = None + + +class QueryAggregation(msrest.serialization.Model): + """The aggregation expression to be used in the query. + 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 + :param function: Required. The name of the aggregation function to use. Possible values + include: "Avg", "Max", "Min", "Sum". + :type function: str or ~cost_management_client.models.FunctionType """ _validation = { 'name': {'required': True}, - 'function': {'required': True, 'constant': True}, + 'function': {'required': True}, } _attribute_map = { @@ -1157,14 +1282,13 @@ class QueryAggregation(msrest.serialization.Model): 'function': {'key': 'function', 'type': 'str'}, } - function = "Sum" - def __init__( self, **kwargs ): super(QueryAggregation, self).__init__(**kwargs) self.name = kwargs['name'] + self.function = kwargs['function'] class QueryColumn(msrest.serialization.Model): @@ -1199,7 +1323,7 @@ class QueryComparisonExpression(msrest.serialization.Model): :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 + :type operator: str or ~cost_management_client.models.OperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1226,6 +1350,94 @@ def __init__( self.values = kwargs['values'] +class QueryDataset(msrest.serialization.Model): + """The definition of data present in the query. + + :param granularity: The granularity of rows in the query. Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: Has configuration information for the data in the export. The + configuration will be ignored if aggregation and grouping are provided. + :type configuration: ~cost_management_client.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, ~cost_management_client.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[~cost_management_client.models.QueryGrouping] + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. + :type filter: ~cost_management_client.models.QueryFilter + """ + + _validation = { + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'filter', 'type': 'QueryFilter'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryDataset, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + self.aggregation = kwargs.get('aggregation', None) + self.grouping = kwargs.get('grouping', None) + self.filter = kwargs.get('filter', None) + + +class QueryDatasetautogenerated(msrest.serialization.Model): + """The definition of data present in the query. + + :param granularity: The granularity of rows in the query. Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: Has configuration information for the data in the export. The + configuration will be ignored if aggregation and grouping are provided. + :type configuration: ~cost_management_client.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, ~cost_management_client.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[~cost_management_client.models.QueryGrouping] + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. + :type filter: ~cost_management_client.models.QueryFilterautogenerated + """ + + _validation = { + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'filter', 'type': 'QueryFilterautogenerated'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryDatasetautogenerated, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + self.aggregation = kwargs.get('aggregation', None) + self.grouping = kwargs.get('grouping', None) + self.filter = kwargs.get('filter', None) + + class QueryDatasetConfiguration(msrest.serialization.Model): """The configuration of dataset in the query. @@ -1249,55 +1461,34 @@ def __init__( 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 + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param dataset: Required. Has definition for data in this query. + :type dataset: ~cost_management_client.models.QueryDataset """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, + 'dataset': {'required': True}, } _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'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, } - granularity = "Daily" - def __init__( self, **kwargs @@ -1306,25 +1497,20 @@ def __init__( 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.dataset = kwargs['dataset'] 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] + :type and_property: list[~cost_management_client.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 + :type or_property: list[~cost_management_client.models.QueryFilter] + :param dimensions: Has comparison expression for a dimension. + :type dimensions: ~cost_management_client.models.QueryComparisonExpression + :param tags: A set of tags. Has comparison expression for a tag. + :type tags: ~cost_management_client.models.QueryComparisonExpression """ _validation = { @@ -1335,9 +1521,8 @@ class QueryFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'not_property': {'key': 'not', 'type': 'QueryFilter'}, - 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, } def __init__( @@ -1347,9 +1532,44 @@ def __init__( super(QueryFilter, self).__init__(**kwargs) self.and_property = kwargs.get('and_property', None) self.or_property = kwargs.get('or_property', None) - self.not_property = kwargs.get('not_property', None) - self.dimension = kwargs.get('dimension', None) - self.tag = kwargs.get('tag', None) + self.dimensions = kwargs.get('dimensions', None) + self.tags = kwargs.get('tags', None) + + +class QueryFilterautogenerated(msrest.serialization.Model): + """The filter expression to be used in the export. + + :param and_property: The logical "AND" expression. Must have at least 2 items. + :type and_property: list[~cost_management_client.models.QueryFilterautogenerated] + :param or_property: The logical "OR" expression. Must have at least 2 items. + :type or_property: list[~cost_management_client.models.QueryFilterautogenerated] + :param dimensions: Has comparison expression for a dimension. + :type dimensions: ~cost_management_client.models.QueryComparisonExpression + :param tags: A set of tags. Has comparison expression for a tag. + :type tags: ~cost_management_client.models.QueryComparisonExpression + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _attribute_map = { + 'and_property': {'key': 'and', 'type': '[QueryFilterautogenerated]'}, + 'or_property': {'key': 'or', 'type': '[QueryFilterautogenerated]'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryFilterautogenerated, self).__init__(**kwargs) + self.and_property = kwargs.get('and_property', None) + self.or_property = kwargs.get('or_property', None) + self.dimensions = kwargs.get('dimensions', None) + self.tags = kwargs.get('tags', None) class QueryGrouping(msrest.serialization.Model): @@ -1359,7 +1579,7 @@ class QueryGrouping(msrest.serialization.Model): :param type: Required. Has type of the column to group. Possible values include: "Tag", "Dimension". - :type type: str or ~azure.mgmt.costmanagement.models.QueryColumnType + :type type: str or ~cost_management_client.models.QueryColumnType :param name: Required. The name of the column to group. :type name: str """ @@ -1396,10 +1616,17 @@ class QueryResult(Resource): :vartype type: str :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :ivar location: Resource location. + :vartype location: str + :ivar sku: Resource SKU. + :vartype sku: str :param next_link: The link (url) to the next page of results. :type next_link: str :param columns: Array of columns. - :type columns: list[~azure.mgmt.costmanagement.models.QueryColumn] + :type columns: list[~cost_management_client.models.QueryColumn] :param rows: Array of rows. :type rows: list[list[object]] """ @@ -1409,6 +1636,8 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, + 'location': {'readonly': True}, + 'sku': {'readonly': True}, } _attribute_map = { @@ -1416,6 +1645,9 @@ class QueryResult(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, @@ -1426,6 +1658,9 @@ def __init__( **kwargs ): super(QueryResult, self).__init__(**kwargs) + self.e_tag = kwargs.get('e_tag', None) + self.location = None + self.sku = None self.next_link = kwargs.get('next_link', None) self.columns = kwargs.get('columns', None) self.rows = kwargs.get('rows', None) @@ -1464,19 +1699,18 @@ def __init__( 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 + :param function: Required. The name of the aggregation function to use. Possible values + include: "Avg", "Max", "Min", "Sum". + :type function: str or ~cost_management_client.models.FunctionType """ _validation = { 'name': {'required': True}, - 'function': {'required': True, 'constant': True}, + 'function': {'required': True}, } _attribute_map = { @@ -1484,14 +1718,13 @@ class ReportConfigAggregation(msrest.serialization.Model): 'function': {'key': 'function', 'type': 'str'}, } - function = "Sum" - def __init__( self, **kwargs ): super(ReportConfigAggregation, self).__init__(**kwargs) self.name = kwargs['name'] + self.function = kwargs['function'] class ReportConfigComparisonExpression(msrest.serialization.Model): @@ -1503,7 +1736,7 @@ class ReportConfigComparisonExpression(msrest.serialization.Model): :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 + :type operator: str or ~cost_management_client.models.OperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1535,21 +1768,21 @@ class ReportConfigDataset(msrest.serialization.Model): :param granularity: The granularity of rows in the report. Possible values include: "Daily", "Monthly". - :type granularity: str or ~azure.mgmt.costmanagement.models.ReportGranularityType + :type granularity: str or ~cost_management_client.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 + :type configuration: ~cost_management_client.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] + :type aggregation: dict[str, ~cost_management_client.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] + :type grouping: list[~cost_management_client.models.ReportConfigGrouping] :param sorting: Array of order by expression to use in the report. - :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] + :type sorting: list[~cost_management_client.models.ReportConfigSorting] :param filter: Has filter expression to use in the report. - :type filter: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :type filter: ~cost_management_client.models.ReportConfigFilter """ _validation = { @@ -1602,15 +1835,17 @@ 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] + :type and_property: list[~cost_management_client.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 + :type or_property: list[~cost_management_client.models.ReportConfigFilter] + :param dimensions: Has comparison expression for a dimension. + :type dimensions: ~cost_management_client.models.ReportConfigComparisonExpression + :param tags: A set of tags. Has comparison expression for a tag. + :type tags: ~cost_management_client.models.ReportConfigComparisonExpression + :param tag_key: Has comparison expression for a tag key. + :type tag_key: ~cost_management_client.models.ReportConfigComparisonExpression + :param tag_value: Has comparison expression for a tag value. + :type tag_value: ~cost_management_client.models.ReportConfigComparisonExpression """ _validation = { @@ -1621,9 +1856,10 @@ class ReportConfigFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, - 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, - 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, + 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, + 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, } def __init__( @@ -1633,9 +1869,10 @@ def __init__( super(ReportConfigFilter, self).__init__(**kwargs) self.and_property = kwargs.get('and_property', None) self.or_property = kwargs.get('or_property', None) - self.not_property = kwargs.get('not_property', None) - self.dimension = kwargs.get('dimension', None) - self.tag = kwargs.get('tag', None) + self.dimensions = kwargs.get('dimensions', None) + self.tags = kwargs.get('tags', None) + self.tag_key = kwargs.get('tag_key', None) + self.tag_value = kwargs.get('tag_value', None) class ReportConfigGrouping(msrest.serialization.Model): @@ -1645,7 +1882,7 @@ class ReportConfigGrouping(msrest.serialization.Model): :param type: Required. Has type of the column to group. Possible values include: "Tag", "Dimension". - :type type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :type type: str or ~cost_management_client.models.ReportConfigColumnType :param name: Required. The name of the column to group. This version supports subscription lowest possible grain. :type name: str @@ -1676,7 +1913,7 @@ class ReportConfigSorting(msrest.serialization.Model): 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 + :type direction: str or ~cost_management_client.models.ReportConfigSortingDirection :param name: Required. The name of the column to sort. :type name: str """ @@ -1729,6 +1966,107 @@ def __init__( self.to = kwargs['to'] +class Setting(ProxySettingResource): + """State of the myscope setting. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + :param scope: Sets the default scope the current user will see when they sign into Azure Cost + Management in the Azure portal. + :type scope: str + :param start_on: Indicates what scope Cost Management in the Azure portal should default to. + Allowed values: LastUsed. Possible values include: "LastUsed", "ScopePicker", "SpecificScope". + :type start_on: str or ~cost_management_client.models.SettingsPropertiesStartOn + :param cache: Array of scopes with additional details used by Cost Management in the Azure + portal. + :type cache: list[~cost_management_client.models.CacheItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'start_on': {'key': 'properties.startOn', 'type': 'str'}, + 'cache': {'key': 'properties.cache', 'type': '[CacheItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(Setting, self).__init__(**kwargs) + self.scope = kwargs.get('scope', None) + self.start_on = kwargs.get('start_on', None) + self.cache = kwargs.get('cache', None) + + +class SettingsListResult(msrest.serialization.Model): + """Result of listing settings. It contains a list of available settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of settings. + :vartype value: list[~cost_management_client.models.Setting] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True, 'max_items': 10, 'min_items': 0}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Setting]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SettingsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Status(msrest.serialization.Model): + """The status of the long running operation. + + :param status: The status of the long running operation. Possible values include: "Running", + "Completed", "Failed". + :type status: str or ~cost_management_client.models.OperationStatusType + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Status, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + + class View(ProxyResource): """States and configurations of Cost Analysis. @@ -1767,31 +2105,37 @@ class View(ProxyResource): :vartype created_on: ~datetime.datetime :ivar modified_on: Date when the user last modified this view. :vartype modified_on: ~datetime.datetime + :ivar date_range: Selected date range for viewing cost in. + :vartype date_range: str + :ivar currency: Selected currency. + :vartype currency: str :param chart: Chart type of the main view in Cost Analysis. Required. Possible values include: "Area", "Line", "StackedColumn", "GroupedColumn", "Table". - :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :type chart: str or ~cost_management_client.models.ChartType :param accumulated: Show costs accumulated over time. Possible values include: "true", "false". - :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :type accumulated: str or ~cost_management_client.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 + :type metric: str or ~cost_management_client.models.MetricType :param kpis: List of KPIs to show in Cost Analysis UI. - :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :type kpis: list[~cost_management_client.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, + :type pivots: list[~cost_management_client.models.PivotProperties] + :param 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 + data. Actual usage and forecasted data can be differentiated based on dates. Possible values + include: "Usage". + :type type_properties_query_type: str or ~cost_management_client.models.ReportType :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 + :type timeframe: str or ~cost_management_client.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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod + :param data_set: Has definition for data in this report config. + :type data_set: ~cost_management_client.models.ReportConfigDataset + :ivar include_monetary_commitment: Include monetary commitment. + :vartype include_monetary_commitment: bool """ _validation = { @@ -1800,7 +2144,9 @@ class View(ProxyResource): 'type': {'readonly': True}, 'created_on': {'readonly': True}, 'modified_on': {'readonly': True}, - 'type_properties_query_type': {'constant': True}, + 'date_range': {'readonly': True}, + 'currency': {'readonly': True}, + 'include_monetary_commitment': {'readonly': True}, } _attribute_map = { @@ -1812,6 +2158,8 @@ class View(ProxyResource): 'scope': {'key': 'properties.scope', 'type': 'str'}, 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'date_range': {'key': 'properties.dateRange', 'type': 'str'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, 'chart': {'key': 'properties.chart', 'type': 'str'}, 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, 'metric': {'key': 'properties.metric', 'type': 'str'}, @@ -1820,11 +2168,10 @@ class View(ProxyResource): 'type_properties_query_type': {'key': 'properties.query.type', 'type': 'str'}, 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, - 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, + 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, } - type_properties_query_type = "Usage" - def __init__( self, **kwargs @@ -1834,14 +2181,18 @@ def __init__( self.scope = kwargs.get('scope', None) self.created_on = None self.modified_on = None + self.date_range = None + self.currency = None self.chart = kwargs.get('chart', None) self.accumulated = kwargs.get('accumulated', None) self.metric = kwargs.get('metric', None) self.kpis = kwargs.get('kpis', None) self.pivots = kwargs.get('pivots', None) + self.type_properties_query_type = kwargs.get('type_properties_query_type', None) self.timeframe = kwargs.get('timeframe', None) self.time_period = kwargs.get('time_period', None) - self.dataset = kwargs.get('dataset', None) + self.data_set = kwargs.get('data_set', None) + self.include_monetary_commitment = None class ViewListResult(msrest.serialization.Model): @@ -1850,7 +2201,7 @@ class ViewListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.View] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ 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 index 06fca40ed98..28647c744ff 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models_py3.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models_py3.py @@ -12,6 +12,8 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization +from ._cost_management_client_enums import * + class Resource(msrest.serialization.Model): """The Resource model definition. @@ -67,17 +69,18 @@ class Alert(Resource): :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 + :type definition: ~cost_management_client.models.AlertPropertiesDefinition :param description: Alert description. :type description: str - :param source: Source of alert. - :type source: str + :param source: Source of alert. Possible values include: "Preset", "User". + :type source: str or ~cost_management_client.models.AlertSource :param details: Alert details. - :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :type details: ~cost_management_client.models.AlertPropertiesDetails :param cost_entity_id: related budget. :type cost_entity_id: str - :param status: alert status. - :type status: str + :param status: alert status. Possible values include: "None", "Active", "Overridden", + "Resolved", "Dismissed". + :type status: str or ~cost_management_client.models.AlertStatus :param creation_time: dateTime in which alert was created. :type creation_time: str :param close_time: dateTime in which alert was closed. @@ -120,10 +123,10 @@ def __init__( *, definition: Optional["AlertPropertiesDefinition"] = None, description: Optional[str] = None, - source: Optional[str] = None, + source: Optional[Union[str, "AlertSource"]] = None, details: Optional["AlertPropertiesDetails"] = None, cost_entity_id: Optional[str] = None, - status: Optional[str] = None, + status: Optional[Union[str, "AlertStatus"]] = None, creation_time: Optional[str] = None, close_time: Optional[str] = None, modification_time: Optional[str] = None, @@ -148,12 +151,18 @@ def __init__( 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 + :param type: type of alert. Possible values include: "Budget", "Invoice", "Credit", "Quota", + "General", "xCloud", "BudgetForecast". + :type type: str or ~cost_management_client.models.AlertType + :param category: Alert category. Possible values include: "Cost", "Usage", "Billing", "System". + :type category: str or ~cost_management_client.models.AlertCategory + :param criteria: Criteria that triggered alert. Possible values include: + "CostThresholdExceeded", "UsageThresholdExceeded", "CreditThresholdApproaching", + "CreditThresholdReached", "QuotaThresholdApproaching", "QuotaThresholdReached", + "MultiCurrency", "ForecastCostThresholdExceeded", "ForecastUsageThresholdExceeded", + "InvoiceDueDateApproaching", "InvoiceDueDateReached", "CrossCloudNewDataAvailable", + "CrossCloudCollectionError", "GeneralThresholdError". + :type criteria: str or ~cost_management_client.models.AlertCriteria """ _attribute_map = { @@ -165,9 +174,9 @@ class AlertPropertiesDefinition(msrest.serialization.Model): def __init__( self, *, - type: Optional[str] = None, - category: Optional[str] = None, - criteria: Optional[str] = None, + type: Optional[Union[str, "AlertType"]] = None, + category: Optional[Union[str, "AlertCategory"]] = None, + criteria: Optional[Union[str, "AlertCriteria"]] = None, **kwargs ): super(AlertPropertiesDefinition, self).__init__(**kwargs) @@ -179,8 +188,9 @@ def __init__( class AlertPropertiesDetails(msrest.serialization.Model): """Alert details. - :param time_grain_type: Type of timegrain cadence. - :type time_grain_type: str + :param time_grain_type: Type of timegrain cadence. Possible values include: "None", "Monthly", + "Quarterly", "Annually", "BillingMonth", "BillingQuarter", "BillingAnnual". + :type time_grain_type: str or ~cost_management_client.models.AlertTimeGrainType :param period_start_date: datetime of periodStartDate. :type period_start_date: str :param triggered_by: notificationId that triggered this alert. @@ -195,8 +205,9 @@ class AlertPropertiesDetails(msrest.serialization.Model): :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 operator: operator used to compare currentSpend with amount. Possible values include: + "None", "EqualTo", "GreaterThan", "GreaterThanOrEqualTo", "LessThan", "LessThanOrEqualTo". + :type operator: str or ~cost_management_client.models.AlertOperator :param amount: budget threshold amount. :type amount: float :param unit: unit of currency being used. @@ -235,7 +246,7 @@ class AlertPropertiesDetails(msrest.serialization.Model): def __init__( self, *, - time_grain_type: Optional[str] = None, + time_grain_type: Optional[Union[str, "AlertTimeGrainType"]] = None, period_start_date: Optional[str] = None, triggered_by: Optional[str] = None, resource_group_filter: Optional[List[object]] = None, @@ -243,7 +254,7 @@ def __init__( meter_filter: Optional[List[object]] = None, tag_filter: Optional[object] = None, threshold: Optional[float] = None, - operator: Optional[str] = None, + operator: Optional[Union[str, "AlertOperator"]] = None, amount: Optional[float] = None, unit: Optional[str] = None, current_spend: Optional[float] = None, @@ -278,7 +289,7 @@ class AlertsResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.Alert] :ivar next_link: URL to get the next set of alerts results if there are any. :vartype next_link: str """ @@ -302,89 +313,101 @@ def __init__( self.next_link = None +class CacheItem(msrest.serialization.Model): + """CacheItem. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID used by Resource Manager to uniquely identify the scope. + :type id: str + :param name: Required. Display name for the scope. + :type name: str + :param channel: Required. Indicates the account type. Allowed values include: EA, PAYG, Modern, + Internal, Unknown. + :type channel: str + :param subchannel: Required. Indicates the type of modern account. Allowed values include: + Individual, Enterprise, Partner, Indirect, NotApplicable. + :type subchannel: str + :param parent: Resource ID of the parent scope. For instance, subscription's resource ID for a + resource group or a management group resource ID for a subscription. + :type parent: str + :param status: Indicates the status of the scope. Status only applies to subscriptions and + billing accounts. + :type status: str + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'channel': {'required': True}, + 'subchannel': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'channel': {'key': 'channel', 'type': 'str'}, + 'subchannel': {'key': 'subchannel', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + name: str, + channel: str, + subchannel: str, + parent: Optional[str] = None, + status: Optional[str] = None, + **kwargs + ): + super(CacheItem, self).__init__(**kwargs) + self.id = id + self.name = name + self.channel = channel + self.subchannel = subchannel + self.parent = parent + self.status = status + + class CommonExportProperties(msrest.serialization.Model): """The common properties of the export. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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 format: The format of the export being delivered. Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~cost_management_client.models.ExportDeliveryInfo + :param definition: Required. Has definition for the export. + :type definition: ~cost_management_client.models.ExportDefinition """ _validation = { - 'format': {'constant': True}, - 'type': {'required': True}, - 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, - 'destination': {'required': True}, + 'delivery_info': {'required': True}, + 'definition': {'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'}, + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, } - 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, + delivery_info: "ExportDeliveryInfo", + definition: "ExportDefinition", + format: Optional[Union[str, "FormatType"]] = 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 + self.format = format + self.delivery_info = delivery_info + self.definition = definition class Dimension(Resource): @@ -475,7 +498,7 @@ class DimensionsListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.Dimension] """ _validation = { @@ -494,6 +517,78 @@ def __init__( self.value = None +class DismissAlertPayload(msrest.serialization.Model): + """The request payload to update an alert. + + :param definition: defines the type of alert. + :type definition: ~cost_management_client.models.AlertPropertiesDefinition + :param description: Alert description. + :type description: str + :param source: Source of alert. Possible values include: "Preset", "User". + :type source: str or ~cost_management_client.models.AlertSource + :param details: Alert details. + :type details: ~cost_management_client.models.AlertPropertiesDetails + :param cost_entity_id: related budget. + :type cost_entity_id: str + :param status: alert status. Possible values include: "None", "Active", "Overridden", + "Resolved", "Dismissed". + :type status: str or ~cost_management_client.models.AlertStatus + :param creation_time: dateTime in which alert was created. + :type creation_time: str + :param close_time: dateTime in which alert was closed. + :type close_time: str + :param modification_time: dateTime in which alert was last modified. + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was last modified. + :type status_modification_time: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__( + self, + *, + definition: Optional["AlertPropertiesDefinition"] = None, + description: Optional[str] = None, + source: Optional[Union[str, "AlertSource"]] = None, + details: Optional["AlertPropertiesDetails"] = None, + cost_entity_id: Optional[str] = None, + status: Optional[Union[str, "AlertStatus"]] = 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(DismissAlertPayload, self).__init__(**kwargs) + self.definition = definition + self.description = description + self.source = source + self.details = details + self.cost_entity_id = cost_entity_id + self.status = status + self.creation_time = creation_time + self.close_time = close_time + self.modification_time = modification_time + self.status_modification_user_name = status_modification_user_name + self.status_modification_time = status_modification_time + + class ErrorDetails(msrest.serialization.Model): """The details of the error. @@ -525,18 +620,19 @@ def __init__( 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. + """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: -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. +* + 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 + :type error: ~cost_management_client.models.ErrorDetails """ _attribute_map = { @@ -609,51 +705,20 @@ class Export(ProxyResource): :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. :type e_tag: str - :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 + :param format: The format of the export being delivered. Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param delivery_info: Has delivery information for the export. + :type delivery_info: ~cost_management_client.models.ExportDeliveryInfo + :param definition: Has definition for the export. + :type definition: ~cost_management_client.models.ExportDefinition + :param schedule: Has schedule information for the export. + :type schedule: ~cost_management_client.models.ExportSchedule """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'format': {'constant': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, } _attribute_map = { @@ -662,52 +727,72 @@ class Export(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'e_tag': {'key': 'eTag', '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" + 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, + } def __init__( self, *, e_tag: Optional[str] = None, - 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, + format: Optional[Union[str, "FormatType"]] = None, + delivery_info: Optional["ExportDeliveryInfo"] = None, + definition: Optional["ExportDefinition"] = None, + schedule: Optional["ExportSchedule"] = None, **kwargs ): super(Export, self).__init__(e_tag=e_tag, **kwargs) - self.type_properties_definition_type = type_properties_definition_type + self.format = format + self.delivery_info = delivery_info + self.definition = definition + self.schedule = schedule + + +class ExportDefinition(msrest.serialization.Model): + """The definition of a query. + + 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 ~cost_management_client.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 ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param data_set: Has definition for data in this query. + :type data_set: ~cost_management_client.models.QueryDatasetautogenerated + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'QueryDatasetautogenerated'}, + } + + def __init__( + self, + *, + type: Union[str, "ExportType"], + timeframe: Union[str, "TimeframeType"], + time_period: Optional["QueryTimePeriod"] = None, + data_set: Optional["QueryDatasetautogenerated"] = None, + **kwargs + ): + super(ExportDefinition, 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 - self.status = status - self.recurrence = recurrence - self.recurrence_period = recurrence_period + self.data_set = data_set class ExportDeliveryDestination(msrest.serialization.Model): @@ -749,6 +834,33 @@ def __init__( self.root_folder_path = root_folder_path +class ExportDeliveryInfo(msrest.serialization.Model): + """The delivery information associated with a export. + + All required parameters must be populated in order to send to Azure. + + :param destination: Required. Has destination for the export being delivered. + :type destination: ~cost_management_client.models.ExportDeliveryDestination + """ + + _validation = { + 'destination': {'required': True}, + } + + _attribute_map = { + 'destination': {'key': 'destination', 'type': 'ExportDeliveryDestination'}, + } + + def __init__( + self, + *, + destination: "ExportDeliveryDestination", + **kwargs + ): + super(ExportDeliveryInfo, self).__init__(**kwargs) + self.destination = destination + + class ExportExecution(Resource): """A export execution. @@ -764,10 +876,10 @@ class ExportExecution(Resource): :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 + :type execution_type: str or ~cost_management_client.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 + :type status: str or ~cost_management_client.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 @@ -780,7 +892,7 @@ class ExportExecution(Resource): :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 + :type run_settings: ~cost_management_client.models.CommonExportProperties """ _validation = { @@ -835,7 +947,7 @@ class ExportExecutionListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.ExportExecution] """ _validation = { @@ -860,7 +972,7 @@ class ExportListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.Export] """ _validation = { @@ -882,96 +994,41 @@ def __init__( class ExportProperties(CommonExportProperties): """The properties of the export. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :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 + :param format: The format of the export being delivered. Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~cost_management_client.models.ExportDeliveryInfo + :param definition: Required. Has definition for the export. + :type definition: ~cost_management_client.models.ExportDefinition + :param schedule: Has schedule information for the export. + :type schedule: ~cost_management_client.models.ExportSchedule """ _validation = { - 'format': {'constant': True}, - 'type': {'required': True}, - 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, - 'destination': {'required': True}, + 'delivery_info': {'required': True}, + 'definition': {'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" + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + 'schedule': {'key': 'schedule', 'type': 'ExportSchedule'}, + } 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, + delivery_info: "ExportDeliveryInfo", + definition: "ExportDefinition", + format: Optional[Union[str, "FormatType"]] = None, + schedule: Optional["ExportSchedule"] = 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 + super(ExportProperties, self).__init__(format=format, delivery_info=delivery_info, definition=definition, **kwargs) + self.schedule = schedule class ExportRecurrencePeriod(msrest.serialization.Model): @@ -1006,95 +1063,108 @@ def __init__( self.to = to +class ExportSchedule(msrest.serialization.Model): + """The schedule associated with a export. + + All required parameters must be populated in order to send to Azure. + + :param status: The status of the schedule. Whether active or not. If inactive, the export's + scheduled execution is paused. Possible values include: "Active", "Inactive". + :type status: str or ~cost_management_client.models.StatusType + :param recurrence: Required. The schedule recurrence. Possible values include: "Daily", + "Weekly", "Monthly", "Annually". + :type recurrence: str or ~cost_management_client.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: ~cost_management_client.models.ExportRecurrencePeriod + """ + + _validation = { + 'recurrence': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'recurrence': {'key': 'recurrence', 'type': 'str'}, + 'recurrence_period': {'key': 'recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, + } + + def __init__( + self, + *, + recurrence: Union[str, "RecurrenceType"], + status: Optional[Union[str, "StatusType"]] = None, + recurrence_period: Optional["ExportRecurrencePeriod"] = None, + **kwargs + ): + super(ExportSchedule, self).__init__(**kwargs) + self.status = status + self.recurrence = recurrence + self.recurrence_period = recurrence_period + + 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 + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.models.ForecastTimeframeType :param time_period: Has time period for pulling data for the forecast. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param dataset: Required. Has definition for data in this forecast. + :type dataset: ~cost_management_client.models.QueryDataset :param include_actual_cost: a boolean determining if actualCost will be included. - :type include_actual_cost: bool - :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. - :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 + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. + :type include_fresh_partial_cost: bool """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, + 'dataset': {'required': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, '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"], + dataset: "QueryDataset", 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.dataset = dataset 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 + :type type: str or ~cost_management_client.models.KpiType :param id: ID of resource related to metric (budget). :type id: str :param enabled: show the KPI in the UI?. @@ -1129,7 +1199,7 @@ class Operation(msrest.serialization.Model): :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 + :type display: ~cost_management_client.models.OperationDisplay """ _validation = { @@ -1194,7 +1264,7 @@ class OperationListResult(msrest.serialization.Model): :ivar value: List of cost management operations supported by the Microsoft.CostManagement resource provider. - :vartype value: list[~azure.mgmt.costmanagement.models.Operation] + :vartype value: list[~cost_management_client.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1218,11 +1288,42 @@ def __init__( self.next_link = None +class OperationStatus(msrest.serialization.Model): + """The status of the long running operation. + + :param status: The status of the long running operation. + :type status: ~cost_management_client.models.Status + :param report_url: The URL to download the generated report. + :type report_url: str + :param valid_until: The time at which report URL becomes invalid. + :type valid_until: ~datetime.datetime + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'Status'}, + 'report_url': {'key': 'properties.reportUrl', 'type': 'str'}, + 'valid_until': {'key': 'properties.validUntil', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + status: Optional["Status"] = None, + report_url: Optional[str] = None, + valid_until: Optional[datetime.datetime] = None, + **kwargs + ): + super(OperationStatus, self).__init__(**kwargs) + self.status = status + self.report_url = report_url + self.valid_until = valid_until + + class PivotProperties(msrest.serialization.Model): """Each pivot must contain a 'type' and 'name'. :param type: Data type to show in view. Possible values include: "Dimension", "TagKey". - :type type: str or ~azure.mgmt.costmanagement.models.PivotType + :type type: str or ~cost_management_client.models.PivotType :param name: Data field to show in view. :type name: str """ @@ -1244,22 +1345,61 @@ def __init__( self.name = name -class QueryAggregation(msrest.serialization.Model): - """The aggregation expression to be used in the query. +class ProxySettingResource(msrest.serialization.Model): + """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxySettingResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.kind = None + self.type = None + + +class QueryAggregation(msrest.serialization.Model): + """The aggregation expression to be used in the query. + 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 + :param function: Required. The name of the aggregation function to use. Possible values + include: "Avg", "Max", "Min", "Sum". + :type function: str or ~cost_management_client.models.FunctionType """ _validation = { 'name': {'required': True}, - 'function': {'required': True, 'constant': True}, + 'function': {'required': True}, } _attribute_map = { @@ -1267,16 +1407,16 @@ class QueryAggregation(msrest.serialization.Model): 'function': {'key': 'function', 'type': 'str'}, } - function = "Sum" - def __init__( self, *, name: str, + function: Union[str, "FunctionType"], **kwargs ): super(QueryAggregation, self).__init__(**kwargs) self.name = name + self.function = function class QueryColumn(msrest.serialization.Model): @@ -1314,7 +1454,7 @@ class QueryComparisonExpression(msrest.serialization.Model): :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 + :type operator: str or ~cost_management_client.models.OperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1345,6 +1485,106 @@ def __init__( self.values = values +class QueryDataset(msrest.serialization.Model): + """The definition of data present in the query. + + :param granularity: The granularity of rows in the query. Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: Has configuration information for the data in the export. The + configuration will be ignored if aggregation and grouping are provided. + :type configuration: ~cost_management_client.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, ~cost_management_client.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[~cost_management_client.models.QueryGrouping] + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. + :type filter: ~cost_management_client.models.QueryFilter + """ + + _validation = { + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'filter', 'type': 'QueryFilter'}, + } + + def __init__( + self, + *, + granularity: Optional[Union[str, "GranularityType"]] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["QueryFilter"] = None, + **kwargs + ): + super(QueryDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.filter = filter + + +class QueryDatasetautogenerated(msrest.serialization.Model): + """The definition of data present in the query. + + :param granularity: The granularity of rows in the query. Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: Has configuration information for the data in the export. The + configuration will be ignored if aggregation and grouping are provided. + :type configuration: ~cost_management_client.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, ~cost_management_client.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[~cost_management_client.models.QueryGrouping] + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. + :type filter: ~cost_management_client.models.QueryFilterautogenerated + """ + + _validation = { + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'filter', 'type': 'QueryFilterautogenerated'}, + } + + def __init__( + self, + *, + granularity: Optional[Union[str, "GranularityType"]] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["QueryFilterautogenerated"] = None, + **kwargs + ): + super(QueryDatasetautogenerated, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.filter = filter + + class QueryDatasetConfiguration(msrest.serialization.Model): """The configuration of dataset in the query. @@ -1370,90 +1610,61 @@ def __init__( 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 + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param dataset: Required. Has definition for data in this query. + :type dataset: ~cost_management_client.models.QueryDataset """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, + 'dataset': {'required': True}, } _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'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, } - granularity = "Daily" - def __init__( self, *, type: Union[str, "ExportType"], timeframe: Union[str, "TimeframeType"], + dataset: "QueryDataset", 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 + self.dataset = dataset 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] + :type and_property: list[~cost_management_client.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 + :type or_property: list[~cost_management_client.models.QueryFilter] + :param dimensions: Has comparison expression for a dimension. + :type dimensions: ~cost_management_client.models.QueryComparisonExpression + :param tags: A set of tags. Has comparison expression for a tag. + :type tags: ~cost_management_client.models.QueryComparisonExpression """ _validation = { @@ -1464,9 +1675,8 @@ class QueryFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'not_property': {'key': 'not', 'type': 'QueryFilter'}, - 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, } def __init__( @@ -1474,17 +1684,56 @@ def __init__( *, and_property: Optional[List["QueryFilter"]] = None, or_property: Optional[List["QueryFilter"]] = None, - not_property: Optional["QueryFilter"] = None, - dimension: Optional["QueryComparisonExpression"] = None, - tag: Optional["QueryComparisonExpression"] = None, + dimensions: Optional["QueryComparisonExpression"] = None, + tags: Optional["QueryComparisonExpression"] = None, **kwargs ): super(QueryFilter, self).__init__(**kwargs) self.and_property = and_property self.or_property = or_property - self.not_property = not_property - self.dimension = dimension - self.tag = tag + self.dimensions = dimensions + self.tags = tags + + +class QueryFilterautogenerated(msrest.serialization.Model): + """The filter expression to be used in the export. + + :param and_property: The logical "AND" expression. Must have at least 2 items. + :type and_property: list[~cost_management_client.models.QueryFilterautogenerated] + :param or_property: The logical "OR" expression. Must have at least 2 items. + :type or_property: list[~cost_management_client.models.QueryFilterautogenerated] + :param dimensions: Has comparison expression for a dimension. + :type dimensions: ~cost_management_client.models.QueryComparisonExpression + :param tags: A set of tags. Has comparison expression for a tag. + :type tags: ~cost_management_client.models.QueryComparisonExpression + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _attribute_map = { + 'and_property': {'key': 'and', 'type': '[QueryFilterautogenerated]'}, + 'or_property': {'key': 'or', 'type': '[QueryFilterautogenerated]'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, + } + + def __init__( + self, + *, + and_property: Optional[List["QueryFilterautogenerated"]] = None, + or_property: Optional[List["QueryFilterautogenerated"]] = None, + dimensions: Optional["QueryComparisonExpression"] = None, + tags: Optional["QueryComparisonExpression"] = None, + **kwargs + ): + super(QueryFilterautogenerated, self).__init__(**kwargs) + self.and_property = and_property + self.or_property = or_property + self.dimensions = dimensions + self.tags = tags class QueryGrouping(msrest.serialization.Model): @@ -1494,7 +1743,7 @@ class QueryGrouping(msrest.serialization.Model): :param type: Required. Has type of the column to group. Possible values include: "Tag", "Dimension". - :type type: str or ~azure.mgmt.costmanagement.models.QueryColumnType + :type type: str or ~cost_management_client.models.QueryColumnType :param name: Required. The name of the column to group. :type name: str """ @@ -1534,10 +1783,17 @@ class QueryResult(Resource): :vartype type: str :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :ivar location: Resource location. + :vartype location: str + :ivar sku: Resource SKU. + :vartype sku: str :param next_link: The link (url) to the next page of results. :type next_link: str :param columns: Array of columns. - :type columns: list[~azure.mgmt.costmanagement.models.QueryColumn] + :type columns: list[~cost_management_client.models.QueryColumn] :param rows: Array of rows. :type rows: list[list[object]] """ @@ -1547,6 +1803,8 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, + 'location': {'readonly': True}, + 'sku': {'readonly': True}, } _attribute_map = { @@ -1554,6 +1812,9 @@ class QueryResult(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, @@ -1562,12 +1823,16 @@ class QueryResult(Resource): def __init__( self, *, + e_tag: Optional[str] = None, next_link: Optional[str] = None, columns: Optional[List["QueryColumn"]] = None, rows: Optional[List[List[object]]] = None, **kwargs ): super(QueryResult, self).__init__(**kwargs) + self.e_tag = e_tag + self.location = None + self.sku = None self.next_link = next_link self.columns = columns self.rows = rows @@ -1609,19 +1874,18 @@ def __init__( 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 + :param function: Required. The name of the aggregation function to use. Possible values + include: "Avg", "Max", "Min", "Sum". + :type function: str or ~cost_management_client.models.FunctionType """ _validation = { 'name': {'required': True}, - 'function': {'required': True, 'constant': True}, + 'function': {'required': True}, } _attribute_map = { @@ -1629,16 +1893,16 @@ class ReportConfigAggregation(msrest.serialization.Model): 'function': {'key': 'function', 'type': 'str'}, } - function = "Sum" - def __init__( self, *, name: str, + function: Union[str, "FunctionType"], **kwargs ): super(ReportConfigAggregation, self).__init__(**kwargs) self.name = name + self.function = function class ReportConfigComparisonExpression(msrest.serialization.Model): @@ -1650,7 +1914,7 @@ class ReportConfigComparisonExpression(msrest.serialization.Model): :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 + :type operator: str or ~cost_management_client.models.OperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1686,21 +1950,21 @@ class ReportConfigDataset(msrest.serialization.Model): :param granularity: The granularity of rows in the report. Possible values include: "Daily", "Monthly". - :type granularity: str or ~azure.mgmt.costmanagement.models.ReportGranularityType + :type granularity: str or ~cost_management_client.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 + :type configuration: ~cost_management_client.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] + :type aggregation: dict[str, ~cost_management_client.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] + :type grouping: list[~cost_management_client.models.ReportConfigGrouping] :param sorting: Array of order by expression to use in the report. - :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] + :type sorting: list[~cost_management_client.models.ReportConfigSorting] :param filter: Has filter expression to use in the report. - :type filter: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :type filter: ~cost_management_client.models.ReportConfigFilter """ _validation = { @@ -1762,15 +2026,17 @@ 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] + :type and_property: list[~cost_management_client.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 + :type or_property: list[~cost_management_client.models.ReportConfigFilter] + :param dimensions: Has comparison expression for a dimension. + :type dimensions: ~cost_management_client.models.ReportConfigComparisonExpression + :param tags: A set of tags. Has comparison expression for a tag. + :type tags: ~cost_management_client.models.ReportConfigComparisonExpression + :param tag_key: Has comparison expression for a tag key. + :type tag_key: ~cost_management_client.models.ReportConfigComparisonExpression + :param tag_value: Has comparison expression for a tag value. + :type tag_value: ~cost_management_client.models.ReportConfigComparisonExpression """ _validation = { @@ -1781,9 +2047,10 @@ class ReportConfigFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, - 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, - 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, + 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, + 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, } def __init__( @@ -1791,17 +2058,19 @@ def __init__( *, and_property: Optional[List["ReportConfigFilter"]] = None, or_property: Optional[List["ReportConfigFilter"]] = None, - not_property: Optional["ReportConfigFilter"] = None, - dimension: Optional["ReportConfigComparisonExpression"] = None, - tag: Optional["ReportConfigComparisonExpression"] = None, + dimensions: Optional["ReportConfigComparisonExpression"] = None, + tags: Optional["ReportConfigComparisonExpression"] = None, + tag_key: Optional["ReportConfigComparisonExpression"] = None, + tag_value: Optional["ReportConfigComparisonExpression"] = None, **kwargs ): super(ReportConfigFilter, self).__init__(**kwargs) self.and_property = and_property self.or_property = or_property - self.not_property = not_property - self.dimension = dimension - self.tag = tag + self.dimensions = dimensions + self.tags = tags + self.tag_key = tag_key + self.tag_value = tag_value class ReportConfigGrouping(msrest.serialization.Model): @@ -1811,7 +2080,7 @@ class ReportConfigGrouping(msrest.serialization.Model): :param type: Required. Has type of the column to group. Possible values include: "Tag", "Dimension". - :type type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :type type: str or ~cost_management_client.models.ReportConfigColumnType :param name: Required. The name of the column to group. This version supports subscription lowest possible grain. :type name: str @@ -1845,7 +2114,7 @@ class ReportConfigSorting(msrest.serialization.Model): 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 + :type direction: str or ~cost_management_client.models.ReportConfigSortingDirection :param name: Required. The name of the column to sort. :type name: str """ @@ -1904,6 +2173,113 @@ def __init__( self.to = to +class Setting(ProxySettingResource): + """State of the myscope setting. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar kind: Resource kind. + :vartype kind: str + :ivar type: Resource type. + :vartype type: str + :param scope: Sets the default scope the current user will see when they sign into Azure Cost + Management in the Azure portal. + :type scope: str + :param start_on: Indicates what scope Cost Management in the Azure portal should default to. + Allowed values: LastUsed. Possible values include: "LastUsed", "ScopePicker", "SpecificScope". + :type start_on: str or ~cost_management_client.models.SettingsPropertiesStartOn + :param cache: Array of scopes with additional details used by Cost Management in the Azure + portal. + :type cache: list[~cost_management_client.models.CacheItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'start_on': {'key': 'properties.startOn', 'type': 'str'}, + 'cache': {'key': 'properties.cache', 'type': '[CacheItem]'}, + } + + def __init__( + self, + *, + scope: Optional[str] = None, + start_on: Optional[Union[str, "SettingsPropertiesStartOn"]] = None, + cache: Optional[List["CacheItem"]] = None, + **kwargs + ): + super(Setting, self).__init__(**kwargs) + self.scope = scope + self.start_on = start_on + self.cache = cache + + +class SettingsListResult(msrest.serialization.Model): + """Result of listing settings. It contains a list of available settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of settings. + :vartype value: list[~cost_management_client.models.Setting] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True, 'max_items': 10, 'min_items': 0}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Setting]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SettingsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Status(msrest.serialization.Model): + """The status of the long running operation. + + :param status: The status of the long running operation. Possible values include: "Running", + "Completed", "Failed". + :type status: str or ~cost_management_client.models.OperationStatusType + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "OperationStatusType"]] = None, + **kwargs + ): + super(Status, self).__init__(**kwargs) + self.status = status + + class View(ProxyResource): """States and configurations of Cost Analysis. @@ -1942,31 +2318,37 @@ class View(ProxyResource): :vartype created_on: ~datetime.datetime :ivar modified_on: Date when the user last modified this view. :vartype modified_on: ~datetime.datetime + :ivar date_range: Selected date range for viewing cost in. + :vartype date_range: str + :ivar currency: Selected currency. + :vartype currency: str :param chart: Chart type of the main view in Cost Analysis. Required. Possible values include: "Area", "Line", "StackedColumn", "GroupedColumn", "Table". - :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :type chart: str or ~cost_management_client.models.ChartType :param accumulated: Show costs accumulated over time. Possible values include: "true", "false". - :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :type accumulated: str or ~cost_management_client.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 + :type metric: str or ~cost_management_client.models.MetricType :param kpis: List of KPIs to show in Cost Analysis UI. - :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :type kpis: list[~cost_management_client.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, + :type pivots: list[~cost_management_client.models.PivotProperties] + :param 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 + data. Actual usage and forecasted data can be differentiated based on dates. Possible values + include: "Usage". + :type type_properties_query_type: str or ~cost_management_client.models.ReportType :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 + :type timeframe: str or ~cost_management_client.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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod + :param data_set: Has definition for data in this report config. + :type data_set: ~cost_management_client.models.ReportConfigDataset + :ivar include_monetary_commitment: Include monetary commitment. + :vartype include_monetary_commitment: bool """ _validation = { @@ -1975,7 +2357,9 @@ class View(ProxyResource): 'type': {'readonly': True}, 'created_on': {'readonly': True}, 'modified_on': {'readonly': True}, - 'type_properties_query_type': {'constant': True}, + 'date_range': {'readonly': True}, + 'currency': {'readonly': True}, + 'include_monetary_commitment': {'readonly': True}, } _attribute_map = { @@ -1987,6 +2371,8 @@ class View(ProxyResource): 'scope': {'key': 'properties.scope', 'type': 'str'}, 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'date_range': {'key': 'properties.dateRange', 'type': 'str'}, + 'currency': {'key': 'properties.currency', 'type': 'str'}, 'chart': {'key': 'properties.chart', 'type': 'str'}, 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, 'metric': {'key': 'properties.metric', 'type': 'str'}, @@ -1995,11 +2381,10 @@ class View(ProxyResource): 'type_properties_query_type': {'key': 'properties.query.type', 'type': 'str'}, 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, - 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, + 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, } - type_properties_query_type = "Usage" - def __init__( self, *, @@ -2011,9 +2396,10 @@ def __init__( metric: Optional[Union[str, "MetricType"]] = None, kpis: Optional[List["KpiProperties"]] = None, pivots: Optional[List["PivotProperties"]] = None, + type_properties_query_type: Optional[Union[str, "ReportType"]] = None, timeframe: Optional[Union[str, "ReportTimeframeType"]] = None, time_period: Optional["ReportConfigTimePeriod"] = None, - dataset: Optional["ReportConfigDataset"] = None, + data_set: Optional["ReportConfigDataset"] = None, **kwargs ): super(View, self).__init__(e_tag=e_tag, **kwargs) @@ -2021,14 +2407,18 @@ def __init__( self.scope = scope self.created_on = None self.modified_on = None + self.date_range = None + self.currency = None self.chart = chart self.accumulated = accumulated self.metric = metric self.kpis = kpis self.pivots = pivots + self.type_properties_query_type = type_properties_query_type self.timeframe = timeframe self.time_period = time_period - self.dataset = dataset + self.data_set = data_set + self.include_monetary_commitment = None class ViewListResult(msrest.serialization.Model): @@ -2037,7 +2427,7 @@ class ViewListResult(msrest.serialization.Model): 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] + :vartype value: list[~cost_management_client.models.View] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py index 6c9a4311b92..c70a4cb564c 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py @@ -6,20 +6,24 @@ # 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 ._settings_operations import SettingsOperations +from ._views_operations import ViewsOperations +from ._alerts_operations import AlertsOperations from ._forecast_operations import ForecastOperations -from ._dimension_operations import DimensionOperations +from ._dimensions_operations import DimensionsOperations from ._query_operations import QueryOperations -from ._export_operations import ExportOperations -from ._operation_operations import OperationOperations +from ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations +from ._operations import Operations +from ._exports_operations import ExportsOperations __all__ = [ - 'ViewOperations', - 'AlertOperations', + 'SettingsOperations', + 'ViewsOperations', + 'AlertsOperations', 'ForecastOperations', - 'DimensionOperations', + 'DimensionsOperations', 'QueryOperations', - 'ExportOperations', - 'OperationOperations', + 'GenerateReservationDetailsReportOperations', + 'Operations', + 'ExportsOperations', ] 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 deleted file mode 100644 index dc1b90de5db..00000000000 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py +++ /dev/null @@ -1,171 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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/_alerts_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alerts_operations.py new file mode 100644 index 00000000000..8cfbdc0f0d0 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alerts_operations.py @@ -0,0 +1,333 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +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 AlertsOperations(object): + """AlertsOperations 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: ~cost_management_client.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: ~cost_management_client.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(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'} # type: ignore + + def get( + self, + scope, # type: str + alert_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Alert" + """Gets the alert for the scope by alert ID. + + :param scope: The scope associated with alerts operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param alert_id: Alert ID. + :type alert_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Alert, or the result of cls(response) + :rtype: ~cost_management_client.models.Alert + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Alert"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Alert', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} # type: ignore + + def dismiss( + self, + scope, # type: str + alert_id, # type: str + parameters, # type: "models.DismissAlertPayload" + **kwargs # type: Any + ): + # type: (...) -> "models.Alert" + """Dismisses the specified alert. + + :param scope: The scope associated with alerts operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param alert_id: Alert ID. + :type alert_id: str + :param parameters: Parameters supplied to the Dismiss Alert operation. + :type parameters: ~cost_management_client.models.DismissAlertPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Alert, or the result of cls(response) + :rtype: ~cost_management_client.models.Alert + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Alert"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.dismiss.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DismissAlertPayload') + body_content_kwargs['content'] = body_content + request = self._client.patch(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('Alert', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + dismiss.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} # type: ignore + + 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 ~cost_management_client.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: ~cost_management_client.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.list_external.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(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'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimensions_operations.py similarity index 56% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimensions_operations.py index aa72450bb03..40af67a3810 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimensions_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -18,19 +18,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class DimensionOperations(object): - """DimensionOperations operations. +class DimensionsOperations(object): + """DimensionsOperations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,76 +54,80 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.DimensionsListResult" + # type: (...) -> Iterable["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. + '/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'. + 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. + 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. + 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 + :return: An iterator like instance of either DimensionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~cost_management_client.models.DimensionsListResultor None] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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) + + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -139,7 +143,7 @@ def get_next(next_link=None): pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: 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) @@ -149,7 +153,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/dimensions'} + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/dimensions'} # type: ignore def by_external_cloud_provider_type( self, @@ -161,67 +165,71 @@ def by_external_cloud_provider_type( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.DimensionsListResult" + # type: (...) -> Iterable["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 + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~cost_management_client.models.ExternalCloudProviderType :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or - '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + '{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'. + 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. + 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. + 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 + :return: An iterator like instance of either DimensionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.by_external_cloud_provider_type.metadata['url'] + url = self.by_external_cloud_provider_type.metadata['url'] # type: ignore 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') + 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) + + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -247,4 +255,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} + by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_exports_operations.py similarity index 75% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_exports_operations.py index b77ce24bc8a..44ef908d120 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_exports_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -17,19 +17,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + 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 ExportOperations(object): - """ExportOperations operations. +class ExportsOperations(object): + """ExportsOperations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -70,16 +70,20 @@ def list( 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 + :return: ExportListResult, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } @@ -91,9 +95,8 @@ def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -106,10 +109,10 @@ def list( deserialized = self._deserialize('ExportListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} # type: ignore def get( self, @@ -140,16 +143,20 @@ def get( :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 + :return: Export, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -162,9 +169,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -177,31 +183,22 @@ def get( deserialized = self._deserialize('Export', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} # type: ignore def create_or_update( self, scope, # type: str export_name, # type: str - e_tag=None, # type: Optional[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"] + parameters, # type: "models.Export" **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. + """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, @@ -222,52 +219,24 @@ def create_or_update( :type scope: str :param export_name: Export Name. :type export_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 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 + :param parameters: Parameters supplied to the CreateOrUpdate Export operation. + :type parameters: ~cost_management_client.models.Export :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 + :return: Export, or the result of cls(response) + :rtype: ~cost_management_client.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(e_tag=e_tag, 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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -281,14 +250,12 @@ def create_or_update( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'Export') + 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 @@ -297,7 +264,6 @@ def create_or_update( 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) @@ -305,10 +271,10 @@ def create_or_update( deserialized = self._deserialize('Export', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} # type: ignore def delete( self, @@ -339,16 +305,20 @@ def delete( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -361,8 +331,8 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -373,9 +343,9 @@ def delete( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + delete.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} # type: ignore def execute( self, @@ -406,16 +376,20 @@ def execute( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.execute.metadata['url'] + url = self.execute.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -428,8 +402,8 @@ def execute( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -440,9 +414,9 @@ def execute( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - execute.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run'} + execute.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run'} # type: ignore def get_execution_history( self, @@ -473,16 +447,20 @@ def get_execution_history( :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 + :return: ExportExecutionListResult, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get_execution_history.metadata['url'] + url = self.get_execution_history.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), 'exportName': self._serialize.url("export_name", export_name, 'str'), @@ -495,9 +473,8 @@ def get_execution_history( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -510,7 +487,7 @@ def get_execution_history( deserialized = self._deserialize('ExportExecutionListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_history.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory'} + get_execution_history.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory'} # type: ignore 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 index 5b97876549e..84468940b59 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_forecast_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_forecast_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -17,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -29,7 +29,7 @@ class ForecastOperations(object): 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,19 +47,11 @@ def __init__(self, client, config, serializer, deserializer): def usage( self, scope, # type: str - type, # type: Union[str, "models.ForecastType"] - timeframe, # type: Union[str, "models.ForecastTimeframeType"] + parameters, # type: "models.ForecastDefinition" 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" + # type: (...) -> Optional["models.QueryResult"] """Lists the forecast charges for scope defined. :param scope: The scope associated with forecast operations. This includes @@ -79,47 +71,28 @@ def usage( '/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 parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. + :type parameters: ~cost_management_client.models.ForecastDefinition :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str - :param 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 + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.models.QueryResult or None :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) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.QueryResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.usage.metadata['url'] + url = self.usage.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } @@ -134,44 +107,36 @@ def usage( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ForecastDefinition') + 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]: + 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) - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} # type: ignore 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"] + parameters, # type: "models.ForecastDefinition" 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" @@ -180,51 +145,32 @@ def external_cloud_provider_usage( :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 + :type external_cloud_provider_type: str or ~cost_management_client.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 parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. + :type parameters: ~cost_management_client.models.ForecastDefinition :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str - :param 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 + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.external_cloud_provider_usage.metadata['url'] + url = self.external_cloud_provider_usage.metadata['url'] # type: ignore 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'), @@ -240,14 +186,12 @@ def external_cloud_provider_usage( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ForecastDefinition') + 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 @@ -259,7 +203,7 @@ def external_cloud_provider_usage( deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} + external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_generate_reservation_details_report_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_generate_reservation_details_report_operations.py new file mode 100644 index 00000000000..92938652c3a --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_generate_reservation_details_report_operations.py @@ -0,0 +1,310 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class GenerateReservationDetailsReportOperations(object): + """GenerateReservationDetailsReportOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~cost_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _by_billing_account_id_initial( + self, + billing_account_id, # type: str + start_date, # type: str + end_date, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self._by_billing_account_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _by_billing_account_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore + + def begin_by_billing_account_id( + self, + billing_account_id, # type: str + start_date, # type: str + end_date, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.OperationStatus"] + """Generates the reservations details report for provided date range asynchronously based on + enrollment id. + + :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). + :type billing_account_id: str + :param start_date: Start Date. + :type start_date: str + :param end_date: End Date. + :type end_date: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~cost_management_client.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._by_billing_account_id_initial( + billing_account_id=billing_account_id, + start_date=start_date, + end_date=end_date, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_by_billing_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore + + def _by_billing_profile_id_initial( + self, + billing_account_id, # type: str + billing_profile_id, # type: str + start_date, # type: str + end_date, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationStatus"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self._by_billing_profile_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') + query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _by_billing_profile_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore + + def begin_by_billing_profile_id( + self, + billing_account_id, # type: str + billing_profile_id, # type: str + start_date, # type: str + end_date, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.OperationStatus"] + """Generates the reservations details report for provided date range asynchronously by billing + profile. + + :param billing_account_id: BillingAccount ID. + :type billing_account_id: str + :param billing_profile_id: BillingProfile ID. + :type billing_profile_id: str + :param start_date: Start Date. + :type start_date: str + :param end_date: End Date. + :type end_date: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatus or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~cost_management_client.models.OperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._by_billing_profile_id_initial( + billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + start_date=start_date, + end_date=end_date, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), + 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_by_billing_profile_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operations.py similarity index 70% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operations.py index 6d83e16b9dc..750c9645f04 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -18,19 +18,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations(object): - """OperationOperations operations. +class Operations(object): + """Operations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,35 +49,39 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.OperationListResult" + # type: (...) -> Iterable["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 + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -103,4 +107,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.CostManagement/operations'} + list.metadata = {'url': '/providers/Microsoft.CostManagement/operations'} # type: ignore 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 index 8443fd8acae..0cc8458e02a 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_query_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_query_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -17,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -29,7 +29,7 @@ class QueryOperations(object): 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,16 +47,10 @@ def __init__(self, client, config, serializer, deserializer): 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"] + parameters, # type: "models.QueryDefinition" **kwargs # type: Any ): - # type: (...) -> "models.QueryResult" + # type: (...) -> Optional["models.QueryResult"] """Query the usage data for scope defined. :param scope: The scope associated with query and export operations. This includes @@ -76,39 +70,24 @@ def usage( '/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 + :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. + :type parameters: ~cost_management_client.models.QueryDefinition :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResult or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.QueryResult + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.models.QueryResult or None :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) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.QueryResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.usage.metadata['url'] + url = self.usage.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), } @@ -121,41 +100,35 @@ def usage( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'QueryDefinition') + 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]: + 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) - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/query'} + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/query'} # type: ignore 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"] + parameters, # type: "models.QueryDefinition" **kwargs # type: Any ): # type: (...) -> "models.QueryResult" @@ -164,43 +137,28 @@ def usage_by_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 + :type external_cloud_provider_type: str or ~cost_management_client.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 + :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. + :type parameters: ~cost_management_client.models.QueryDefinition :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResult or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.QueryResult + :return: QueryResult, or the result of cls(response) + :rtype: ~cost_management_client.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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.usage_by_external_cloud_provider_type.metadata['url'] + url = self.usage_by_external_cloud_provider_type.metadata['url'] # type: ignore 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'), @@ -214,14 +172,12 @@ def usage_by_external_cloud_provider_type( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'QueryDefinition') + 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 @@ -233,7 +189,7 @@ def usage_by_external_cloud_provider_type( deserialized = self._deserialize('QueryResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - usage_by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query'} + usage_by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_settings_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_settings_operations.py new file mode 100644 index 00000000000..4b24cba76ec --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_settings_operations.py @@ -0,0 +1,281 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SettingsOperations(object): + """SettingsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~cost_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SettingsListResult"] + """Lists all of the settings that have been customized. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SettingsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~cost_management_client.models.SettingsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SettingsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SettingsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.CostManagement/settings'} # type: ignore + + def get( + self, + setting_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Setting" + """Retrieves the current value for a specific setting. + + :param setting_name: Name of the setting. Allowed values: myscope. + :type setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Setting, or the result of cls(response) + :rtype: ~cost_management_client.models.Setting + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Setting"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Setting', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore + + def create_or_update( + self, + setting_name, # type: str + parameters, # type: "models.Setting" + **kwargs # type: Any + ): + # type: (...) -> "models.Setting" + """Sets a new value for a specific setting. + + :param setting_name: Name of the setting. Allowed values: myscope. + :type setting_name: str + :param parameters: Body supplied to the CreateOrUpdate setting operation. + :type parameters: ~cost_management_client.models.Setting + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Setting, or the result of cls(response) + :rtype: ~cost_management_client.models.Setting + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Setting"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Setting') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Setting', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore + + def delete( + self, + setting_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove the current value for a specific setting and reverts back to the default value, if + applicable. + + :param setting_name: Name of the setting. Allowed values: myscope. + :type setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_views_operations.py similarity index 62% rename from src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py rename to src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_views_operations.py index bf08f8e37e3..6b807d11110 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_views_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -18,19 +18,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class ViewOperations(object): - """ViewOperations operations. +class ViewsOperations(object): + """ViewsOperations 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 + :type models: ~cost_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,35 +49,39 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.ViewListResult" + # type: (...) -> Iterable["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 + :return: An iterator like instance of either ViewListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~cost_management_client.models.ViewListResultor None] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -93,7 +97,7 @@ def get_next(next_link=None): pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: 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) @@ -103,64 +107,68 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.CostManagement/views'} + list.metadata = {'url': '/providers/Microsoft.CostManagement/views'} # type: ignore def list_by_scope( self, scope, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ViewListResult" + # type: (...) -> Iterable["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. + '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 + :return: An iterator like instance of either ViewListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~cost_management_client.models.ViewListResultor None] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_scope.metadata['url'] + url = self.list_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, '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') + + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -176,7 +184,7 @@ def get_next(next_link=None): pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: 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) @@ -186,7 +194,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} + list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} # type: ignore def get( self, @@ -199,16 +207,20 @@ def get( :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'viewName': self._serialize.url("view_name", view_name, 'str'), } @@ -220,9 +232,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -235,86 +246,42 @@ def get( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore 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"] + parameters, # type: "models.View" **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. + """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 + :param parameters: Parameters supplied to the CreateOrUpdate View operation. + :type parameters: ~cost_management_client.models.View :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { 'viewName': self._serialize.url("view_name", view_name, 'str'), } @@ -327,14 +294,12 @@ def create_or_update( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'View') + 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 @@ -343,7 +308,6 @@ def create_or_update( 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) @@ -351,10 +315,10 @@ def create_or_update( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore def delete( self, @@ -367,16 +331,20 @@ def delete( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'viewName': self._serialize.url("view_name", view_name, 'str'), } @@ -388,8 +356,8 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -400,9 +368,9 @@ def delete( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + delete.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore def get_by_scope( self, @@ -434,16 +402,20 @@ def get_by_scope( :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.get_by_scope.metadata['url'] + url = self.get_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str'), 'viewName': self._serialize.url("view_name", view_name, 'str'), @@ -456,9 +428,8 @@ def get_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -471,30 +442,22 @@ def get_by_scope( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore 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"] + parameters, # type: "models.View" **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. + """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, @@ -516,60 +479,24 @@ def create_or_update_by_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 + :param parameters: Parameters supplied to the CreateOrUpdate View operation. + :type parameters: ~cost_management_client.models.View :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 + :return: View, or the result of cls(response) + :rtype: ~cost_management_client.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) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update_by_scope.metadata['url'] + url = self.create_or_update_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str'), 'viewName': self._serialize.url("view_name", view_name, 'str'), @@ -583,14 +510,12 @@ def create_or_update_by_scope( # 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' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'View') + 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 @@ -599,7 +524,6 @@ def create_or_update_by_scope( 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) @@ -607,10 +531,10 @@ def create_or_update_by_scope( deserialized = self._deserialize('View', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore def delete_by_scope( self, @@ -642,16 +566,20 @@ def delete_by_scope( :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) + :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}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" + accept = "application/json" # Construct URL - url = self.delete_by_scope.metadata['url'] + url = self.delete_by_scope.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str'), 'viewName': self._serialize.url("view_name", view_name, 'str'), @@ -664,8 +592,8 @@ def delete_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # 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 @@ -676,6 +604,6 @@ def delete_by_scope( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} # type: ignore diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/setup.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/setup.py deleted file mode 100644 index 23e053083da..00000000000 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# 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..2b862203f71 --- /dev/null +++ b/src/costmanagement/report.md @@ -0,0 +1,1198 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az costmanagement|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az costmanagement` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az costmanagement setting|Settings|[commands](#CommandsInSettings)| +|az costmanagement view|Views|[commands](#CommandsInViews)| +|az costmanagement alert|Alerts|[commands](#CommandsInAlerts)| +|az costmanagement forecast|Forecast|[commands](#CommandsInForecast)| +|az costmanagement dimension|Dimensions|[commands](#CommandsInDimensions)| +|az costmanagement query|Query|[commands](#CommandsInQuery)| +|az costmanagement generate-reservation-detail-report|GenerateReservationDetailsReport|[commands](#CommandsInGenerateReservationDetailsReport)| +|az costmanagement export|Exports|[commands](#CommandsInExports)| + +## COMMANDS +### Commands in `az costmanagement alert` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement alert list](#AlertsList)|List|[Parameters](#ParametersAlertsList)|[Example](#ExamplesAlertsList)| +|[az costmanagement alert show](#AlertsGet)|Get|[Parameters](#ParametersAlertsGet)|[Example](#ExamplesAlertsGet)| +|[az costmanagement alert dismiss](#AlertsDismiss)|Dismiss|[Parameters](#ParametersAlertsDismiss)|[Example](#ExamplesAlertsDismiss)| +|[az costmanagement alert list-external](#AlertsListExternal)|ListExternal|[Parameters](#ParametersAlertsListExternal)|[Example](#ExamplesAlertsListExternal)| + +### Commands in `az costmanagement dimension` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement dimension list](#DimensionsList)|List|[Parameters](#ParametersDimensionsList)|[Example](#ExamplesDimensionsList)| +|[az costmanagement dimension by-external-cloud-provider-type](#DimensionsByExternalCloudProviderType)|ByExternalCloudProviderType|[Parameters](#ParametersDimensionsByExternalCloudProviderType)|[Example](#ExamplesDimensionsByExternalCloudProviderType)| + +### Commands in `az costmanagement export` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement export list](#ExportsList)|List|[Parameters](#ParametersExportsList)|[Example](#ExamplesExportsList)| +|[az costmanagement export show](#ExportsGet)|Get|[Parameters](#ParametersExportsGet)|[Example](#ExamplesExportsGet)| +|[az costmanagement export create](#ExportsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersExportsCreateOrUpdate#Create)|[Example](#ExamplesExportsCreateOrUpdate#Create)| +|[az costmanagement export update](#ExportsCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersExportsCreateOrUpdate#Update)|Not Found| +|[az costmanagement export delete](#ExportsDelete)|Delete|[Parameters](#ParametersExportsDelete)|[Example](#ExamplesExportsDelete)| +|[az costmanagement export execute](#ExportsExecute)|Execute|[Parameters](#ParametersExportsExecute)|[Example](#ExamplesExportsExecute)| +|[az costmanagement export show-execution-history](#ExportsGetExecutionHistory)|GetExecutionHistory|[Parameters](#ParametersExportsGetExecutionHistory)|[Example](#ExamplesExportsGetExecutionHistory)| + +### Commands in `az costmanagement forecast` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement forecast external-cloud-provider-usage](#ForecastExternalCloudProviderUsage)|ExternalCloudProviderUsage|[Parameters](#ParametersForecastExternalCloudProviderUsage)|[Example](#ExamplesForecastExternalCloudProviderUsage)| +|[az costmanagement forecast usage](#ForecastUsage)|Usage|[Parameters](#ParametersForecastUsage)|[Example](#ExamplesForecastUsage)| + +### Commands in `az costmanagement generate-reservation-detail-report` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement generate-reservation-detail-report by-billing-account-id](#GenerateReservationDetailsReportByBillingAccountId)|ByBillingAccountId|[Parameters](#ParametersGenerateReservationDetailsReportByBillingAccountId)|[Example](#ExamplesGenerateReservationDetailsReportByBillingAccountId)| +|[az costmanagement generate-reservation-detail-report by-billing-profile-id](#GenerateReservationDetailsReportByBillingProfileId)|ByBillingProfileId|[Parameters](#ParametersGenerateReservationDetailsReportByBillingProfileId)|[Example](#ExamplesGenerateReservationDetailsReportByBillingProfileId)| + +### Commands in `az costmanagement query` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement query usage](#QueryUsage)|Usage|[Parameters](#ParametersQueryUsage)|[Example](#ExamplesQueryUsage)| +|[az costmanagement query usage-by-external-cloud-provider-type](#QueryUsageByExternalCloudProviderType)|UsageByExternalCloudProviderType|[Parameters](#ParametersQueryUsageByExternalCloudProviderType)|[Example](#ExamplesQueryUsageByExternalCloudProviderType)| + +### Commands in `az costmanagement setting` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement setting list](#SettingsList)|List|[Parameters](#ParametersSettingsList)|[Example](#ExamplesSettingsList)| +|[az costmanagement setting show](#SettingsGet)|Get|[Parameters](#ParametersSettingsGet)|[Example](#ExamplesSettingsGet)| +|[az costmanagement setting create](#SettingsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersSettingsCreateOrUpdate#Create)|[Example](#ExamplesSettingsCreateOrUpdate#Create)| +|[az costmanagement setting update](#SettingsCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersSettingsCreateOrUpdate#Update)|Not Found| +|[az costmanagement setting delete](#SettingsDelete)|Delete|[Parameters](#ParametersSettingsDelete)|[Example](#ExamplesSettingsDelete)| + +### Commands in `az costmanagement view` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az costmanagement view list](#ViewsListByScope)|ListByScope|[Parameters](#ParametersViewsListByScope)|[Example](#ExamplesViewsListByScope)| +|[az costmanagement view list](#ViewsList)|List|[Parameters](#ParametersViewsList)|[Example](#ExamplesViewsList)| +|[az costmanagement view show](#ViewsGetByScope)|GetByScope|[Parameters](#ParametersViewsGetByScope)|[Example](#ExamplesViewsGetByScope)| +|[az costmanagement view show](#ViewsGet)|Get|[Parameters](#ParametersViewsGet)|[Example](#ExamplesViewsGet)| +|[az costmanagement view create](#ViewsCreateOrUpdateByScope)|CreateOrUpdateByScope|[Parameters](#ParametersViewsCreateOrUpdateByScope)|[Example](#ExamplesViewsCreateOrUpdateByScope)| +|[az costmanagement view create](#ViewsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersViewsCreateOrUpdate#Create)|[Example](#ExamplesViewsCreateOrUpdate#Create)| +|[az costmanagement view update](#ViewsCreateOrUpdate#Update)|CreateOrUpdate#Update|[Parameters](#ParametersViewsCreateOrUpdate#Update)|Not Found| +|[az costmanagement view delete](#ViewsDeleteByScope)|DeleteByScope|[Parameters](#ParametersViewsDeleteByScope)|[Example](#ExamplesViewsDeleteByScope)| +|[az costmanagement view delete](#ViewsDelete)|Delete|[Parameters](#ParametersViewsDelete)|[Example](#ExamplesViewsDelete)| + + +## COMMAND DETAILS + +### group `az costmanagement alert` +#### Command `az costmanagement alert list` + +##### Example +``` +az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789" +``` +##### Example +``` +az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" +``` +##### Example +``` +az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123" +``` +##### Example +``` +az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invo\ +iceSections/9876" +``` +##### Example +``` +az costmanagement alert list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTe\ +st-peer" +``` +##### Example +``` +az costmanagement alert list --scope "subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| + +#### Command `az costmanagement alert show` + +##### Example +``` +az costmanagement alert show --alert-id "22222222-2222-2222-2222-222222222222" --scope "subscriptions/00000000-0000-000\ +0-0000-000000000000/resourceGroups/ScreenSharingTest-peer" +``` +##### Example +``` +az costmanagement alert show --alert-id "22222222-2222-2222-2222-222222222222" --scope "subscriptions/00000000-0000-000\ +0-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--alert-id**|string|Alert ID|alert_id|alertId| + +#### Command `az costmanagement alert dismiss` + +##### Example +``` +az costmanagement alert dismiss --alert-id "22222222-2222-2222-2222-222222222222" --status "Dismissed" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" +``` +##### Example +``` +az costmanagement alert dismiss --alert-id "22222222-2222-2222-2222-222222222222" --status "Dismissed" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--alert-id**|string|Alert ID|alert_id|alertId| +|**--definition**|object|defines the type of alert|definition|definition| +|**--description**|string|Alert description|description|description| +|**--source**|choice|Source of alert|source|source| +|**--cost-entity-id**|string|related budget|cost_entity_id|costEntityId| +|**--status**|choice|alert status|status|status| +|**--creation-time**|string|dateTime in which alert was created|creation_time|creationTime| +|**--close-time**|string|dateTime in which alert was closed|close_time|closeTime| +|**--modification-time**|string|dateTime in which alert was last modified|modification_time|modificationTime| +|**--status-modification-user-name**|string||status_modification_user_name|statusModificationUserName| +|**--status-modification-time**|string|dateTime in which the alert status was last modified|status_modification_time|statusModificationTime| +|**--time-grain-type**|choice|Type of timegrain cadence|time_grain_type|timeGrainType| +|**--period-start-date**|string|datetime of periodStartDate|period_start_date|periodStartDate| +|**--triggered-by**|string|notificationId that triggered this alert|triggered_by|triggeredBy| +|**--resource-group-filter**|array|array of resourceGroups to filter by|resource_group_filter|resourceGroupFilter| +|**--resource-filter**|array|array of resources to filter by|resource_filter|resourceFilter| +|**--meter-filter**|array|array of meters to filter by|meter_filter|meterFilter| +|**--tag-filter**|any|tags to filter by|tag_filter|tagFilter| +|**--threshold**|number|notification threshold percentage as a decimal which activated this alert|threshold|threshold| +|**--operator**|choice|operator used to compare currentSpend with amount|operator|operator| +|**--amount**|number|budget threshold amount|amount|amount| +|**--unit**|string|unit of currency being used|unit|unit| +|**--current-spend**|number|current spend|current_spend|currentSpend| +|**--contact-emails**|array|list of emails to contact|contact_emails|contactEmails| +|**--contact-groups**|array|list of action groups to broadcast to|contact_groups|contactGroups| +|**--contact-roles**|array|list of contact roles|contact_roles|contactRoles| +|**--overriding-alert**|string|overriding alert|overriding_alert|overridingAlert| + +#### Command `az costmanagement alert list-external` + +##### Example +``` +az costmanagement alert list-external --external-cloud-provider-id "100" --external-cloud-provider-type \ +"externalBillingAccounts" +``` +##### Example +``` +az costmanagement alert list-external --external-cloud-provider-id "100" --external-cloud-provider-type \ +"externalSubscriptions" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|externalCloudProviderType| +|**--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|externalCloudProviderId| + +### group `az costmanagement dimension` +#### Command `az costmanagement dimension list` + +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/100" +``` +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing/billingAccount\ +s/100" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing/billingAccount\ +s/12345:6789" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Billing/billingAccounts/100" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Billing/billingAccounts/12345:6789" +``` +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing/billingAccount\ +s/12345:6789/billingProfiles/13579" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" +``` +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing/billingAccount\ +s/12345:6789/customers/5678" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" +``` +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/100/departments/123" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing/billingAccount\ +s/100/departments/123" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123" +``` +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing/billingAccount\ +s/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/\ +invoiceSections/9876" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing/billingAccount\ +s/12345:6789/billingProfiles/13579/invoiceSections/9876" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" +``` +##### Example +``` +az costmanagement dimension list --scope "providers/Microsoft.Management/managementGroups/MyMgId" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Management/managementG\ +roups/MyMgId" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceId\'" --top 5 \ +--scope "providers/Microsoft.Management/managementGroups/MyMgId" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000/resourceGroups/system.orlando" +``` +##### Example +``` +az costmanagement dimension list --expand "properties/data" --top 5 --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|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|$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|$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|$skiptoken| +|**--top**|integer|May be used to limit the number of results to the most recent N dimension data.|top|$top| + +#### Command `az costmanagement dimension by-external-cloud-provider-type` + +##### Example +``` +az costmanagement dimension by-external-cloud-provider-type --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalBillingAccounts" +``` +##### Example +``` +az costmanagement dimension by-external-cloud-provider-type --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalSubscriptions" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|externalCloudProviderType| +|**--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|externalCloudProviderId| +|**--filter**|string|May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'.|filter|$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|$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|$skiptoken| +|**--top**|integer|May be used to limit the number of results to the most recent N dimension data.|top|$top| + +### group `az costmanagement export` +#### Command `az costmanagement export list` + +##### Example +``` +az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/123456" +``` +##### Example +``` +az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/12/departments/123" +``` +##### Example +``` +az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement export list --scope "providers/Microsoft.Management/managementGroups/TestMG" +``` +##### Example +``` +az costmanagement export list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" +``` +##### Example +``` +az costmanagement export list --scope "subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| + +#### Command `az costmanagement export show` + +##### Example +``` +az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/123456" +``` +##### Example +``` +az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/12/departments/1\ +234" +``` +##### Example +``` +az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAc\ +counts/456" +``` +##### Example +``` +az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Management/managementGroups/TestMG" +``` +##### Example +``` +az costmanagement export show --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceG\ +roups/MYDEVTESTRG" +``` +##### Example +``` +az costmanagement export show --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--export-name**|string|Export Name.|export_name|exportName| + +#### Command `az costmanagement export create` + +##### Example +``` +az costmanagement export create --name "TestExport" --type "Usage" --aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxC\ +ost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" columns="MeterId" columns="InstanceId" \ +columns="ResourceLocation" columns="PreTaxCost" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resou\ +rceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Envi\ +ronment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGro\ +up\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --grouping name="SubscriptionName" type="Dimension" \ +--grouping name="Environment" type="Tag" --timeframe "MonthToDate" --destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --recurrence "Weekly" --recurrence-period \ +from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" --scope "providers/Microsoft.Billing/billingAcc\ +ounts/123456" +``` +##### Example +``` +az costmanagement export create --name "TestExport" --type "Usage" --aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxC\ +ost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" columns="MeterId" columns="InstanceId" \ +columns="ResourceLocation" columns="PreTaxCost" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resou\ +rceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Envi\ +ronment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGro\ +up\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --grouping name="SubscriptionName" type="Dimension" \ +--grouping name="Environment" type="Tag" --timeframe "MonthToDate" --destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --recurrence "Weekly" --recurrence-period \ +from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" --scope "providers/Microsoft.Billing/billingAcc\ +ounts/12/departments/1234" +``` +##### Example +``` +az costmanagement export create --name "TestExport" --type "Usage" --aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxC\ +ost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" columns="MeterId" columns="InstanceId" \ +columns="ResourceLocation" columns="PreTaxCost" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resou\ +rceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Envi\ +ronment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGro\ +up\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --grouping name="SubscriptionName" type="Dimension" \ +--grouping name="Environment" type="Tag" --timeframe "MonthToDate" --destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --recurrence "Weekly" --recurrence-period \ +from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" --scope "providers/Microsoft.Billing/billingAcc\ +ounts/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement export create --name "TestExport" --type "Usage" --aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxC\ +ost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" columns="MeterId" columns="InstanceId" \ +columns="ResourceLocation" columns="PreTaxCost" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resou\ +rceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Envi\ +ronment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGro\ +up\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --grouping name="SubscriptionName" type="Dimension" \ +--grouping name="Environment" type="Tag" --timeframe "MonthToDate" --destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --recurrence "Weekly" --recurrence-period \ +from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" --scope "providers/Microsoft.Management/managem\ +entGroups/TestMG" +``` +##### Example +``` +az costmanagement export create --name "TestExport" --type "Usage" --aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxC\ +ost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" columns="MeterId" columns="InstanceId" \ +columns="ResourceLocation" columns="PreTaxCost" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resou\ +rceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Envi\ +ronment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGro\ +up\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --grouping name="SubscriptionName" type="Dimension" \ +--grouping name="Environment" type="Tag" --timeframe "MonthToDate" --destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --recurrence "Weekly" --recurrence-period \ +from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" --scope "subscriptions/00000000-0000-0000-0000-\ +000000000000/resourceGroups/MYDEVTESTRG" +``` +##### Example +``` +az costmanagement export create --name "TestExport" --type "Usage" --aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxC\ +ost\\",\\"function\\":\\"Sum\\"}}" --configuration columns="Date" columns="MeterId" columns="InstanceId" \ +columns="ResourceLocation" columns="PreTaxCost" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resou\ +rceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Envi\ +ronment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGro\ +up\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --grouping name="SubscriptionName" type="Dimension" \ +--grouping name="Environment" type="Tag" --timeframe "MonthToDate" --destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --recurrence "Weekly" --recurrence-period \ +from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --status "Active" --scope "subscriptions/00000000-0000-0000-0000-\ +000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--export-name**|string|Export Name.|export_name|exportName| +|**--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|eTag| +|**--status**|choice|The status of the schedule. Whether active or not. If inactive, the export's scheduled execution is paused.|status|status| +|**--recurrence**|choice|The schedule recurrence.|recurrence|recurrence| +|**--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|recurrencePeriod| +|**--type**|choice|The type of the query.|type|type| +|**--timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--time-period**|object|Has time period for pulling data for the query.|time_period|timePeriod| +|**--configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--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|aggregation| +|**--grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--filter**|object|The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter.|filter|filter| +|**--destination**|object|Has destination for the export being delivered.|destination|destination| + +#### Command `az costmanagement export update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--export-name**|string|Export Name.|export_name|exportName| +|**--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|eTag| +|**--status**|choice|The status of the schedule. Whether active or not. If inactive, the export's scheduled execution is paused.|status|status| +|**--recurrence**|choice|The schedule recurrence.|recurrence|recurrence| +|**--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|recurrencePeriod| +|**--type**|choice|The type of the query.|type|type| +|**--timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--time-period**|object|Has time period for pulling data for the query.|time_period|timePeriod| +|**--configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--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|aggregation| +|**--grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--filter**|object|The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter.|filter|filter| +|**--destination**|object|Has destination for the export being delivered.|destination|destination| + +#### Command `az costmanagement export delete` + +##### Example +``` +az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/123456" +``` +##### Example +``` +az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/12/departments\ +/1234" +``` +##### Example +``` +az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/100/enrollment\ +Accounts/456" +``` +##### Example +``` +az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Management/managementGroups/TestMG" +``` +##### Example +``` +az costmanagement export delete --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourc\ +eGroups/MYDEVTESTRG" +``` +##### Example +``` +az costmanagement export delete --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--export-name**|string|Export Name.|export_name|exportName| + +#### Command `az costmanagement export execute` + +##### Example +``` +az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/123456" +``` +##### Example +``` +az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/12/department\ +s/1234" +``` +##### Example +``` +az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmen\ +tAccounts/456" +``` +##### Example +``` +az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Management/managementGroups/TestMG" +``` +##### Example +``` +az costmanagement export execute --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resour\ +ceGroups/MYDEVTESTRG" +``` +##### Example +``` +az costmanagement export execute --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--export-name**|string|Export Name.|export_name|exportName| + +#### Command `az costmanagement export show-execution-history` + +##### Example +``` +az costmanagement export show-execution-history --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/123456" +``` +##### Example +``` +az costmanagement export show-execution-history --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/12/departments/1234" +``` +##### Example +``` +az costmanagement export show-execution-history --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement export show-execution-history --name "TestExport" --scope "providers/Microsoft.Management/managementG\ +roups/TestMG" +``` +##### Example +``` +az costmanagement export show-execution-history --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000/resourceGroups/MYDEVTESTRG" +``` +##### Example +``` +az costmanagement export show-execution-history --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--export-name**|string|Export Name.|export_name|exportName| + +### group `az costmanagement forecast` +#### Command `az costmanagement forecast external-cloud-provider-usage` + +##### Example +``` +az costmanagement forecast external-cloud-provider-usage --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalBillingAccounts" --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dime\ +nsions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe \ +"MonthToDate" +``` +##### Example +``` +az costmanagement forecast external-cloud-provider-usage --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalSubscriptions" --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimens\ +ions\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe \ +"MonthToDate" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|externalCloudProviderType| +|**--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|externalCloudProviderId| +|**--type**|choice|The type of the forecast.|type|type| +|**--timeframe**|choice|The time frame for pulling data for the forecast. If custom, then a specific time period must be provided.|timeframe|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|$filter| +|**--time-period**|object|Has time period for pulling data for the forecast.|time_period|timePeriod| +|**--include-actual-cost**|boolean|a boolean determining if actualCost will be included|include_actual_cost|includeActualCost| +|**--include-fresh-partial-cost**|boolean|a boolean determining if FreshPartialCost will be included|include_fresh_partial_cost|includeFreshPartialCost| +|**--configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--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|aggregation| +|**--grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--query-filter**|object|The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter.|query_filter|filter| + +#### Command `az costmanagement forecast usage` + +##### Example +``` +az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\\ +"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\ +\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"Reso\ +urceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false \ +--include-fresh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345\ +:6789" +``` +##### Example +``` +az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\\ +"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\ +\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"Reso\ +urceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false \ +--include-fresh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345\ +:6789/billingProfiles/13579" +``` +##### Example +``` +az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\\ +"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\ +\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"Reso\ +urceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false \ +--include-fresh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345\ +:6789/departments/123" +``` +##### Example +``` +az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\\ +"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\ +\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"Reso\ +urceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false \ +--include-fresh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345\ +:6789/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\\ +"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\ +\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"Reso\ +urceGroup\\",\\"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/9876" +``` +##### Example +``` +az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\\ +"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\ +\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"Reso\ +urceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false \ +--include-fresh-partial-cost false --timeframe "MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-00000000000\ +0/resourceGroups/ScreenSharingTest-peer" +``` +##### Example +``` +az costmanagement forecast usage --type "Usage" --query-filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\\ +"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\ +\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"Reso\ +urceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false \ +--include-fresh-partial-cost false --timeframe "MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-00000000000\ +0" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--type**|choice|The type of the forecast.|type|type| +|**--timeframe**|choice|The time frame for pulling data for the forecast. If custom, then a specific time period must be provided.|timeframe|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|$filter| +|**--time-period**|object|Has time period for pulling data for the forecast.|time_period|timePeriod| +|**--include-actual-cost**|boolean|a boolean determining if actualCost will be included|include_actual_cost|includeActualCost| +|**--include-fresh-partial-cost**|boolean|a boolean determining if FreshPartialCost will be included|include_fresh_partial_cost|includeFreshPartialCost| +|**--configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--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|aggregation| +|**--grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--query-filter**|object|The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter.|query_filter|filter| + +### group `az costmanagement generate-reservation-detail-report` +#### Command `az costmanagement generate-reservation-detail-report by-billing-account-id` + +##### Example +``` +az costmanagement generate-reservation-detail-report by-billing-account-id --billing-account-id "9845612" --end-date \ +"2020-01-30" --start-date "2020-01-01" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--billing-account-id**|string|Enrollment ID (Legacy BillingAccount ID)|billing_account_id|billingAccountId| +|**--start-date**|string|Start Date|start_date|startDate| +|**--end-date**|string|End Date|end_date|endDate| + +#### Command `az costmanagement generate-reservation-detail-report by-billing-profile-id` + +##### Example +``` +az costmanagement generate-reservation-detail-report by-billing-profile-id --billing-account-id \ +"00000000-0000-0000-0000-000000000000" --billing-profile-id "CZSFR-SDFXC-DSDF" --end-date "2020-01-30" --start-date \ +"2020-01-01" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--billing-account-id**|string|BillingAccount ID|billing_account_id|billingAccountId| +|**--billing-profile-id**|string|BillingProfile ID|billing_profile_id|billingProfileId| +|**--start-date**|string|Start Date|start_date|startDate| +|**--end-date**|string|End Date|end_date|endDate| + +### group `az costmanagement query` +#### Command `az costmanagement query usage` + +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/70664866" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/70664866" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/departments/123" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/departments/123" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"providers/Microsoft.Management/managementGroups/MyMgId" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"providers/Microsoft.Management/managementGroups/MyMgId" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceType" type="Dimension" --timeframe "TheLastMonth" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\":{\\"name\\":\\"Resource\ +Location\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environ\ +ment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\ +\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Example +``` +az costmanagement query usage --type "Usage" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\\ +":\\"Sum\\"}}" --grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMonth" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--type**|choice|The type of the query.|type|type| +|**--timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--time-period**|object|Has time period for pulling data for the query.|time_period|timePeriod| +|**--configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--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|aggregation| +|**--grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--filter**|object|The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter.|filter|filter| + +#### Command `az costmanagement query usage-by-external-cloud-provider-type` + +##### Example +``` +az costmanagement query usage-by-external-cloud-provider-type --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalBillingAccounts" --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\ +\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe \ +"MonthToDate" +``` +##### Example +``` +az costmanagement query usage-by-external-cloud-provider-type --external-cloud-provider-id "100" \ +--external-cloud-provider-type "externalSubscriptions" --type "Usage" --filter "{\\"and\\":[{\\"or\\":[{\\"dimensions\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West \ +Europe\\"]}},{\\"tags\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},\ +{\\"dimensions\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe \ +"MonthToDate" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|externalCloudProviderType| +|**--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|externalCloudProviderId| +|**--type**|choice|The type of the query.|type|type| +|**--timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--time-period**|object|Has time period for pulling data for the query.|time_period|timePeriod| +|**--configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--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|aggregation| +|**--grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--filter**|object|The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter.|filter|filter| + +### group `az costmanagement setting` +#### Command `az costmanagement setting list` + +##### Example +``` +az costmanagement setting list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az costmanagement setting show` + +##### Example +``` +az costmanagement setting show --name "myscope" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--setting-name**|string|Name of the setting. Allowed values: myscope|setting_name|settingName| + +#### Command `az costmanagement setting create` + +##### Example +``` +az costmanagement setting create --cache name="72f988bf-86f1-41af-91ab-2d7cd011db47" channel="Modern" \ +id="/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47" \ +parent="/providers/Microsoft.Management/managementGroups/acm" status="enabled" subchannel="NotApplicable" --scope \ +"/subscriptions/00000000-0000-0000-0000-000000000000" --start-on "LastUsed" --name "myscope" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--setting-name**|string|Name of the setting. Allowed values: myscope|setting_name|settingName| +|**--scope**|string|Sets the default scope the current user will see when they sign into Azure Cost Management in the Azure portal.|scope|scope| +|**--start-on**|choice|Indicates what scope Cost Management in the Azure portal should default to. Allowed values: LastUsed.|start_on|startOn| +|**--cache**|array|Array of scopes with additional details used by Cost Management in the Azure portal.|cache|cache| + +#### Command `az costmanagement setting update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--setting-name**|string|Name of the setting. Allowed values: myscope|setting_name|settingName| +|**--scope**|string|Sets the default scope the current user will see when they sign into Azure Cost Management in the Azure portal.|scope|scope| +|**--start-on**|choice|Indicates what scope Cost Management in the Azure portal should default to. Allowed values: LastUsed.|start_on|startOn| +|**--cache**|array|Array of scopes with additional details used by Cost Management in the Azure portal.|cache|cache| + +#### Command `az costmanagement setting delete` + +##### Example +``` +az costmanagement setting delete --name "TestSettings" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--setting-name**|string|Name of the setting. Allowed values: myscope|setting_name|settingName| + +### group `az costmanagement view` +#### Command `az costmanagement view list` + +##### Example +``` +az costmanagement view list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| + +#### Command `az costmanagement view list` + +##### Example +``` +az costmanagement view list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az costmanagement view show` + +##### Example +``` +az costmanagement view show --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" \ +--name "swaggerExample" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--view-name**|string|View name|view_name|viewName| + +#### Command `az costmanagement view show` + +##### Example +``` +az costmanagement view show --name "swaggerExample" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az costmanagement view create` + +##### Example +``` +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/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budg\ +ets/swaggerDemo" --metric "ActualCost" --pivots name="ServiceName" type="Dimension" --pivots name="MeterCategory" \ +type="Dimension" --pivots name="swaggerTagKey" type="TagKey" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\ +\\",\\"function\\":\\"Sum\\"}}" --granularity "Daily" --sorting name="UsageDate" direction="Ascending" --timeframe \ +"MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" --name \ +"swaggerExample" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--view-name**|string|View name|view_name|viewName| +|**--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|eTag| +|**--display-name**|string|User input name of the view. Required.|display_name|displayName| +|**--view-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.|view_properties_scope|scope| +|**--chart**|choice|Chart type of the main view in Cost Analysis. Required.|chart|chart| +|**--accumulated**|choice|Show costs accumulated over time.|accumulated|accumulated| +|**--metric**|choice|Metric to use when displaying costs.|metric|metric| +|**--kpis**|array|List of KPIs to show in Cost Analysis UI.|kpis|kpis| +|**--pivots**|array|Configuration of 3 sub-views in the Cost Analysis UI.|pivots|pivots| +|**--timeframe**|choice|The time frame for pulling data for the report. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--time-period**|object|Has time period for pulling data for the report.|time_period|timePeriod| +|**--granularity**|choice|The granularity of rows in the report.|granularity|granularity| +|**--configuration**|object|Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--aggregation**|dictionary|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.|aggregation|aggregation| +|**--grouping**|array|Array of group by expression to use in the report. Report can have up to 2 group by clauses.|grouping|grouping| +|**--sorting**|array|Array of order by expression to use in the report.|sorting|sorting| +|**--filter**|object|Has filter expression to use in the report.|filter|filter| + +#### Command `az costmanagement view create` + +##### Example +``` +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/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budg\ +ets/swaggerDemo" --metric "ActualCost" --pivots name="ServiceName" type="Dimension" --pivots name="MeterCategory" \ +type="Dimension" --pivots name="swaggerTagKey" type="TagKey" --aggregation "{\\"totalCost\\":{\\"name\\":\\"PreTaxCost\ +\\",\\"function\\":\\"Sum\\"}}" --granularity "Daily" --sorting name="UsageDate" direction="Ascending" --timeframe \ +"MonthToDate" --name "swaggerExample" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| + +#### Command `az costmanagement view update` + +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--view-name**|string|View name|view_name|viewName| +|**--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|eTag| +|**--display-name**|string|User input name of the view. Required.|display_name|displayName| +|**--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|scope| +|**--chart**|choice|Chart type of the main view in Cost Analysis. Required.|chart|chart| +|**--accumulated**|choice|Show costs accumulated over time.|accumulated|accumulated| +|**--metric**|choice|Metric to use when displaying costs.|metric|metric| +|**--kpis**|array|List of KPIs to show in Cost Analysis UI.|kpis|kpis| +|**--pivots**|array|Configuration of 3 sub-views in the Cost Analysis UI.|pivots|pivots| +|**--timeframe**|choice|The time frame for pulling data for the report. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--time-period**|object|Has time period for pulling data for the report.|time_period|timePeriod| +|**--granularity**|choice|The granularity of rows in the report.|granularity|granularity| +|**--configuration**|object|Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--aggregation**|dictionary|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.|aggregation|aggregation| +|**--grouping**|array|Array of group by expression to use in the report. Report can have up to 2 group by clauses.|grouping|grouping| +|**--sorting**|array|Array of order by expression to use in the report.|sorting|sorting| +|**--filter**|object|Has filter expression to use in the report.|filter|filter| + +#### Command `az costmanagement view delete` + +##### Example +``` +az costmanagement view delete --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" \ +--name "TestView" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--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|scope| +|**--view-name**|string|View name|view_name|viewName| + +#### Command `az costmanagement view delete` + +##### Example +``` +az costmanagement view delete --name "TestView" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| \ No newline at end of file diff --git a/src/costmanagement/setup.py b/src/costmanagement/setup.py index 2a2f3f7c5f7..2eee2be9a02 100644 --- a/src/costmanagement/setup.py +++ b/src/costmanagement/setup.py @@ -1,52 +1,58 @@ -#!/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.1' - -# 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', - url='https://github.com/Azure/azure-cli-extensions/tree/master/src/costmanagement', - long_description=README + '\n\n' + HISTORY, - license='MIT', - classifiers=CLASSIFIERS, - packages=find_packages(), - install_requires=DEPENDENCIES, - package_data={'azext_costmanagement': ['azext_metadata.json']}, -) +#!/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 + +# HISTORY.rst entry. +VERSION = '0.1.0' +try: + from azext_costmanagement.manual.version import VERSION +except ImportError: + pass + +# 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', +] + +DEPENDENCIES = [] + +try: + from azext_costmanagement.manual.dependency import DEPENDENCIES +except ImportError: + pass + +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', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/costmanagement', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_costmanagement': ['azext_metadata.json']}, +)