diff --git a/src/costmanagement/HISTORY.rst b/src/costmanagement/HISTORY.rst index 27f152061e8..1c139576ba0 100644 --- a/src/costmanagement/HISTORY.rst +++ b/src/costmanagement/HISTORY.rst @@ -1,8 +1,8 @@ -.. :changelog: - -Release History -=============== - -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 7b56fb1e11a..4f48fa652a5 100644 --- a/src/costmanagement/azext_costmanagement/azext_metadata.json +++ b/src/costmanagement/azext_costmanagement/azext_metadata.json @@ -1,4 +1,4 @@ -{ - "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.3.1" +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.11.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..e6a2afda524 100644 --- a/src/costmanagement/azext_costmanagement/generated/_client_factory.py +++ b/src/costmanagement/azext_costmanagement/generated/_client_factory.py @@ -1,41 +1,42 @@ -# -------------------------------------------------------------------------- -# 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 ..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_cl(cli_ctx).view + + +def cf_alert(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).alert + + +def cf_forecast(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).forecast + + +def cf_dimension(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).dimension + + +def cf_query(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).query + + +def cf_export(cli_ctx, *_): + return cf_costmanagement_cl(cli_ctx).export diff --git a/src/costmanagement/azext_costmanagement/generated/_help.py b/src/costmanagement/azext_costmanagement/generated/_help.py index 13440845a57..efcfa3f65a6 100644 --- a/src/costmanagement/azext_costmanagement/generated/_help.py +++ b/src/costmanagement/azext_costmanagement/generated/_help.py @@ -1,782 +1,955 @@ -# -------------------------------------------------------------------------- -# 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 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: 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." + 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: --query-time-period + short-summary: "Has time period for pulling data for the report." + long-summary: | + Usage: --query-time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. + 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" --query-dataset "{\\"aggregation\\":{\\"totalCost\\":{\\"n\ +ame\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}},\\"granularity\\":\\"Daily\\",\\"grouping\\":[],\\"sorting\\":[{\\"n\ +ame\\":\\"UsageDate\\",\\"direction\\":\\"Ascending\\"}]}" --query-timeframe "MonthToDate" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" --name "swaggerExample" +""" + +helps['costmanagement view update'] = """ + 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." + 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: --query-time-period + short-summary: "Has time period for pulling data for the report." + long-summary: | + Usage: --query-time-period from=XX to=XX + + from: Required. The start date to pull data from. + to: Required. The end date to pull data to. +""" + +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" --name "TestView" +""" + +helps['costmanagement view get-by-scope'] = """ + type: command + short-summary: "Gets the view for the defined scope by view name." + examples: + - name: ResourceGroupView + text: |- + az costmanagement view get-by-scope --scope "subscriptions/00000000-0000-0000-0000-000000000000/resource\ +Groups/MYDEVTESTRG" --name "swaggerExample" +""" + +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 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: costmanagement forecast +""" + +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: --dataset-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: --dataset-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. + examples: + - name: ExternalBillingAccountForecast + text: |- + 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\\",\\"operator\\":\\"In\\",\\"values\\":[\\"Ea\ +st 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-cloud-provider-type "externalSubscriptions" --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dime\ +nsion\\":{\\"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." + 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: --dataset-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: --dataset-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. + 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\\":{\\"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" --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\\"]}}]}" \ +--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" --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\\"]}}]}" \ +--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" --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\\"]}}]}" \ +--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" --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\\"]}}]}" \ +--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" --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\\"]}}]}" \ +--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" --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\\"]}}]}" \ +--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: 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 \ +\'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: costmanagement query +""" + +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: --dataset-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: --dataset-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: --dataset-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: --dataset-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 --dataset-grouping argument. + 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 "providers/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 "providers/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 \ +"TheLastMonth" --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 \ +"TheLastMonth" --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 "providers/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 \ +"TheLastMonth" --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 "providers/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 \ +"TheLastMonth" --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 "providers/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 \ +"TheLastMonth" --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 "providers/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 \ +"TheLastMonth" --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 "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987\ +6" + - 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 \ +"TheLastMonth" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/98\ +76" + - 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 "providers/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 \ +"TheLastMonth" --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 "subscriptions/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 "subscriptions/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 \ +"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: --dataset-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: --dataset-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: --dataset-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: --dataset-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 --dataset-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" --dataset-filter \ +"{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"Ea\ +st 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" \ +--external-cloud-provider-type "externalSubscriptions" --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dime\ +nsion\\":{\\"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 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: ExportsGetByBillingAccount + text: |- + az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/123456" + - name: ExportsGetByDepartment + text: |- + az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/12/departments/123" + - name: ExportsGetByEnrollmentAccount + text: |- + az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccount\ +s/456" + - name: ExportsGetByManagementGroup + text: |- + az costmanagement export list --scope "providers/Microsoft.Management/managementGroups/TestMG" + - name: ExportsGetByResourceGroup + text: |- + az costmanagement export list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups\ +/MYDEVTESTRG" + - name: ExportsGetBySubscription + 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: ExportGetByBillingAccount + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/1\ +23456" + - name: ExportGetByDepartment + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/1\ +2/departments/1234" + - name: ExportGetByEnrollmentAccount + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts/1\ +00/enrollmentAccounts/456" + - name: ExportGetByManagementGroup + text: |- + az costmanagement export show --name "TestExport" --scope "providers/Microsoft.Management/managementGrou\ +ps/TestMG" + - name: ExportGetByResourceGroup + text: |- + az costmanagement export show --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000000\ +00000/resourceGroups/MYDEVTESTRG" + - name: ExportGetBySubscription + 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 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." + parameters: + - name: --definition-time-period + short-summary: "Has time period for pulling data for the export." + long-summary: | + Usage: --definition-time-period from=XX to=XX + + from: Required. The start date for export data. + to: Required. The end date for export data. + - name: --definition-data-set-configuration + short-summary: "The export dataset configuration." + long-summary: | + Usage: --definition-data-set-configuration columns=XX + + columns: Array of column names to be included in the export. If not provided then the export will include \ +all available columns. The available columns can vary by customer channel (see examples). + - name: --delivery-info-destination + short-summary: "Has destination for the export being delivered." + long-summary: | + Usage: --delivery-info-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. + - name: --schedule-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: --schedule-recurrence-period from=XX to=XX + + from: Required. The start date of recurrence. + to: The end date of recurrence. + examples: + - name: ExportCreateOrUpdateByBillingAccount + text: |- + az costmanagement export create --name "TestExport" --definition-type "ActualCost" \ +--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" columns="ResourceLocation" \ +columns="Quantity" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" \ +--schedule-recurrence-period from="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" --schedule-status "Active" --scope \ +"providers/Microsoft.Billing/billingAccounts/123456" + - name: ExportCreateOrUpdateByDepartment + text: |- + az costmanagement export create --name "TestExport" --definition-type "ActualCost" \ +--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" columns="ResourceLocation" \ +columns="Quantity" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" \ +--schedule-recurrence-period from="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" --schedule-status "Active" --scope \ +"providers/Microsoft.Billing/billingAccounts/12/departments/1234" + - name: ExportCreateOrUpdateByEnrollmentAccount + text: |- + az costmanagement export create --name "TestExport" --definition-type "ActualCost" \ +--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" columns="ResourceLocation" \ +columns="Quantity" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" \ +--schedule-recurrence-period from="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" --schedule-status "Active" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: ExportCreateOrUpdateByManagementGroup + text: |- + az costmanagement export create --name "TestExport" --definition-type "ActualCost" \ +--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" columns="ResourceLocation" \ +columns="Quantity" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" \ +--schedule-recurrence-period from="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" --schedule-status "Active" --scope \ +"providers/Microsoft.Management/managementGroups/TestMG" + - name: ExportCreateOrUpdateByResourceGroup + text: |- + az costmanagement export create --name "TestExport" --definition-type "ActualCost" \ +--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" columns="ResourceLocation" \ +columns="Quantity" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" \ +--schedule-recurrence-period from="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" --schedule-status "Active" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" + - name: ExportCreateOrUpdateBySubscription + text: |- + az costmanagement export create --name "TestExport" --definition-type "ActualCost" \ +--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" columns="ResourceLocation" \ +columns="Quantity" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" \ +resource-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage\ +/storageAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" \ +--schedule-recurrence-period from="2020-06-01T00:00:00Z" to="2020-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 \ +request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag." + parameters: + - name: --definition-time-period + short-summary: "Has time period for pulling data for the export." + long-summary: | + Usage: --definition-time-period from=XX to=XX + + from: Required. The start date for export data. + to: Required. The end date for export data. + - name: --definition-data-set-configuration + short-summary: "The export dataset configuration." + long-summary: | + Usage: --definition-data-set-configuration columns=XX + + columns: Array of column names to be included in the export. If not provided then the export will include \ +all available columns. The available columns can vary by customer channel (see examples). + - name: --delivery-info-destination + short-summary: "Has destination for the export being delivered." + long-summary: | + Usage: --delivery-info-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. + - name: --schedule-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: --schedule-recurrence-period from=XX to=XX + + from: Required. The start date of recurrence. + to: The end date of recurrence. +""" + +helps['costmanagement export delete'] = """ + type: command + short-summary: "The operation to delete a export." + examples: + - name: ExportDeleteByBillingAccount + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts\ +/123456" + - name: ExportDeleteByDepartment + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts\ +/12/departments/1234" + - name: ExportDeleteByEnrollmentAccount + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Billing/billingAccounts\ +/100/enrollmentAccounts/456" + - name: ExportDeleteByManagementGroup + text: |- + az costmanagement export delete --name "TestExport" --scope "providers/Microsoft.Management/managementGr\ +oups/TestMG" + - name: ExportDeleteByResourceGroup + text: |- + az costmanagement export delete --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-00000\ +0000000/resourceGroups/MYDEVTESTRG" + - name: ExportDeleteBySubscription + 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 an export." + examples: + - name: ExportRunByBillingAccount + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/123456" + - name: ExportRunByDepartment + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/12/departments/1234" + - name: ExportRunByEnrollmentAccount + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Billing/billingAccount\ +s/100/enrollmentAccounts/456" + - name: ExportRunByManagementGroup + text: |- + az costmanagement export execute --name "TestExport" --scope "providers/Microsoft.Management/managementG\ +roups/TestMG" + - name: ExportRunByResourceGroup + text: |- + az costmanagement export execute --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000/resourceGroups/MYDEVTESTRG" + - name: ExportRunBySubscription + text: |- + az costmanagement export execute --name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000" +""" + +helps['costmanagement export get-execution-history'] = """ + type: command + short-summary: "The operation to get the execution history of an export for the defined scope and export name." + examples: + - name: ExportRunHistoryGetByBillingAccount + text: |- + az costmanagement export get-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Billing/billingAccounts/123456" + - name: ExportRunHistoryGetByDepartment + text: |- + az costmanagement export get-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Billing/billingAccounts/12/departments/1234" + - name: ExportRunHistoryGetByEnrollmentAccount + text: |- + az costmanagement export get-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: ExportRunHistoryGetByManagementGroup + text: |- + az costmanagement export get-execution-history --name "TestExport" --scope \ +"providers/Microsoft.Management/managementGroups/TestMG" + - name: ExportRunHistoryGetByResourceGroup + text: |- + az costmanagement export get-execution-history --name "TestExport" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" + - name: ExportRunHistoryGetBySubscription + text: |- + az costmanagement export get-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..98a9a48fc2d 100644 --- a/src/costmanagement/azext_costmanagement/generated/_params.py +++ b/src/costmanagement/azext_costmanagement/generated/_params.py @@ -1,467 +1,596 @@ -# -------------------------------------------------------------------------- -# 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 ( + AddKpis, + AddPivots, + AddQueryTimePeriod, + AddDefinition, + AddTimePeriod, + AddDatasetConfiguration, + AddDatasetGrouping, + AddDefinitionTimePeriod, + AddDefinitionDataSetConfiguration, + AddDeliveryInfoDestination, + AddScheduleRecurrencePeriod +) + + +def load_arguments(self, _): + + 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('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('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('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 ' + 'for the report.') + c.argument('query_dataset', type=validate_file_or_dict, help='Has definition for data in this report config. ' + 'Expected value: json-string/@json-file.') + + 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('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 ' + 'for the report.') + c.argument('query_dataset', type=validate_file_or_dict, 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', 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 get-by-scope') 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('details_time_grain_type', arg_type=get_enum_type(['None', 'Monthly', 'Quarterly', 'Annually', '' + 'BillingMonth', 'BillingQuarter', + 'BillingAnnual']), help='Type of timegrain ' + 'cadence') + c.argument('details_period_start_date', type=str, help='datetime of periodStartDate') + c.argument('details_triggered_by', type=str, help='notificationId that triggered this alert') + c.argument('details_resource_group_filter', type=validate_file_or_dict, help='array of resourceGroups to ' + 'filter by Expected value: json-string/@json-file.') + c.argument('details_resource_filter', type=validate_file_or_dict, help='array of resources to filter by ' + 'Expected value: json-string/@json-file.') + c.argument('details_meter_filter', type=validate_file_or_dict, help='array of meters to filter by Expected ' + 'value: json-string/@json-file.') + c.argument('details_tag_filter', type=validate_file_or_dict, help='tags to filter by Expected value: ' + 'json-string/@json-file.') + c.argument('details_threshold', type=float, help='notification threshold percentage as a decimal which ' + 'activated this alert') + c.argument('details_operator', arg_type=get_enum_type(['None', 'EqualTo', 'GreaterThan', + 'GreaterThanOrEqualTo', 'LessThan', + 'LessThanOrEqualTo']), help='operator used to compare ' + 'currentSpend with amount') + c.argument('details_amount', type=float, help='budget threshold amount') + c.argument('details_unit', type=str, help='unit of currency being used') + c.argument('details_current_spend', type=float, help='current spend') + c.argument('details_contact_emails', nargs='*', help='list of emails to contact') + c.argument('details_contact_groups', nargs='*', help='list of action groups to broadcast to') + c.argument('details_contact_roles', nargs='*', help='list of contact roles') + c.argument('details_overriding_alert', type=str, help='overriding alert') + + 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=AddTimePeriod, 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('dataset_configuration', action=AddDatasetConfiguration, nargs='*', help='Has configuration ' + 'information for the data in the export. The configuration will be ignored if aggregation and ' + 'grouping are provided.') + c.argument('dataset_aggregation', type=validate_file_or_dict, help='Dictionary of aggregation expression to ' + 'use in the forecast. The key of each item in the dictionary is the alias for the aggregated ' + 'column. forecast can have up to 2 aggregation clauses. Expected value: json-string/@json-file.') + c.argument('dataset_filter', type=validate_file_or_dict, help='Has filter expression to use in the forecast. ' + 'Expected value: json-string/@json-file.') + + 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=AddTimePeriod, 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('dataset_configuration', action=AddDatasetConfiguration, nargs='*', help='Has configuration ' + 'information for the data in the export. The configuration will be ignored if aggregation and ' + 'grouping are provided.') + c.argument('dataset_aggregation', type=validate_file_or_dict, help='Dictionary of aggregation expression to ' + 'use in the forecast. The key of each item in the dictionary is the alias for the aggregated ' + 'column. forecast can have up to 2 aggregation clauses. Expected value: json-string/@json-file.') + c.argument('dataset_filter', type=validate_file_or_dict, help='Has filter expression to use in the forecast. ' + 'Expected value: json-string/@json-file.') + + 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=AddTimePeriod, nargs='*', help='Has time period for pulling data for the ' + 'query.') + c.argument('dataset_configuration', action=AddDatasetConfiguration, nargs='*', help='Has configuration ' + 'information for the data in the export. The configuration will be ignored if aggregation and ' + 'grouping are provided.') + c.argument('dataset_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.') + 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.') + c.argument('dataset_filter', type=validate_file_or_dict, help='Has filter expression 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', '' + '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=AddTimePeriod, nargs='*', help='Has time period for pulling data for the ' + 'query.') + c.argument('dataset_configuration', action=AddDatasetConfiguration, nargs='*', help='Has configuration ' + 'information for the data in the export. The configuration will be ignored if aggregation and ' + 'grouping are provided.') + c.argument('dataset_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.') + 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.') + c.argument('dataset_filter', type=validate_file_or_dict, help='Has filter expression to use in the query. ' + 'Expected value: json-string/@json-file.') + + 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.') + c.argument('expand', type=str, help='May be used to expand the properties within an export. Currently only ' + '\'runHistory\' is supported and will return information for the last execution of each export.') + + 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.') + c.argument('expand', type=str, help='May be used to expand the properties within an export. Currently only ' + '\'runHistory\' is supported and will return information for the last 10 executions of the export.') + + 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('definition_type', arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), help='The type ' + 'of the export. Note that \'Usage\' is equivalent to \'ActualCost\' and is applicable to exports ' + 'that do not yet provide data for charges or amortization for service reservations.') + c.argument('definition_timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), + help='The time frame for pulling data for the export. If custom, then a specific time period must ' + 'be provided.') + c.argument('definition_time_period', action=AddDefinitionTimePeriod, nargs='*', help='Has time period for ' + 'pulling data for the export.') + c.argument('definition_data_set_configuration', action=AddDefinitionDataSetConfiguration, nargs='*', help='The ' + 'export dataset configuration.') + c.argument('delivery_info_destination', action=AddDeliveryInfoDestination, nargs='*', help='Has destination ' + 'for the export being delivered.') + c.argument('schedule_status', arg_type=get_enum_type(['Active', 'Inactive']), help='The status of the ' + 'export\'s schedule. If \'Inactive\', the export\'s schedule 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.') + + 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('definition_type', arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), help='The type ' + 'of the export. Note that \'Usage\' is equivalent to \'ActualCost\' and is applicable to exports ' + 'that do not yet provide data for charges or amortization for service reservations.') + c.argument('definition_timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), + help='The time frame for pulling data for the export. If custom, then a specific time period must ' + 'be provided.') + c.argument('definition_time_period', action=AddDefinitionTimePeriod, nargs='*', help='Has time period for ' + 'pulling data for the export.') + c.argument('definition_data_set_configuration', action=AddDefinitionDataSetConfiguration, nargs='*', help='The ' + 'export dataset configuration.') + c.argument('delivery_info_destination', action=AddDeliveryInfoDestination, nargs='*', help='Has destination ' + 'for the export being delivered.') + c.argument('schedule_status', arg_type=get_enum_type(['Active', 'Inactive']), help='The status of the ' + 'export\'s schedule. If \'Inactive\', the export\'s schedule 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.') + + 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 get-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..bc5cccbd2a7 100644 --- a/src/costmanagement/azext_costmanagement/generated/action.py +++ b/src/costmanagement/azext_costmanagement/generated/action.py @@ -1,214 +1,280 @@ -# -------------------------------------------------------------------------- -# 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 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 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] + return d + + +class AddTimePeriod(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.time_period = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'from': + d['from_property'] = v[0] + elif kl == 'to': + d['to'] = v[0] + return d + + +class AddDatasetConfiguration(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.dataset_configuration = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'columns': + d['columns'] = v + return d + + +class AddDatasetGrouping(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddDatasetGrouping, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'type': + d['type'] = v[0] + elif kl == 'name': + d['name'] = v[0] + return d + + +class AddDefinitionTimePeriod(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.definition_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 AddDefinitionDataSetConfiguration(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.definition_data_set_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 AddDeliveryInfoDestination(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.delivery_info_destination = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'resource-id': + d['resource_id'] = v[0] + elif kl == 'container': + d['container'] = v[0] + elif kl == 'root-folder-path': + d['root_folder_path'] = v[0] + return d + + +class AddScheduleRecurrencePeriod(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.schedule_recurrence_period = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'from': + d['from_property'] = v[0] + elif kl == 'to': + d['to'] = v[0] + return d diff --git a/src/costmanagement/azext_costmanagement/generated/commands.py b/src/costmanagement/azext_costmanagement/generated/commands.py index 8a61dbaec20..59788fd1246 100644 --- a/src/costmanagement/azext_costmanagement/generated/commands.py +++ b/src/costmanagement/azext_costmanagement/generated/commands.py @@ -1,83 +1,89 @@ -# -------------------------------------------------------------------------- -# 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_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('update', 'costmanagement_view_update') + g.custom_command('delete', 'costmanagement_view_delete', confirmation=True) + g.custom_command('get-by-scope', 'costmanagement_view_get_by_scope') + + 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_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, + 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', confirmation=True) + g.custom_command('execute', 'costmanagement_export_execute') + g.custom_command('get-execution-history', 'costmanagement_export_get_execution_history') diff --git a/src/costmanagement/azext_costmanagement/generated/custom.py b/src/costmanagement/azext_costmanagement/generated/custom.py index 2c3fce143c8..b15162e9cf8 100644 --- a/src/costmanagement/azext_costmanagement/generated/custom.py +++ b/src/costmanagement/azext_costmanagement/generated/custom.py @@ -1,328 +1,401 @@ -# -------------------------------------------------------------------------- -# 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 + + +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): + return client.get(view_name=view_name) + + +def costmanagement_view_create(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 scope is not None and view_name 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, + type="Usage", + 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, + type="Usage", + timeframe=query_timeframe, + time_period=query_time_period, + dataset=query_dataset) + + +def costmanagement_view_update(client, + view_name, + e_tag=None, + display_name=None, + scope=None, + chart=None, + accumulated=None, + metric=None, + kpis=None, + pivots=None, + query_timeframe=None, + query_time_period=None, + query_dataset=None): + 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, + type="Usage", + timeframe=query_timeframe, + time_period=query_time_period, + dataset=query_dataset) + + +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_view_get_by_scope(client, + scope, + view_name): + return client.get_by_scope(scope=scope, + 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, + details_time_grain_type=None, + details_period_start_date=None, + details_triggered_by=None, + details_resource_group_filter=None, + details_resource_filter=None, + details_meter_filter=None, + details_tag_filter=None, + details_threshold=None, + details_operator=None, + details_amount=None, + details_unit=None, + details_current_spend=None, + details_contact_emails=None, + details_contact_groups=None, + details_contact_roles=None, + details_overriding_alert=None): + return client.dismiss(scope=scope, + alert_id=alert_id, + definition=definition, + description=description, + source=source, + cost_entity_id=cost_entity_id, + status=status, + creation_time=creation_time, + close_time=close_time, + modification_time=modification_time, + status_modification_user_name=status_modification_user_name, + status_modification_time=status_modification_time, + time_grain_type=details_time_grain_type, + period_start_date=details_period_start_date, + triggered_by=details_triggered_by, + resource_group_filter=details_resource_group_filter, + resource_filter=details_resource_filter, + meter_filter=details_meter_filter, + tag_filter=details_tag_filter, + threshold=details_threshold, + operator=details_operator, + amount=details_amount, + unit=details_unit, + current_spend=details_current_spend, + contact_emails=details_contact_emails, + contact_groups=details_contact_groups, + contact_roles=details_contact_roles, + overriding_alert=details_overriding_alert) + + +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, + dataset_configuration=None, + dataset_aggregation=None, + dataset_filter=None): + 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, + granularity="Daily", + configuration=dataset_configuration, + aggregation=dataset_aggregation, + query_filter=dataset_filter) + + +def costmanagement_forecast_usage(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_filter=None): + 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, + granularity="Daily", + configuration=dataset_configuration, + aggregation=dataset_aggregation, + query_filter=dataset_filter) + + +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, + dataset_configuration=None, + dataset_aggregation=None, + dataset_grouping=None, + dataset_filter=None): + return client.usage(scope=scope, + type=type_, + timeframe=timeframe, + time_period=time_period, + granularity="Daily", + configuration=dataset_configuration, + aggregation=dataset_aggregation, + grouping=dataset_grouping, + filter=dataset_filter) + + +def costmanagement_query_usage_by_external_cloud_provider_type(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): + 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, + granularity="Daily", + configuration=dataset_configuration, + aggregation=dataset_aggregation, + grouping=dataset_grouping, + filter=dataset_filter) + + +def costmanagement_export_list(client, + scope, + expand=None): + return client.list(scope=scope, + expand=expand) + + +def costmanagement_export_show(client, + scope, + export_name, + expand=None): + return client.get(scope=scope, + export_name=export_name, + expand=expand) + + +def costmanagement_export_create(client, + scope, + export_name, + e_tag=None, + definition_type=None, + definition_timeframe=None, + definition_time_period=None, + definition_data_set_configuration=None, + delivery_info_destination=None, + schedule_status=None, + schedule_recurrence=None, + schedule_recurrence_period=None): + return client.create_or_update(scope=scope, + export_name=export_name, + e_tag=e_tag, + format="Csv", + run_history=None, + type=definition_type, + timeframe=definition_timeframe, + time_period=definition_time_period, + granularity="Daily", + configuration=definition_data_set_configuration, + destination=delivery_info_destination, + status=schedule_status, + recurrence=schedule_recurrence, + recurrence_period=schedule_recurrence_period) + + +def costmanagement_export_update(client, + scope, + export_name, + e_tag=None, + definition_type=None, + definition_timeframe=None, + definition_time_period=None, + definition_data_set_configuration=None, + delivery_info_destination=None, + schedule_status=None, + schedule_recurrence=None, + schedule_recurrence_period=None): + return client.create_or_update(scope=scope, + export_name=export_name, + e_tag=e_tag, + format="Csv", + run_history=None, + type=definition_type, + timeframe=definition_timeframe, + time_period=definition_time_period, + granularity="Daily", + configuration=definition_data_set_configuration, + destination=delivery_info_destination, + status=schedule_status, + recurrence=schedule_recurrence, + recurrence_period=schedule_recurrence_period) + + +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_get_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..50e0627daff 100644 --- a/src/costmanagement/azext_costmanagement/tests/__init__.py +++ b/src/costmanagement/azext_costmanagement/tests/__init__.py @@ -1,49 +1,114 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -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) + 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) + 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: + 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/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..b4b20efb308 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,1620 @@ -# -------------------------------------------------------------------------- -# 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 .. import try_manual, raise_if, calc_coverage +from azure.cli.testsdk import ResourceGroupPreparer +from azure.cli.testsdk import StorageAccountPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg): + pass + + +# EXAMPLE: /Alerts/get/BillingAccountAlerts +@try_manual +def step__alerts_get_billingaccountalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Alerts/get/BillingProfileAlerts +@try_manual +def step__alerts_get_billingprofilealerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Alerts/get/DepartmentAlerts +@try_manual +def step__alerts_get_departmentalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"', + checks=[]) + + +# EXAMPLE: /Alerts/get/EnrollmentAccountAlerts +@try_manual +def step__alerts_get_enrollmentaccountalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Alerts/get/ExternalBillingAccountAlerts +@try_manual +def step__alerts_get_externalbillingaccountalerts(test, rg): + test.cmd('az costmanagement alert list-external ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts"', + checks=[]) + + +# EXAMPLE: /Alerts/get/ExternalSubscriptionAlerts +@try_manual +def step__alerts_get_externalsubscriptionalerts(test, rg): + test.cmd('az costmanagement alert list-external ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions"', + checks=[]) + + +# EXAMPLE: /Alerts/get/InvoiceSectionAlerts +@try_manual +def step__alerts_get_invoicesectionalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Alerts/get/ResourceGroupAlerts +@try_manual +def step__alerts_get_resourcegroupalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=[]) + + +# EXAMPLE: /Alerts/get/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: /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: /Alerts/patch/ResourceGroupAlerts +@try_manual +def step__alerts_patch_resourcegroupalerts(test, rg): + 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=[]) + + +# EXAMPLE: /Alerts/patch/SubscriptionAlerts +@try_manual +def step__alerts_patch_subscriptionalerts(test, rg): + test.cmd('az costmanagement alert dismiss ' + '--alert-id "22222222-2222-2222-2222-222222222222" ' + '--status "Dismissed" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsList-Legacy +@try_manual +def step__dimensions_get(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_get2(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_get3(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_get4(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_get5(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_get6(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_get7(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_get8(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_get9(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_get10(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_get11(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_get12(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_get13(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_get14(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_get15(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_get16(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_get17(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_get18(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_get19(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_get20(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_get21(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_get22(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_get23(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_get24(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_get25(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_get26(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_get27(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/put/ExportCreateOrUpdateByBillingAccount +@try_manual +def step__exports_put(test, rg): + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--definition-type "ActualCost" ' + '--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" ' + 'columns="ResourceLocation" columns="Quantity" ' + '--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="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", 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" + "}/providers/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", "2020-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2020-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/put/ExportCreateOrUpdateByDepartment +@try_manual +def step__exports_put_exportcreateorupdatebydepartment(test, rg): + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--definition-type "ActualCost" ' + '--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" ' + 'columns="ResourceLocation" columns="Quantity" ' + '--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="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", 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" + "}/providers/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", "2020-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2020-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/put/ExportCreateOrUpdateByEnrollmentAccount +@try_manual +def step__exports_put2(test, rg): + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--definition-type "ActualCost" ' + '--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" ' + 'columns="ResourceLocation" columns="Quantity" ' + '--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="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", 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" + "}/providers/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", "2020-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2020-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/put/ExportCreateOrUpdateByManagementGroup +@try_manual +def step__exports_put3(test, rg): + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--definition-type "ActualCost" ' + '--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" ' + 'columns="ResourceLocation" columns="Quantity" ' + '--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="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", 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" + "}/providers/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", "2020-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2020-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/put/ExportCreateOrUpdateByResourceGroup +@try_manual +def step__exports_put4(test, rg): + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--definition-type "ActualCost" ' + '--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" ' + 'columns="ResourceLocation" columns="Quantity" ' + '--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="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", 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" + "}/providers/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", "2020-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2020-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/put/ExportCreateOrUpdateBySubscription +@try_manual +def step__exports_put5(test, rg): + test.cmd('az costmanagement export create ' + '--name "{myExport}" ' + '--definition-type "ActualCost" ' + '--definition-data-set-configuration columns="Date" columns="MeterId" columns="ResourceId" ' + 'columns="ResourceLocation" columns="Quantity" ' + '--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="2020-06-01T00:00:00Z" to="2020-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", 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" + "}/providers/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", "2020-06-01T00:00:00Z", case_sensitive=False), + test.check("schedule.recurrencePeriod.to", "2020-10-31T00:00:00Z", case_sensitive=False), + test.check("schedule.status", "Active", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/get/ExportGetByBillingAccount +@try_manual +def step__exports_get_exportgetbybillingaccount(test, rg): + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg" + "}/providers/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/get/ExportGetByDepartment +@try_manual +def step__exports_get_exportgetbydepartment(test, rg): + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg" + "}/providers/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/get/ExportGetByEnrollmentAccount +@try_manual +def step__exports_get_exportgetbyenrollmentaccount(test, rg): + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg" + "}/providers/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/get/ExportGetByManagementGroup +@try_manual +def step__exports_get_exportgetbymanagementgroup(test, rg): + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg" + "}/providers/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/get/ExportGetByResourceGroup +@try_manual +def step__exports_get_exportgetbyresourcegroup(test, rg): + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg" + "}/providers/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/get/ExportGetBySubscription +@try_manual +def step__exports_get_exportgetbysubscription(test, rg): + test.cmd('az costmanagement export show ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[ + test.check("name", "{myExport}", case_sensitive=False), + test.check("definition.type", "ActualCost", case_sensitive=False), + test.check("deliveryInfo.destination.container", "exports", case_sensitive=False), + test.check("deliveryInfo.destination.resourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg" + "}/providers/Microsoft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("deliveryInfo.destination.rootFolderPath", "ad-hoc", case_sensitive=False), + ]) + + +# EXAMPLE: /Exports/get/ExportRunHistoryGetByBillingAccount +@try_manual +def step__exports_get(test, rg): + test.cmd('az costmanagement export get-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportRunHistoryGetByDepartment +@try_manual +def step__exports_get_exportrunhistorygetbydepartment(test, rg): + test.cmd('az costmanagement export get-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportRunHistoryGetByEnrollmentAccount +@try_manual +def step__exports_get2(test, rg): + test.cmd('az costmanagement export get-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportRunHistoryGetByManagementGroup +@try_manual +def step__exports_get3(test, rg): + test.cmd('az costmanagement export get-execution-history ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportRunHistoryGetByResourceGroup +@try_manual +def step__exports_get4(test, rg): + test.cmd('az costmanagement export get-execution-history ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportRunHistoryGetBySubscription +@try_manual +def step__exports_get5(test, rg): + test.cmd('az costmanagement export get-execution-history ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportsGetByBillingAccount +@try_manual +def step__exports_get_exportsgetbybillingaccount(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportsGetByDepartment +@try_manual +def step__exports_get_exportsgetbydepartment(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/123"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportsGetByEnrollmentAccount +@try_manual +def step__exports_get_exportsgetbyenrollmentaccount(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportsGetByManagementGroup +@try_manual +def step__exports_get_exportsgetbymanagementgroup(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportsGetByResourceGroup +@try_manual +def step__exports_get_exportsgetbyresourcegroup(test, rg): + test.cmd('az costmanagement export list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ExportsGetBySubscription +@try_manual +def step__exports_get_exportsgetbysubscription(test, rg): + test.cmd('az costmanagement export list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[ + test.check('length(@)', 1), + ]) + + +# EXAMPLE: /Exports/post/ExportRunByBillingAccount +@try_manual +def step__exports_post_exportrunbybillingaccount(test, rg): + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/post/ExportRunByDepartment +@try_manual +def step__exports_post_exportrunbydepartment(test, rg): + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/post/ExportRunByEnrollmentAccount +@try_manual +def step__exports_post_exportrunbyenrollmentaccount(test, rg): + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/post/ExportRunByManagementGroup +@try_manual +def step__exports_post_exportrunbymanagementgroup(test, rg): + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/post/ExportRunByResourceGroup +@try_manual +def step__exports_post_exportrunbyresourcegroup(test, rg): + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/post/ExportRunBySubscription +@try_manual +def step__exports_post_exportrunbysubscription(test, rg): + test.cmd('az costmanagement export execute ' + '--name "{myExport}" ' + '--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(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_post2(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_post3(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_post4(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_post5(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_post6(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=[]) + + +# EXAMPLE: /Query/post/ResourceGroupQuery-Legacy +@try_manual +def step__query_post_resourcegroupquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=[]) + + +# EXAMPLE: /Query/post/ResourceGroupQueryGrouping-Legacy +@try_manual +def step__query_post_resourcegroupquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceType" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=[]) + + +# EXAMPLE: /Query/post/SubscriptionQuery-Legacy +@try_manual +def step__query_post_subscriptionquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Query/post/SubscriptionQueryGrouping-Legacy +@try_manual +def step__query_post_subscriptionquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Views/put/CreateOrUpdatePrivateView +@try_manual +def step__views_put_createorupdateprivateview(test, rg): + test.cmd('az costmanagement view create ' + '--e-tag "\\"1d4ff9fe66f1d10\\"" ' + '--accumulated "true" ' + '--chart "Table" ' + '--display-name "swagger Example" ' + '--kpis type="Forecast" enabled=true id=null ' + '--kpis type="Budget" enabled=true id="/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Micr' + 'osoft.Consumption/budgets/swaggerDemo" ' + '--metric "ActualCost" ' + '--pivots name="ServiceName" type="Dimension" ' + '--pivots name="MeterCategory" type="Dimension" ' + '--pivots name="swaggerTagKey" type="TagKey" ' + '--query-dataset "{{\\"aggregation\\":{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Su' + 'm\\"}}}},\\"granularity\\":\\"Daily\\",\\"grouping\\":[],\\"sorting\\":[{{\\"name\\":\\"UsageDate\\",\\"d' + 'irection\\":\\"Ascending\\"}}]}}" ' + '--query-timeframe "MonthToDate" ' + '--name "{myView}"', + 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.dataset.grouping", []), + test.check("query.dataset.sorting[0].name", "UsageDate", case_sensitive=False), + test.check("query.dataset.sorting[0].direction", "Ascending", case_sensitive=False), + test.check("query.timeframe", "MonthToDate", case_sensitive=False), + test.check("name", "{myView}", case_sensitive=False), + ]) + + +# EXAMPLE: /Views/put/ResourceGroupCreateOrUpdateView +@try_manual +def step__views_put_resourcegroupcreateorupdateview(test, rg): + test.cmd('az costmanagement view create ' + '--e-tag "\\"1d4ff9fe66f1d10\\"" ' + '--accumulated "true" ' + '--chart "Table" ' + '--display-name "swagger Example" ' + '--kpis type="Forecast" enabled=true id=null ' + '--kpis type="Budget" enabled=true id="/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Micr' + 'osoft.Consumption/budgets/swaggerDemo" ' + '--metric "ActualCost" ' + '--pivots name="ServiceName" type="Dimension" ' + '--pivots name="MeterCategory" type="Dimension" ' + '--pivots name="swaggerTagKey" type="TagKey" ' + '--query-dataset "{{\\"aggregation\\":{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Su' + 'm\\"}}}},\\"granularity\\":\\"Daily\\",\\"grouping\\":[],\\"sorting\\":[{{\\"name\\":\\"UsageDate\\",\\"d' + 'irection\\":\\"Ascending\\"}}]}}" ' + '--query-timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--name "{myView}"', + 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.dataset.grouping", []), + test.check("query.dataset.sorting[0].name", "UsageDate", case_sensitive=False), + test.check("query.dataset.sorting[0].direction", "Ascending", case_sensitive=False), + test.check("query.timeframe", "MonthToDate", case_sensitive=False), + test.check("name", "{myView}", case_sensitive=False), + ]) + + +# EXAMPLE: /Views/get/PrivateView +@try_manual +def step__views_get_privateview(test, rg): + test.cmd('az costmanagement view show ' + '--name "{myView}"', + 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.dataset.grouping", []), + test.check("query.dataset.sorting[0].name", "UsageDate", case_sensitive=False), + test.check("query.dataset.sorting[0].direction", "Ascending", case_sensitive=False), + test.check("query.timeframe", "MonthToDate", case_sensitive=False), + test.check("name", "{myView}", case_sensitive=False), + ]) + + +# EXAMPLE: /Views/get/PrivateViewList +@try_manual +def step__views_get_privateviewlist(test, rg): + test.cmd('az costmanagement view list', + checks=[ + test.check('length(@)', 1), + ]) + + +# EXAMPLE: /Views/get/ResourceGroupView +@try_manual +def step__views_get_resourcegroupview(test, rg): + test.cmd('az costmanagement view get-by-scope ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--name "{myView}"', + checks=[]) + + +# EXAMPLE: /Views/get/ResourceGroupViewList +@try_manual +def step__views_get_resourcegroupviewlist(test, rg): + test.cmd('az costmanagement view list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[ + test.check('length(@)', 1), + ]) + + +# EXAMPLE: /Exports/delete/ExportDeleteBySubscription +@try_manual +def step__exports_delete_exportdeletebysubscription(test, rg): + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/delete/ExportDeleteByResourceGroup +@try_manual +def step__exports_delete_exportdeletebyresourcegroup(test, rg): + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/delete/ExportDeleteByManagementGroup +@try_manual +def step__exports_delete_exportdeletebymanagementgroup(test, rg): + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/delete/ExportDeleteByEnrollmentAccount +@try_manual +def step__exports_delete(test, rg): + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/delete/ExportDeleteByDepartment +@try_manual +def step__exports_delete_exportdeletebydepartment(test, rg): + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/delete/ExportDeleteByBillingAccount +@try_manual +def step__exports_delete_exportdeletebybillingaccount(test, rg): + test.cmd('az costmanagement export delete -y ' + '--name "{myExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Views/delete/ResourceGroupDeleteView +@try_manual +def step__views_delete_resourcegroupdeleteview(test, rg): + test.cmd('az costmanagement view delete -y ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--name "{myView2}"', + checks=[]) + + +# EXAMPLE: /Views/delete/DeletePrivateView +@try_manual +def step__views_delete_deleteprivateview(test, rg): + test.cmd('az costmanagement view delete -y ' + '--name "{myView2}"', + checks=[]) + + +@try_manual +def cleanup(test, rg): + pass + + +@try_manual +def call_scenario(test, rg): + setup(test, rg) + step__alerts_get_billingaccountalerts(test, rg) + step__alerts_get_billingprofilealerts(test, rg) + step__alerts_get_departmentalerts(test, rg) + step__alerts_get_enrollmentaccountalerts(test, rg) + step__alerts_get_externalbillingaccountalerts(test, rg) + step__alerts_get_externalsubscriptionalerts(test, rg) + step__alerts_get_invoicesectionalerts(test, rg) + step__alerts_get_resourcegroupalerts(test, rg) + step__alerts_get_resourcegroupalerts(test, rg) + step__alerts_get_subscriptionalerts(test, rg) + step__alerts_get_subscriptionalerts(test, rg) + step__alerts_patch_resourcegroupalerts(test, rg) + step__alerts_patch_subscriptionalerts(test, rg) + step__dimensions_get(test, rg) + step__dimensions_get2(test, rg) + step__dimensions_get3(test, rg) + step__dimensions_get4(test, rg) + step__dimensions_get5(test, rg) + step__dimensions_get6(test, rg) + step__dimensions_get7(test, rg) + step__dimensions_get8(test, rg) + step__dimensions_get9(test, rg) + step__dimensions_get_customerdimensionslist_modern(test, rg) + step__dimensions_get10(test, rg) + step__dimensions_get11(test, rg) + step__dimensions_get12(test, rg) + step__dimensions_get13(test, rg) + step__dimensions_get14(test, rg) + step__dimensions_get15(test, rg) + step__dimensions_get16(test, rg) + step__dimensions_get17(test, rg) + step__dimensions_get18(test, rg) + step__dimensions_get19(test, rg) + step__dimensions_get20(test, rg) + step__dimensions_get21(test, rg) + step__dimensions_get22(test, rg) + step__dimensions_get23(test, rg) + step__dimensions_get24(test, rg) + step__dimensions_get25(test, rg) + step__dimensions_get26(test, rg) + step__dimensions_get27(test, rg) + step__exports_put(test, rg) + step__exports_put_exportcreateorupdatebydepartment(test, rg) + step__exports_put2(test, rg) + step__exports_put3(test, rg) + step__exports_put4(test, rg) + step__exports_put5(test, rg) + step__exports_get_exportgetbybillingaccount(test, rg) + step__exports_get_exportgetbydepartment(test, rg) + step__exports_get_exportgetbyenrollmentaccount(test, rg) + step__exports_get_exportgetbymanagementgroup(test, rg) + step__exports_get_exportgetbyresourcegroup(test, rg) + step__exports_get_exportgetbysubscription(test, rg) + step__exports_get(test, rg) + step__exports_get_exportrunhistorygetbydepartment(test, rg) + step__exports_get2(test, rg) + step__exports_get3(test, rg) + step__exports_get4(test, rg) + step__exports_get5(test, rg) + step__exports_get_exportsgetbybillingaccount(test, rg) + step__exports_get_exportsgetbydepartment(test, rg) + step__exports_get_exportsgetbyenrollmentaccount(test, rg) + step__exports_get_exportsgetbymanagementgroup(test, rg) + step__exports_get_exportsgetbyresourcegroup(test, rg) + step__exports_get_exportsgetbysubscription(test, rg) + step__exports_post_exportrunbybillingaccount(test, rg) + step__exports_post_exportrunbydepartment(test, rg) + step__exports_post_exportrunbyenrollmentaccount(test, rg) + step__exports_post_exportrunbymanagementgroup(test, rg) + step__exports_post_exportrunbyresourcegroup(test, rg) + step__exports_post_exportrunbysubscription(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(test, rg) + step__query_post2(test, rg) + step__query_post_billingprofilequery_modern(test, rg) + step__query_post3(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_post4(test, rg) + step__query_post_externalbillingaccountquerylist(test, rg) + step__query_post_externalsubscriptionsquery(test, rg) + step__query_post_invoicesectionquery_modern(test, rg) + step__query_post5(test, rg) + step__query_post_managementgroupquery_legacy(test, rg) + step__query_post6(test, rg) + step__query_post_resourcegroupquery_legacy(test, rg) + step__query_post_resourcegroupquerygrouping_legacy(test, rg) + step__query_post_subscriptionquery_legacy(test, rg) + step__query_post_subscriptionquerygrouping_legacy(test, rg) + step__views_put_createorupdateprivateview(test, rg) + step__views_put_resourcegroupcreateorupdateview(test, rg) + step__views_get_privateview(test, rg) + step__views_get_privateviewlist(test, rg) + step__views_get_resourcegroupview(test, rg) + step__views_get_resourcegroupviewlist(test, rg) + step__exports_delete_exportdeletebysubscription(test, rg) + step__exports_delete_exportdeletebyresourcegroup(test, rg) + step__exports_delete_exportdeletebymanagementgroup(test, rg) + step__exports_delete(test, rg) + step__exports_delete_exportdeletebydepartment(test, rg) + step__exports_delete_exportdeletebybillingaccount(test, rg) + step__views_delete_resourcegroupdeleteview(test, rg) + step__views_delete_deleteprivateview(test, rg) + cleanup(test, rg) + + +@try_manual +class CostManagementClientScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='clitestcostmanagement_MYDEVTESTRG'[:7], key='rg', parameter_name='rg') + @StorageAccountPreparer(name_prefix='clitestcostmanagement_ccmeastusdiag182'[:7], key='sa', + resource_group_parameter_name='rg') + def test_costmanagement(self, rg): + + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'myView': 'swaggerExample', + 'myView2': 'TestView', + 'myExport': 'TestExport', + }) + + 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..8212ef6ce54 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. @@ -41,9 +41,10 @@ def __init__( super(CostManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.credential_scopes = ['https://management.azure.com/.default'] - kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION)) + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'costmanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -55,6 +56,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..b137f5955fd 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,6 +15,8 @@ # 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 @@ -30,22 +32,23 @@ class CostManagementClient(object): """CostManagementClient. :ivar view: ViewOperations operations - :vartype view: azure.mgmt.costmanagement.operations.ViewOperations + :vartype view: cost_management_client.operations.ViewOperations :ivar alert: AlertOperations operations - :vartype alert: azure.mgmt.costmanagement.operations.AlertOperations + :vartype alert: cost_management_client.operations.AlertOperations :ivar forecast: ForecastOperations operations - :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations + :vartype forecast: cost_management_client.operations.ForecastOperations :ivar dimension: DimensionOperations operations - :vartype dimension: azure.mgmt.costmanagement.operations.DimensionOperations + :vartype dimension: cost_management_client.operations.DimensionOperations :ivar query: QueryOperations operations - :vartype query: azure.mgmt.costmanagement.operations.QueryOperations + :vartype query: cost_management_client.operations.QueryOperations :ivar export: ExportOperations operations - :vartype export: azure.mgmt.costmanagement.operations.ExportOperations + :vartype export: cost_management_client.operations.ExportOperations :ivar operation: OperationOperations operations - :vartype operation: azure.mgmt.costmanagement.operations.OperationOperations + :vartype operation: cost_management_client.operations.OperationOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( 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/_configuration_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py index 15d87f41cbf..62a5096533d 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.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. @@ -38,9 +38,10 @@ def __init__( super(CostManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.credential_scopes = ['https://management.azure.com/.default'] - kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION)) + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'costmanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -51,6 +52,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_async.py index 0f81334bb70..f0e45241588 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_async.py @@ -6,11 +6,15 @@ # 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + from ._configuration_async import CostManagementClientConfiguration from .operations_async import ViewOperations from .operations_async import AlertOperations @@ -26,22 +30,23 @@ class CostManagementClient(object): """CostManagementClient. :ivar view: ViewOperations operations - :vartype view: azure.mgmt.costmanagement.aio.operations_async.ViewOperations + :vartype view: cost_management_client.aio.operations_async.ViewOperations :ivar alert: AlertOperations operations - :vartype alert: azure.mgmt.costmanagement.aio.operations_async.AlertOperations + :vartype alert: cost_management_client.aio.operations_async.AlertOperations :ivar forecast: ForecastOperations operations - :vartype forecast: azure.mgmt.costmanagement.aio.operations_async.ForecastOperations + :vartype forecast: cost_management_client.aio.operations_async.ForecastOperations :ivar dimension: DimensionOperations operations - :vartype dimension: azure.mgmt.costmanagement.aio.operations_async.DimensionOperations + :vartype dimension: cost_management_client.aio.operations_async.DimensionOperations :ivar query: QueryOperations operations - :vartype query: azure.mgmt.costmanagement.aio.operations_async.QueryOperations + :vartype query: cost_management_client.aio.operations_async.QueryOperations :ivar export: ExportOperations operations - :vartype export: azure.mgmt.costmanagement.aio.operations_async.ExportOperations + :vartype export: cost_management_client.aio.operations_async.ExportOperations :ivar operation: OperationOperations operations - :vartype operation: azure.mgmt.costmanagement.aio.operations_async.OperationOperations + :vartype operation: cost_management_client.aio.operations_async.OperationOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_alert_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_alert_operations_async.py index db9ca7b4425..3f4d84bf5e3 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_async/_alert_operations_async.py @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -25,7 +25,7 @@ class AlertOperations: 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,17 @@ 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: AlertsResult or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.AlertsResult + :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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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), } @@ -88,7 +89,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,10 +101,236 @@ async def list( deserialized = self._deserialize('AlertsResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts'} + 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # 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'] = 'application/json' + + 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, + definition: Optional["models.AlertPropertiesDefinition"] = None, + description: Optional[str] = None, + source: Optional[Union[str, "models.AlertSource"]] = None, + cost_entity_id: Optional[str] = None, + status: Optional[Union[str, "models.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, + time_grain_type: Optional[Union[str, "models.AlertTimeGrainType"]] = None, + period_start_date: Optional[str] = None, + triggered_by: Optional[str] = None, + resource_group_filter: Optional[List[object]] = None, + resource_filter: Optional[List[object]] = None, + meter_filter: Optional[List[object]] = None, + tag_filter: Optional[object] = None, + threshold: Optional[float] = None, + operator: Optional[Union[str, "models.AlertOperator"]] = None, + amount: Optional[float] = None, + unit: Optional[str] = None, + current_spend: Optional[float] = None, + contact_emails: Optional[List[str]] = None, + contact_groups: Optional[List[str]] = None, + contact_roles: Optional[List[str]] = None, + overriding_alert: Optional[str] = None, + **kwargs + ) -> "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 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. + :type source: str or ~cost_management_client.models.AlertSource + :param cost_entity_id: related budget. + :type cost_entity_id: str + :param status: alert status. + :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 + :param time_grain_type: Type of timegrain cadence. + :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. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. + :type operator: str or ~cost_management_client.models.AlertOperator + :param amount: budget threshold amount. + :type amount: float + :param unit: unit of currency being used. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.DismissAlertPayload(definition=definition, description=description, source=source, cost_entity_id=cost_entity_id, status=status, creation_time=creation_time, close_time=close_time, modification_time=modification_time, status_modification_user_name=status_modification_user_name, status_modification_time=status_modification_time, time_grain_type=time_grain_type, period_start_date=period_start_date, triggered_by=triggered_by, resource_group_filter=resource_group_filter, resource_filter=resource_filter, meter_filter=meter_filter, tag_filter=tag_filter, threshold=threshold, operator=operator, amount=amount, unit=unit, current_spend=current_spend, contact_emails=contact_emails, contact_groups=contact_groups, contact_roles=contact_roles, overriding_alert=overriding_alert) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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, @@ -117,21 +343,22 @@ async def list_external( :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 :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: 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # Construct URL - url = self.list_external.metadata['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'), @@ -146,7 +373,6 @@ async def list_external( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -159,7 +385,7 @@ async def list_external( deserialized = self._deserialize('AlertsResult', 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'} + 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_async/_dimension_operations_async.py index 9e7580d0894..8740b6dc5e8 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_async/_dimension_operations_async.py @@ -5,7 +5,7 @@ # 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 @@ -26,7 +26,7 @@ class DimensionOperations: 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,77 @@ 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.DimensionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + 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): @@ -144,7 +145,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 +156,68 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + 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 +243,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_async/_export_operations_async.py index 4d14c7ab9a2..65c8c49adb6 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_async/_export_operations_async.py @@ -5,7 +5,7 @@ # 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 @@ -25,7 +25,7 @@ class ExportOperations: 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,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, scope: str, + expand: Optional[str] = None, **kwargs ) -> "models.ExportListResult": """The operation to list all exports at the given scope. @@ -64,17 +65,21 @@ async def list( '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. :type scope: str + :param expand: May be used to expand the properties within an export. Currently only + 'runHistory' is supported and will return information for the last execution of each export. + :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExportListResult or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.ExportListResult + :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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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), } @@ -83,12 +88,13 @@ async def list( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,15 +107,16 @@ 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, scope: str, export_name: str, + expand: Optional[str] = None, **kwargs ) -> "models.Export": """The operation to get the export for the defined scope by export name. @@ -133,17 +140,21 @@ async def get( :type scope: str :param export_name: Export Name. :type export_name: str + :param expand: May be used to expand the properties within an export. Currently only + 'runHistory' is supported and will return information for the last 10 executions of the export. + :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Export or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Export + :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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -153,12 +164,13 @@ async def get( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -171,30 +183,32 @@ 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, + format: Optional[Union[str, "models.FormatType"]] = None, + run_history: Optional["models.ExportExecutionListResult"] = 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, + time_period: Optional["models.ExportTimePeriod"] = None, + granularity: Optional[Union[str, "models.GranularityType"]] = None, + configuration: Optional["models.ExportDatasetConfiguration"] = None, destination: Optional["models.ExportDeliveryDestination"] = None, status: Optional[Union[str, "models.StatusType"]] = None, recurrence: Optional[Union[str, "models.RecurrenceType"]] = None, recurrence_period: Optional["models.ExportRecurrencePeriod"] = None, **kwargs ) -> "models.Export": - """The operation to create or update a export. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + """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, @@ -218,49 +232,48 @@ async def create_or_update( :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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :param type: The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is + applicable to exports that do not yet provide data for charges or amortization for service + reservations. + :type type: str or ~cost_management_client.models.ExportType + :param timeframe: The time frame for pulling data for the export. 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 + :type timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :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 + :type destination: ~cost_management_client.models.ExportDeliveryDestination + :param status: The status of the export's schedule. If 'Inactive', the export's schedule is + paused. + :type status: str or ~cost_management_client.models.StatusType :param recurrence: The schedule recurrence. - :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType + :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: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod + :type recurrence_period: ~cost_management_client.models.ExportRecurrencePeriod :keyword callable cls: A custom type or function that will be passed the direct response - :return: Export or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Export or ~azure.mgmt.costmanagement.models.Export + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _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) - api_version = "2019-11-01" + _parameters = models.Export(e_tag=e_tag, format=format, run_history=run_history, type_properties_definition_type=type, timeframe=timeframe, time_period=time_period, granularity=granularity, configuration=configuration, destination=destination, status=status, recurrence=recurrence, recurrence_period=recurrence_period) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -276,7 +289,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'Export') body_content_kwargs['content'] = body_content @@ -290,7 +302,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 +309,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 +342,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -354,7 +366,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -365,9 +376,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, @@ -375,7 +386,7 @@ async def execute( export_name: str, **kwargs ) -> None: - """The operation to execute a export. + """The operation to execute an export. :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, @@ -397,16 +408,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -420,7 +432,6 @@ async def execute( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -431,9 +442,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, @@ -441,7 +452,7 @@ async def get_execution_history( export_name: str, **kwargs ) -> "models.ExportExecutionListResult": - """The operation to get the execution history of an export for the defined scope by export name. + """The operation to get the execution history of an export for the defined scope and export name. :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, @@ -463,16 +474,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -487,7 +499,6 @@ async def get_execution_history( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -500,7 +511,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_async/_forecast_operations_async.py index 50b4a7cf64c..d285b0c802e 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_async/_forecast_operations_async.py @@ -5,7 +5,7 @@ # 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 @@ -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. @@ -49,9 +49,9 @@ async def usage( time_period: Optional["models.QueryTimePeriod"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, + granularity: Optional[Union[str, "models.GranularityType"]] = None, configuration: Optional["models.QueryDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "QueryAggregation"]] = None, - grouping: Optional[List["QueryGrouping"]] = None, + aggregation: Optional[Dict[str, "models.QueryAggregation"]] = None, query_filter: Optional["models.QueryFilter"] = None, **kwargs ) -> "models.QueryResult": @@ -75,46 +75,46 @@ async def usage( specific for partners. :type scope: str :param type: The type of the forecast. - :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.models.ForecastTimeframeType :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str :param time_period: Has time period for pulling data for the forecast. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :type time_period: ~cost_management_client.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 granularity: The granularity of rows in the forecast. + :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: ~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 + :type configuration: ~cost_management_client.models.QueryDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the forecast. The key of + each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param 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 + :type aggregation: dict[str, ~cost_management_client.models.QueryAggregation] + :param query_filter: Has filter expression to use in the forecast. + :type query_filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) - api_version = "2019-11-01" + _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, granularity=granularity, configuration=configuration, aggregation=aggregation, filter=query_filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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), } @@ -131,7 +131,6 @@ async def usage( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'ForecastDefinition') body_content_kwargs['content'] = body_content @@ -148,10 +147,10 @@ async def usage( 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, @@ -163,9 +162,9 @@ async def external_cloud_provider_usage( time_period: Optional["models.QueryTimePeriod"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, + granularity: Optional[Union[str, "models.GranularityType"]] = None, configuration: Optional["models.QueryDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "QueryAggregation"]] = None, - grouping: Optional[List["QueryGrouping"]] = None, + aggregation: Optional[Dict[str, "models.QueryAggregation"]] = None, query_filter: Optional["models.QueryFilter"] = None, **kwargs ) -> "models.QueryResult": @@ -174,51 +173,51 @@ 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 + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.models.ForecastTimeframeType :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str :param time_period: Has time period for pulling data for the forecast. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :type time_period: ~cost_management_client.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 granularity: The granularity of rows in the forecast. + :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: ~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 + :type configuration: ~cost_management_client.models.QueryDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the forecast. The key of + each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param 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 + :type aggregation: dict[str, ~cost_management_client.models.QueryAggregation] + :param query_filter: Has filter expression to use in the forecast. + :type query_filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) - api_version = "2019-11-01" + _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, granularity=granularity, configuration=configuration, aggregation=aggregation, filter=query_filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -236,7 +235,6 @@ async def external_cloud_provider_usage( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'ForecastDefinition') body_content_kwargs['content'] = body_content @@ -253,7 +251,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_async/_operation_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_operation_operations_async.py index 3100d06cf5b..e4a8fd2a5e2 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_async/_operation_operations_async.py @@ -5,7 +5,7 @@ # 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 @@ -26,7 +26,7 @@ class OperationOperations: 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,36 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - else: - url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + 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): @@ -98,4 +99,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/_query_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_query_operations_async.py index 994fc5fa69f..58af907f629 100644 --- 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 @@ -25,7 +25,7 @@ class QueryOperations: 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. @@ -46,9 +46,10 @@ async def usage( type: Union[str, "models.ExportType"], timeframe: Union[str, "models.TimeframeType"], time_period: Optional["models.QueryTimePeriod"] = None, + granularity: Optional[Union[str, "models.GranularityType"]] = None, configuration: Optional["models.QueryDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "QueryAggregation"]] = None, - grouping: Optional[List["QueryGrouping"]] = None, + aggregation: Optional[Dict[str, "models.QueryAggregation"]] = None, + grouping: Optional[List["models.QueryGrouping"]] = None, filter: Optional["models.QueryFilter"] = None, **kwargs ) -> "models.QueryResult": @@ -72,38 +73,41 @@ async def usage( specific for partners. :type scope: str :param type: The type of the query. - :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :type type: str or ~cost_management_client.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 + :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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param granularity: The granularity of rows in the query. + :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: ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :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, ~azure.mgmt.costmanagement.models.QueryAggregation] + :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[~azure.mgmt.costmanagement.models.QueryGrouping] + :type grouping: list[~cost_management_client.models.QueryGrouping] :param filter: Has filter expression to use in the query. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + :type filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) - api_version = "2019-11-01" + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, granularity=granularity, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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), } @@ -118,7 +122,6 @@ async def usage( 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 @@ -135,10 +138,10 @@ async def usage( 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 async def usage_by_external_cloud_provider_type( self, @@ -147,9 +150,10 @@ async def usage_by_external_cloud_provider_type( type: Union[str, "models.ExportType"], timeframe: Union[str, "models.TimeframeType"], time_period: Optional["models.QueryTimePeriod"] = None, + granularity: Optional[Union[str, "models.GranularityType"]] = None, configuration: Optional["models.QueryDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "QueryAggregation"]] = None, - grouping: Optional[List["QueryGrouping"]] = None, + aggregation: Optional[Dict[str, "models.QueryAggregation"]] = None, + grouping: Optional[List["models.QueryGrouping"]] = None, filter: Optional["models.QueryFilter"] = None, **kwargs ) -> "models.QueryResult": @@ -158,43 +162,46 @@ async 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 + :type type: str or ~cost_management_client.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 + :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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param granularity: The granularity of rows in the query. + :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: ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :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, ~azure.mgmt.costmanagement.models.QueryAggregation] + :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[~azure.mgmt.costmanagement.models.QueryGrouping] + :type grouping: list[~cost_management_client.models.QueryGrouping] :param filter: Has filter expression to use in the query. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + :type filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) - api_version = "2019-11-01" + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, granularity=granularity, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -210,7 +217,6 @@ async def usage_by_external_cloud_provider_type( 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 @@ -227,7 +233,7 @@ async 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/aio/operations_async/_view_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_view_operations_async.py index c606c6c32da..fffdd4f2a7f 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_async/_view_operations_async.py @@ -5,7 +5,7 @@ # 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, List, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -26,7 +26,7 @@ class ViewOperations: 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,36 @@ 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.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - else: - url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + 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): @@ -98,63 +99,64 @@ 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.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + 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): @@ -180,7 +182,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 +194,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), } @@ -215,7 +218,6 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -228,10 +230,10 @@ 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, @@ -242,14 +244,17 @@ async def create_or_update( 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, + kpis: Optional[List["models.KpiProperties"]] = None, + pivots: Optional[List["models.PivotProperties"]] = None, + type: Optional[Union[str, "models.ReportType"]] = None, timeframe: Optional[Union[str, "models.ReportTimeframeType"]] = None, time_period: Optional["models.ReportConfigTimePeriod"] = None, dataset: Optional["models.ReportConfigDataset"] = None, **kwargs ) -> "models.View": - """The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + """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 @@ -277,36 +282,41 @@ async def create_or_update( 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 + :type chart: str or ~cost_management_client.models.ChartType :param accumulated: Show costs accumulated over time. - :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. - :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] + :type pivots: list[~cost_management_client.models.PivotProperties] + :param 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. + :type 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. - :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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :type dataset: ~cost_management_client.models.ReportConfigDataset :keyword callable cls: A custom type or function that will be passed the direct response - :return: View or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) - api_version = "2019-11-01" + _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, type_properties_query_type=type, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), } @@ -321,7 +331,6 @@ async def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'View') body_content_kwargs['content'] = body_content @@ -335,7 +344,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 +351,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 +366,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), } @@ -380,7 +389,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,9 +399,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 +432,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -448,7 +457,6 @@ async def get_by_scope( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -461,10 +469,10 @@ 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, @@ -476,14 +484,17 @@ async def create_or_update_by_scope( 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, + kpis: Optional[List["models.KpiProperties"]] = None, + pivots: Optional[List["models.PivotProperties"]] = None, + type: Optional[Union[str, "models.ReportType"]] = None, timeframe: Optional[Union[str, "models.ReportTimeframeType"]] = None, time_period: Optional["models.ReportConfigTimePeriod"] = None, dataset: Optional["models.ReportConfigDataset"] = None, **kwargs ) -> "models.View": - """The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + """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, @@ -529,36 +540,41 @@ async def create_or_update_by_scope( 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 + :type chart: str or ~cost_management_client.models.ChartType :param accumulated: Show costs accumulated over time. - :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. - :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] + :type pivots: list[~cost_management_client.models.PivotProperties] + :param 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. + :type 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. - :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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :type dataset: ~cost_management_client.models.ReportConfigDataset :keyword callable cls: A custom type or function that will be passed the direct response - :return: View or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=view_properties_scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) - api_version = "2019-11-01" + _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, type_properties_query_type=type, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -574,7 +590,6 @@ async def create_or_update_by_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'View') body_content_kwargs['content'] = body_content @@ -588,7 +603,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 +610,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 +644,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -653,7 +668,6 @@ async def delete_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -664,6 +678,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/models/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py index 86b6667b5a5..77b27811220 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py @@ -9,20 +9,22 @@ try: from ._models_py3 import Alert from ._models_py3 import AlertPropertiesDefinition - from ._models_py3 import AlertPropertiesDetails from ._models_py3 import AlertsResult from ._models_py3 import CommonExportProperties from ._models_py3 import Dimension from ._models_py3 import DimensionsListResult + from ._models_py3 import DismissAlertPayload from ._models_py3 import ErrorDetails from ._models_py3 import ErrorResponse from ._models_py3 import Export + from ._models_py3 import ExportDatasetConfiguration from ._models_py3 import ExportDeliveryDestination from ._models_py3 import ExportExecution from ._models_py3 import ExportExecutionListResult from ._models_py3 import ExportListResult from ._models_py3 import ExportProperties from ._models_py3 import ExportRecurrencePeriod + from ._models_py3 import ExportTimePeriod from ._models_py3 import ForecastDefinition from ._models_py3 import KpiProperties from ._models_py3 import Operation @@ -53,20 +55,22 @@ except (SyntaxError, ImportError): from ._models import Alert # type: ignore from ._models import AlertPropertiesDefinition # type: ignore - from ._models import AlertPropertiesDetails # type: ignore from ._models import AlertsResult # type: ignore from ._models import CommonExportProperties # type: ignore from ._models import Dimension # type: ignore from ._models import DimensionsListResult # type: ignore + from ._models import DismissAlertPayload # type: ignore from ._models import ErrorDetails # type: ignore from ._models import ErrorResponse # type: ignore from ._models import Export # type: ignore + from ._models import ExportDatasetConfiguration # type: ignore from ._models import ExportDeliveryDestination # type: ignore from ._models import ExportExecution # type: ignore from ._models import ExportExecutionListResult # type: ignore from ._models import ExportListResult # type: ignore from ._models import ExportProperties # type: ignore from ._models import ExportRecurrencePeriod # type: ignore + from ._models import ExportTimePeriod # type: ignore from ._models import ForecastDefinition # type: ignore from ._models import KpiProperties # type: ignore from ._models import Operation # type: ignore @@ -97,6 +101,13 @@ from ._cost_management_client_enums import ( AccumulatedType, + AlertCategory, + AlertCriteria, + AlertOperator, + AlertSource, + AlertStatus, + AlertTimeGrainType, + AlertType, ChartType, ExecutionStatus, ExecutionType, @@ -104,6 +115,9 @@ ExternalCloudProviderType, ForecastTimeframeType, ForecastType, + FormatType, + FunctionType, + GranularityType, KpiType, MetricType, OperatorType, @@ -114,6 +128,7 @@ ReportConfigSortingDirection, ReportGranularityType, ReportTimeframeType, + ReportType, StatusType, TimeframeType, ) @@ -121,20 +136,22 @@ __all__ = [ 'Alert', 'AlertPropertiesDefinition', - 'AlertPropertiesDetails', 'AlertsResult', 'CommonExportProperties', 'Dimension', 'DimensionsListResult', + 'DismissAlertPayload', 'ErrorDetails', 'ErrorResponse', 'Export', + 'ExportDatasetConfiguration', 'ExportDeliveryDestination', 'ExportExecution', 'ExportExecutionListResult', 'ExportListResult', 'ExportProperties', 'ExportRecurrencePeriod', + 'ExportTimePeriod', 'ForecastDefinition', 'KpiProperties', 'Operation', @@ -163,6 +180,13 @@ 'View', 'ViewListResult', 'AccumulatedType', + 'AlertCategory', + 'AlertCriteria', + 'AlertOperator', + 'AlertSource', + 'AlertStatus', + 'AlertTimeGrainType', + 'AlertType', 'ChartType', 'ExecutionStatus', 'ExecutionType', @@ -170,6 +194,9 @@ 'ExternalCloudProviderType', 'ForecastTimeframeType', 'ForecastType', + 'FormatType', + 'FunctionType', + 'GranularityType', 'KpiType', 'MetricType', 'OperatorType', @@ -180,6 +207,7 @@ 'ReportConfigSortingDirection', 'ReportGranularityType', 'ReportTimeframeType', + 'ReportType', '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..cf2cc99799b 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,292 @@ # 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 + """ -class ChartType(str, Enum): + 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 + """ + + 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): - """The status of the export execution. +class ExecutionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The last known 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. Currently only 'Csv' is supported. + """ + + CSV = "Csv" + +class FunctionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the aggregation function to use. + """ + + SUM = "Sum" + +class GranularityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The granularity of rows in the forecast. + """ + + 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 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 StatusType(str, Enum): - """The status of the schedule. Whether active or not. If inactive, the export's scheduled - execution is paused. +class StatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the export's schedule. If 'Inactive', the export's schedule 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..c6ee4f18de0 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,16 @@ 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 details: Alert details. - :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param source: Source of alert. Possible values include: "Preset", "User". + :type source: str or ~cost_management_client.models.AlertSource :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. @@ -85,6 +84,40 @@ class Alert(Resource): :type status_modification_user_name: str :param status_modification_time: dateTime in which the alert status was last modified. :type status_modification_time: 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. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. 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. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str """ _validation = { @@ -102,7 +135,6 @@ class Alert(Resource): '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'}, @@ -110,6 +142,22 @@ class Alert(Resource): 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + 'time_grain_type': {'key': 'properties.details.timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'properties.details.periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'properties.details.triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'properties.details.resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'properties.details.resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'properties.details.meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'properties.details.tagFilter', 'type': 'object'}, + 'threshold': {'key': 'properties.details.threshold', 'type': 'float'}, + 'operator': {'key': 'properties.details.operator', 'type': 'str'}, + 'amount': {'key': 'properties.details.amount', 'type': 'float'}, + 'unit': {'key': 'properties.details.unit', 'type': 'str'}, + 'current_spend': {'key': 'properties.details.currentSpend', 'type': 'float'}, + 'contact_emails': {'key': 'properties.details.contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'properties.details.contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'properties.details.contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'properties.details.overridingAlert', 'type': 'str'}, } def __init__( @@ -120,7 +168,6 @@ def __init__( 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) @@ -128,17 +175,39 @@ def __init__( 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) + self.time_grain_type = kwargs.get('time_grain_type', None) + self.period_start_date = kwargs.get('period_start_date', None) + self.triggered_by = kwargs.get('triggered_by', None) + self.resource_group_filter = kwargs.get('resource_group_filter', None) + self.resource_filter = kwargs.get('resource_filter', None) + self.meter_filter = kwargs.get('meter_filter', None) + self.tag_filter = kwargs.get('tag_filter', None) + self.threshold = kwargs.get('threshold', None) + self.operator = kwargs.get('operator', None) + self.amount = kwargs.get('amount', None) + self.unit = kwargs.get('unit', None) + self.current_spend = kwargs.get('current_spend', None) + self.contact_emails = kwargs.get('contact_emails', None) + self.contact_groups = kwargs.get('contact_groups', None) + self.contact_roles = kwargs.get('contact_roles', None) + self.overriding_alert = kwargs.get('overriding_alert', None) class 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 = { @@ -157,92 +226,13 @@ def __init__( self.criteria = kwargs.get('criteria', None) -class AlertPropertiesDetails(msrest.serialization.Model): - """Alert details. - - :param time_grain_type: Type of timegrain cadence. - :type time_grain_type: str - :param period_start_date: datetime of periodStartDate. - :type period_start_date: str - :param triggered_by: notificationId that triggered this alert. - :type triggered_by: str - :param resource_group_filter: array of resourceGroups to filter by. - :type resource_group_filter: list[object] - :param resource_filter: array of resources to filter by. - :type resource_filter: list[object] - :param meter_filter: array of meters to filter by. - :type meter_filter: list[object] - :param tag_filter: tags to filter by. - :type tag_filter: object - :param threshold: notification threshold percentage as a decimal which activated this alert. - :type threshold: float - :param operator: operator used to compare currentSpend with amount. - :type operator: str - :param amount: budget threshold amount. - :type amount: float - :param unit: unit of currency being used. - :type unit: str - :param current_spend: current spend. - :type current_spend: float - :param contact_emails: list of emails to contact. - :type contact_emails: list[str] - :param contact_groups: list of action groups to broadcast to. - :type contact_groups: list[str] - :param contact_roles: list of contact roles. - :type contact_roles: list[str] - :param overriding_alert: overriding alert. - :type overriding_alert: str - """ - - _attribute_map = { - 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, - 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, - 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, - 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, - 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, - 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, - 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, - 'threshold': {'key': 'threshold', 'type': 'float'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'amount': {'key': 'amount', 'type': 'float'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_spend': {'key': 'currentSpend', 'type': 'float'}, - 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, - 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, - 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, - 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertPropertiesDetails, self).__init__(**kwargs) - self.time_grain_type = kwargs.get('time_grain_type', None) - self.period_start_date = kwargs.get('period_start_date', None) - self.triggered_by = kwargs.get('triggered_by', None) - self.resource_group_filter = kwargs.get('resource_group_filter', None) - self.resource_filter = kwargs.get('resource_filter', None) - self.meter_filter = kwargs.get('meter_filter', None) - self.tag_filter = kwargs.get('tag_filter', None) - self.threshold = kwargs.get('threshold', None) - self.operator = kwargs.get('operator', None) - self.amount = kwargs.get('amount', None) - self.unit = kwargs.get('unit', None) - self.current_spend = kwargs.get('current_spend', None) - self.contact_emails = kwargs.get('contact_emails', None) - self.contact_groups = kwargs.get('contact_groups', None) - self.contact_roles = kwargs.get('contact_roles', None) - self.overriding_alert = kwargs.get('overriding_alert', None) - - class AlertsResult(msrest.serialization.Model): """Result of alerts. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of alerts. - :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :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 """ @@ -273,72 +263,65 @@ class CommonExportProperties(msrest.serialization.Model): 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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the + next execution time. + :vartype next_run_time_estimate: ~datetime.datetime + :param type: Required. The type of the export. Note that 'Usage' is equivalent to 'ActualCost' + and is applicable to exports that do not yet provide data for charges or amortization for + service reservations. Possible values include: "Usage", "ActualCost", "AmortizedCost". + :type type: str or ~cost_management_client.models.ExportType + :param timeframe: Required. The time frame for pulling data for the export. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the 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 timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :param destination: Required. Has destination for the export being delivered. - :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :type destination: ~cost_management_client.models.ExportDeliveryDestination """ _validation = { - 'format': {'constant': True}, + 'next_run_time_estimate': {'readonly': True}, 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, 'destination': {'required': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'type': {'key': 'definition.type', 'type': 'str'}, 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, - 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'ExportTimePeriod'}, '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'}, + 'configuration': {'key': 'definition.dataSet.configuration', 'type': 'ExportDatasetConfiguration'}, 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, } - format = "Csv" - granularity = "Daily" - def __init__( self, **kwargs ): super(CommonExportProperties, self).__init__(**kwargs) + self.format = kwargs.get('format', None) + self.run_history = kwargs.get('run_history', None) + self.next_run_time_estimate = None self.type = kwargs['type'] self.timeframe = kwargs['timeframe'] self.time_period = kwargs.get('time_period', None) + 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) self.destination = kwargs['destination'] @@ -428,7 +411,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 +430,128 @@ 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 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 + :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. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. 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. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + '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'}, + 'time_grain_type': {'key': 'properties.details.timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'properties.details.periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'properties.details.triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'properties.details.resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'properties.details.resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'properties.details.meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'properties.details.tagFilter', 'type': 'object'}, + 'threshold': {'key': 'properties.details.threshold', 'type': 'float'}, + 'operator': {'key': 'properties.details.operator', 'type': 'str'}, + 'amount': {'key': 'properties.details.amount', 'type': 'float'}, + 'unit': {'key': 'properties.details.unit', 'type': 'str'}, + 'current_spend': {'key': 'properties.details.currentSpend', 'type': 'float'}, + 'contact_emails': {'key': 'properties.details.contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'properties.details.contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'properties.details.contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'properties.details.overridingAlert', '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.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) + self.time_grain_type = kwargs.get('time_grain_type', None) + self.period_start_date = kwargs.get('period_start_date', None) + self.triggered_by = kwargs.get('triggered_by', None) + self.resource_group_filter = kwargs.get('resource_group_filter', None) + self.resource_filter = kwargs.get('resource_filter', None) + self.meter_filter = kwargs.get('meter_filter', None) + self.tag_filter = kwargs.get('tag_filter', None) + self.threshold = kwargs.get('threshold', None) + self.operator = kwargs.get('operator', None) + self.amount = kwargs.get('amount', None) + self.unit = kwargs.get('unit', None) + self.current_spend = kwargs.get('current_spend', None) + self.contact_emails = kwargs.get('contact_emails', None) + self.contact_groups = kwargs.get('contact_groups', None) + self.contact_roles = kwargs.get('contact_roles', None) + self.overriding_alert = kwargs.get('overriding_alert', None) + + class ErrorDetails(msrest.serialization.Model): """The details of the error. @@ -478,19 +583,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 = { @@ -546,7 +651,7 @@ def __init__( class Export(ProxyResource): - """A export resource. + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -559,51 +664,48 @@ 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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the + next execution time. + :vartype next_run_time_estimate: ~datetime.datetime + :param type_properties_definition_type: The type of the export. Note that 'Usage' is equivalent + to 'ActualCost' and is applicable to exports that do not yet provide data for charges or + amortization for service reservations. Possible values include: "Usage", "ActualCost", + "AmortizedCost". + :type type_properties_definition_type: str or ~cost_management_client.models.ExportType + :param timeframe: The time frame for pulling data for the export. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the query. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :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 timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :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 + :type destination: ~cost_management_client.models.ExportDeliveryDestination + :param status: The status of the export's schedule. If 'Inactive', the export's schedule is + paused. Possible values include: "Active", "Inactive". + :type status: str or ~cost_management_client.models.StatusType :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", "Monthly", "Annually". - :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType + :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: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod + :type recurrence_period: ~cost_management_client.models.ExportRecurrencePeriod """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'format': {'constant': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { @@ -612,41 +714,59 @@ class Export(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, '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'}, + 'time_period': {'key': 'properties.definition.timePeriod', 'type': 'ExportTimePeriod'}, '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'}, + 'configuration': {'key': 'properties.definition.dataSet.configuration', 'type': 'ExportDatasetConfiguration'}, 'destination': {'key': 'properties.deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, 'status': {'key': 'properties.schedule.status', 'type': 'str'}, 'recurrence': {'key': 'properties.schedule.recurrence', 'type': 'str'}, 'recurrence_period': {'key': 'properties.schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, } - format = "Csv" - granularity = "Daily" - def __init__( self, **kwargs ): super(Export, self).__init__(**kwargs) + self.format = kwargs.get('format', None) + self.run_history = kwargs.get('run_history', None) + self.next_run_time_estimate = None self.type_properties_definition_type = kwargs.get('type_properties_definition_type', None) self.timeframe = kwargs.get('timeframe', None) self.time_period = kwargs.get('time_period', None) + self.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) self.destination = kwargs.get('destination', None) self.status = kwargs.get('status', None) self.recurrence = kwargs.get('recurrence', None) self.recurrence_period = kwargs.get('recurrence_period', None) +class ExportDatasetConfiguration(msrest.serialization.Model): + """The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns. + + :param columns: Array of column names to be included in the export. If not provided then the + export will include all available columns. The available columns can vary by customer channel + (see examples). + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDatasetConfiguration, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + + class ExportDeliveryDestination(msrest.serialization.Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the Microsoft.CostManagementExports resource provider. This is required once per subscription. When creating an export in the Azure portal, it is done automatically, however API users need to register the subscription. For more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services . @@ -683,7 +803,7 @@ def __init__( class ExportExecution(Resource): - """A export execution. + """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -697,23 +817,26 @@ 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 - :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 execution_type: str or ~cost_management_client.models.ExecutionType + :param status: The last known status of the export execution. Possible values include: + "Queued", "InProgress", "Completed", "Failed", "Timeout", "NewDataNotAvailable", + "DataNotAvailable". + :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. + executions it is the user email. For scheduled executions it is 'System'. :type submitted_by: str :param submitted_time: The time when export was queued to be executed. :type submitted_time: ~datetime.datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: ~datetime.datetime - :param processing_end_time: The time when export execution finished. + :param processing_end_time: The time when the export execution finished. :type processing_end_time: ~datetime.datetime - :param file_name: The name of the file export got written to. + :param file_name: The name of the exported file. :type file_name: str - :param run_settings: The common properties of the export. - :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + :param run_settings: The export settings that were in effect for this execution. + :type run_settings: ~cost_management_client.models.CommonExportProperties + :param error: The details of any error. + :type error: ~cost_management_client.models.ErrorDetails """ _validation = { @@ -736,6 +859,7 @@ class ExportExecution(Resource): 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, 'file_name': {'key': 'properties.fileName', 'type': 'str'}, 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + 'error': {'key': 'properties.error', 'type': 'ErrorDetails'}, } def __init__( @@ -751,15 +875,16 @@ def __init__( self.processing_end_time = kwargs.get('processing_end_time', None) self.file_name = kwargs.get('file_name', None) self.run_settings = kwargs.get('run_settings', None) + self.error = kwargs.get('error', None) class ExportExecutionListResult(msrest.serialization.Model): - """Result of listing exports execution history of a export by name. + """Result of listing the execution history of an export. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of export executions. - :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] + :ivar value: A list of export executions. + :vartype value: list[~cost_management_client.models.ExportExecution] """ _validation = { @@ -784,7 +909,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 = { @@ -810,72 +935,64 @@ class ExportProperties(CommonExportProperties): 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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the + next execution time. + :vartype next_run_time_estimate: ~datetime.datetime + :param type: Required. The type of the export. Note that 'Usage' is equivalent to 'ActualCost' + and is applicable to exports that do not yet provide data for charges or amortization for + service reservations. Possible values include: "Usage", "ActualCost", "AmortizedCost". + :type type: str or ~cost_management_client.models.ExportType + :param timeframe: Required. The time frame for pulling data for the export. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the 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 timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :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 + :type destination: ~cost_management_client.models.ExportDeliveryDestination + :param status: The status of the export's schedule. If 'Inactive', the export's schedule is + paused. Possible values include: "Active", "Inactive". + :type status: str or ~cost_management_client.models.StatusType :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", "Monthly", "Annually". - :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType + :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: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod + :type recurrence_period: ~cost_management_client.models.ExportRecurrencePeriod """ _validation = { - 'format': {'constant': True}, + 'next_run_time_estimate': {'readonly': True}, 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, 'destination': {'required': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'type': {'key': 'definition.type', 'type': 'str'}, 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, - 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'ExportTimePeriod'}, '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'}, + 'configuration': {'key': 'definition.dataSet.configuration', 'type': 'ExportDatasetConfiguration'}, 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, 'status': {'key': 'schedule.status', 'type': 'str'}, 'recurrence': {'key': 'schedule.recurrence', 'type': 'str'}, 'recurrence_period': {'key': 'schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, } - format = "Csv" - granularity = "Daily" - def __init__( self, **kwargs @@ -915,47 +1032,70 @@ def __init__( self.to = kwargs.get('to', None) +class ExportTimePeriod(msrest.serialization.Model): + """The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date for export data. + :type from_property: ~datetime.datetime + :param to: Required. The end date for export data. + :type to: ~datetime.datetime + """ + + _validation = { + 'from_property': {'required': True}, + 'to': {'required': True}, + } + + _attribute_map = { + 'from_property': {'key': 'from', 'type': 'iso-8601'}, + 'to': {'key': 'to', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs['from_property'] + self.to = kwargs['to'] + + class 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 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 granularity: The granularity of rows in the forecast. 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: ~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 + :type configuration: ~cost_management_client.models.QueryDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the forecast. The key of + each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param 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 aggregation: dict[str, ~cost_management_client.models.QueryAggregation] + :param filter: Has filter expression to use in the forecast. + :type filter: ~cost_management_client.models.QueryFilter """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, } _attribute_map = { @@ -967,12 +1107,9 @@ class ForecastDefinition(msrest.serialization.Model): '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 @@ -983,9 +1120,9 @@ def __init__( self.time_period = kwargs.get('time_period', None) self.include_actual_cost = kwargs.get('include_actual_cost', None) self.include_fresh_partial_cost = kwargs.get('include_fresh_partial_cost', None) + self.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) @@ -993,7 +1130,7 @@ 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 +1161,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 +1224,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 """ @@ -1115,7 +1252,7 @@ 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 """ @@ -1137,19 +1274,18 @@ def __init__( class QueryAggregation(msrest.serialization.Model): """The aggregation expression to be used in the query. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. :param name: Required. The name of the column to aggregate. :type name: str - :ivar function: Required. The name of the aggregation function to use. Default value: "Sum". - :vartype function: str + :param function: Required. The name of the aggregation function to use. Possible values + include: "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 +1293,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 +1334,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] """ @@ -1249,39 +1384,36 @@ 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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :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: ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :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, ~azure.mgmt.costmanagement.models.QueryAggregation] + :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[~azure.mgmt.costmanagement.models.QueryGrouping] + :type grouping: list[~cost_management_client.models.QueryGrouping] :param filter: Has filter expression to use in the query. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + :type filter: ~cost_management_client.models.QueryFilter """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, 'grouping': {'max_items': 2, 'min_items': 0}, } @@ -1289,15 +1421,13 @@ class QueryDefinition(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, - 'granularity': {'key': 'dataSet.granularity', 'type': 'str'}, - 'configuration': {'key': 'dataSet.configuration', 'type': 'QueryDatasetConfiguration'}, - 'aggregation': {'key': 'dataSet.aggregation', 'type': '{QueryAggregation}'}, - 'grouping': {'key': 'dataSet.grouping', 'type': '[QueryGrouping]'}, - 'filter': {'key': 'dataSet.filter', 'type': 'QueryFilter'}, + 'granularity': {'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 @@ -1306,6 +1436,7 @@ def __init__( self.type = kwargs['type'] self.timeframe = kwargs['timeframe'] self.time_period = kwargs.get('time_period', None) + self.granularity = kwargs.get('granularity', None) self.configuration = kwargs.get('configuration', None) self.aggregation = kwargs.get('aggregation', None) self.grouping = kwargs.get('grouping', None) @@ -1316,15 +1447,15 @@ 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] + :type or_property: list[~cost_management_client.models.QueryFilter] :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.QueryFilter + :type not_property: ~cost_management_client.models.QueryFilter :param dimension: Has comparison expression for a dimension. - :type dimension: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :type dimension: ~cost_management_client.models.QueryComparisonExpression :param tag: Has comparison expression for a tag. - :type tag: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :type tag: ~cost_management_client.models.QueryComparisonExpression """ _validation = { @@ -1359,7 +1490,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 """ @@ -1399,7 +1530,7 @@ class QueryResult(Resource): :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]] """ @@ -1464,19 +1595,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: "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 +1614,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 +1632,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 +1664,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 +1731,15 @@ 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] + :type or_property: list[~cost_management_client.models.ReportConfigFilter] :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :type not_property: ~cost_management_client.models.ReportConfigFilter :param dimension: Has comparison expression for a dimension. - :type dimension: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :type dimension: ~cost_management_client.models.ReportConfigComparisonExpression :param tag: Has comparison expression for a tag. - :type tag: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :type tag: ~cost_management_client.models.ReportConfigComparisonExpression """ _validation = { @@ -1645,7 +1774,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 +1805,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 """ @@ -1769,29 +1898,29 @@ class View(ProxyResource): :vartype modified_on: ~datetime.datetime :param chart: Chart type of the main view in Cost Analysis. Required. Possible values include: "Area", "Line", "StackedColumn", "GroupedColumn", "Table". - :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :type dataset: ~cost_management_client.models.ReportConfigDataset """ _validation = { @@ -1800,7 +1929,6 @@ class View(ProxyResource): 'type': {'readonly': True}, 'created_on': {'readonly': True}, 'modified_on': {'readonly': True}, - 'type_properties_query_type': {'constant': True}, } _attribute_map = { @@ -1823,8 +1951,6 @@ class View(ProxyResource): 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, } - type_properties_query_type = "Usage" - def __init__( self, **kwargs @@ -1839,6 +1965,7 @@ def __init__( 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) @@ -1850,7 +1977,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..b2b3734e025 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,16 @@ 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 details: Alert details. - :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param source: Source of alert. Possible values include: "Preset", "User". + :type source: str or ~cost_management_client.models.AlertSource :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. @@ -88,6 +89,40 @@ class Alert(Resource): :type status_modification_user_name: str :param status_modification_time: dateTime in which the alert status was last modified. :type status_modification_time: 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. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. 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. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str """ _validation = { @@ -105,7 +140,6 @@ class Alert(Resource): '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'}, @@ -113,6 +147,22 @@ class Alert(Resource): 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + 'time_grain_type': {'key': 'properties.details.timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'properties.details.periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'properties.details.triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'properties.details.resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'properties.details.resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'properties.details.meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'properties.details.tagFilter', 'type': 'object'}, + 'threshold': {'key': 'properties.details.threshold', 'type': 'float'}, + 'operator': {'key': 'properties.details.operator', 'type': 'str'}, + 'amount': {'key': 'properties.details.amount', 'type': 'float'}, + 'unit': {'key': 'properties.details.unit', 'type': 'str'}, + 'current_spend': {'key': 'properties.details.currentSpend', 'type': 'float'}, + 'contact_emails': {'key': 'properties.details.contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'properties.details.contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'properties.details.contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'properties.details.overridingAlert', 'type': 'str'}, } def __init__( @@ -120,22 +170,36 @@ def __init__( *, definition: Optional["AlertPropertiesDefinition"] = None, description: Optional[str] = None, - source: Optional[str] = None, - details: Optional["AlertPropertiesDetails"] = None, + source: Optional[Union[str, "AlertSource"]] = 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, status_modification_user_name: Optional[str] = None, status_modification_time: 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, + resource_filter: Optional[List[object]] = None, + meter_filter: Optional[List[object]] = None, + tag_filter: Optional[object] = None, + threshold: Optional[float] = None, + operator: Optional[Union[str, "AlertOperator"]] = None, + amount: Optional[float] = None, + unit: Optional[str] = None, + current_spend: Optional[float] = None, + contact_emails: Optional[List[str]] = None, + contact_groups: Optional[List[str]] = None, + contact_roles: Optional[List[str]] = None, + overriding_alert: Optional[str] = None, **kwargs ): super(Alert, self).__init__(**kwargs) self.definition = definition self.description = description self.source = source - self.details = details self.cost_entity_id = cost_entity_id self.status = status self.creation_time = creation_time @@ -143,17 +207,39 @@ def __init__( self.modification_time = modification_time self.status_modification_user_name = status_modification_user_name self.status_modification_time = status_modification_time + self.time_grain_type = time_grain_type + self.period_start_date = period_start_date + self.triggered_by = triggered_by + self.resource_group_filter = resource_group_filter + self.resource_filter = resource_filter + self.meter_filter = meter_filter + self.tag_filter = tag_filter + self.threshold = threshold + self.operator = operator + self.amount = amount + self.unit = unit + self.current_spend = current_spend + self.contact_emails = contact_emails + self.contact_groups = contact_groups + self.contact_roles = contact_roles + self.overriding_alert = overriding_alert class 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 +251,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) @@ -176,109 +262,13 @@ def __init__( self.criteria = criteria -class AlertPropertiesDetails(msrest.serialization.Model): - """Alert details. - - :param time_grain_type: Type of timegrain cadence. - :type time_grain_type: str - :param period_start_date: datetime of periodStartDate. - :type period_start_date: str - :param triggered_by: notificationId that triggered this alert. - :type triggered_by: str - :param resource_group_filter: array of resourceGroups to filter by. - :type resource_group_filter: list[object] - :param resource_filter: array of resources to filter by. - :type resource_filter: list[object] - :param meter_filter: array of meters to filter by. - :type meter_filter: list[object] - :param tag_filter: tags to filter by. - :type tag_filter: object - :param threshold: notification threshold percentage as a decimal which activated this alert. - :type threshold: float - :param operator: operator used to compare currentSpend with amount. - :type operator: str - :param amount: budget threshold amount. - :type amount: float - :param unit: unit of currency being used. - :type unit: str - :param current_spend: current spend. - :type current_spend: float - :param contact_emails: list of emails to contact. - :type contact_emails: list[str] - :param contact_groups: list of action groups to broadcast to. - :type contact_groups: list[str] - :param contact_roles: list of contact roles. - :type contact_roles: list[str] - :param overriding_alert: overriding alert. - :type overriding_alert: str - """ - - _attribute_map = { - 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, - 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, - 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, - 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, - 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, - 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, - 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, - 'threshold': {'key': 'threshold', 'type': 'float'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'amount': {'key': 'amount', 'type': 'float'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_spend': {'key': 'currentSpend', 'type': 'float'}, - 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, - 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, - 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, - 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, - } - - def __init__( - self, - *, - time_grain_type: Optional[str] = None, - period_start_date: Optional[str] = None, - triggered_by: Optional[str] = None, - resource_group_filter: Optional[List[object]] = None, - resource_filter: Optional[List[object]] = None, - meter_filter: Optional[List[object]] = None, - tag_filter: Optional[object] = None, - threshold: Optional[float] = None, - operator: Optional[str] = None, - amount: Optional[float] = None, - unit: Optional[str] = None, - current_spend: Optional[float] = None, - contact_emails: Optional[List[str]] = None, - contact_groups: Optional[List[str]] = None, - contact_roles: Optional[List[str]] = None, - overriding_alert: Optional[str] = None, - **kwargs - ): - super(AlertPropertiesDetails, self).__init__(**kwargs) - self.time_grain_type = time_grain_type - self.period_start_date = period_start_date - self.triggered_by = triggered_by - self.resource_group_filter = resource_group_filter - self.resource_filter = resource_filter - self.meter_filter = meter_filter - self.tag_filter = tag_filter - self.threshold = threshold - self.operator = operator - self.amount = amount - self.unit = unit - self.current_spend = current_spend - self.contact_emails = contact_emails - self.contact_groups = contact_groups - self.contact_roles = contact_roles - self.overriding_alert = overriding_alert - - class AlertsResult(msrest.serialization.Model): """Result of alerts. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of alerts. - :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :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 """ @@ -309,81 +299,74 @@ class CommonExportProperties(msrest.serialization.Model): 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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the + next execution time. + :vartype next_run_time_estimate: ~datetime.datetime + :param type: Required. The type of the export. Note that 'Usage' is equivalent to 'ActualCost' + and is applicable to exports that do not yet provide data for charges or amortization for + service reservations. Possible values include: "Usage", "ActualCost", "AmortizedCost". + :type type: str or ~cost_management_client.models.ExportType + :param timeframe: Required. The time frame for pulling data for the export. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the 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 timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :param destination: Required. Has destination for the export being delivered. - :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :type destination: ~cost_management_client.models.ExportDeliveryDestination """ _validation = { - 'format': {'constant': True}, + 'next_run_time_estimate': {'readonly': True}, 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, 'destination': {'required': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'type': {'key': 'definition.type', 'type': 'str'}, 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, - 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'ExportTimePeriod'}, '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'}, + 'configuration': {'key': 'definition.dataSet.configuration', 'type': 'ExportDatasetConfiguration'}, 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, } - format = "Csv" - granularity = "Daily" - def __init__( self, *, type: Union[str, "ExportType"], timeframe: Union[str, "TimeframeType"], destination: "ExportDeliveryDestination", - time_period: Optional["QueryTimePeriod"] = None, - configuration: Optional["QueryDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "QueryAggregation"]] = None, - grouping: Optional[List["QueryGrouping"]] = None, - filter: Optional["QueryFilter"] = None, + format: Optional[Union[str, "FormatType"]] = None, + run_history: Optional["ExportExecutionListResult"] = None, + time_period: Optional["ExportTimePeriod"] = None, + granularity: Optional[Union[str, "GranularityType"]] = None, + configuration: Optional["ExportDatasetConfiguration"] = None, **kwargs ): super(CommonExportProperties, self).__init__(**kwargs) + self.format = format + self.run_history = run_history + self.next_run_time_estimate = None self.type = type self.timeframe = timeframe self.time_period = time_period + self.granularity = granularity self.configuration = configuration - self.aggregation = aggregation - self.grouping = grouping - self.filter = filter self.destination = destination @@ -475,7 +458,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 +477,155 @@ 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 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 + :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. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. 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. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + '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'}, + 'time_grain_type': {'key': 'properties.details.timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'properties.details.periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'properties.details.triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'properties.details.resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'properties.details.resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'properties.details.meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'properties.details.tagFilter', 'type': 'object'}, + 'threshold': {'key': 'properties.details.threshold', 'type': 'float'}, + 'operator': {'key': 'properties.details.operator', 'type': 'str'}, + 'amount': {'key': 'properties.details.amount', 'type': 'float'}, + 'unit': {'key': 'properties.details.unit', 'type': 'str'}, + 'current_spend': {'key': 'properties.details.currentSpend', 'type': 'float'}, + 'contact_emails': {'key': 'properties.details.contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'properties.details.contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'properties.details.contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'properties.details.overridingAlert', 'type': 'str'}, + } + + def __init__( + self, + *, + definition: Optional["AlertPropertiesDefinition"] = None, + description: Optional[str] = None, + source: Optional[Union[str, "AlertSource"]] = 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, + time_grain_type: Optional[Union[str, "AlertTimeGrainType"]] = None, + period_start_date: Optional[str] = None, + triggered_by: Optional[str] = None, + resource_group_filter: Optional[List[object]] = None, + resource_filter: Optional[List[object]] = None, + meter_filter: Optional[List[object]] = None, + tag_filter: Optional[object] = None, + threshold: Optional[float] = None, + operator: Optional[Union[str, "AlertOperator"]] = None, + amount: Optional[float] = None, + unit: Optional[str] = None, + current_spend: Optional[float] = None, + contact_emails: Optional[List[str]] = None, + contact_groups: Optional[List[str]] = None, + contact_roles: Optional[List[str]] = None, + overriding_alert: Optional[str] = None, + **kwargs + ): + super(DismissAlertPayload, self).__init__(**kwargs) + self.definition = definition + self.description = description + self.source = source + 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 + self.time_grain_type = time_grain_type + self.period_start_date = period_start_date + self.triggered_by = triggered_by + self.resource_group_filter = resource_group_filter + self.resource_filter = resource_filter + self.meter_filter = meter_filter + self.tag_filter = tag_filter + self.threshold = threshold + self.operator = operator + self.amount = amount + self.unit = unit + self.current_spend = current_spend + self.contact_emails = contact_emails + self.contact_groups = contact_groups + self.contact_roles = contact_roles + self.overriding_alert = overriding_alert + + class ErrorDetails(msrest.serialization.Model): """The details of the error. @@ -525,18 +657,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 = { @@ -596,7 +729,7 @@ def __init__( class Export(ProxyResource): - """A export resource. + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -609,51 +742,48 @@ 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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the + next execution time. + :vartype next_run_time_estimate: ~datetime.datetime + :param type_properties_definition_type: The type of the export. Note that 'Usage' is equivalent + to 'ActualCost' and is applicable to exports that do not yet provide data for charges or + amortization for service reservations. Possible values include: "Usage", "ActualCost", + "AmortizedCost". + :type type_properties_definition_type: str or ~cost_management_client.models.ExportType + :param timeframe: The time frame for pulling data for the export. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the query. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :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 timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :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 + :type destination: ~cost_management_client.models.ExportDeliveryDestination + :param status: The status of the export's schedule. If 'Inactive', the export's schedule is + paused. Possible values include: "Active", "Inactive". + :type status: str or ~cost_management_client.models.StatusType :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", "Monthly", "Annually". - :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType + :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: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod + :type recurrence_period: ~cost_management_client.models.ExportRecurrencePeriod """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'format': {'constant': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { @@ -662,34 +792,30 @@ class Export(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, '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'}, + 'time_period': {'key': 'properties.definition.timePeriod', 'type': 'ExportTimePeriod'}, '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'}, + 'configuration': {'key': 'properties.definition.dataSet.configuration', 'type': 'ExportDatasetConfiguration'}, 'destination': {'key': 'properties.deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, 'status': {'key': 'properties.schedule.status', 'type': 'str'}, 'recurrence': {'key': 'properties.schedule.recurrence', 'type': 'str'}, 'recurrence_period': {'key': 'properties.schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, } - format = "Csv" - granularity = "Daily" - def __init__( self, *, e_tag: Optional[str] = None, + format: Optional[Union[str, "FormatType"]] = None, + run_history: Optional["ExportExecutionListResult"] = 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, + time_period: Optional["ExportTimePeriod"] = None, + granularity: Optional[Union[str, "GranularityType"]] = None, + configuration: Optional["ExportDatasetConfiguration"] = None, destination: Optional["ExportDeliveryDestination"] = None, status: Optional[Union[str, "StatusType"]] = None, recurrence: Optional[Union[str, "RecurrenceType"]] = None, @@ -697,19 +823,43 @@ def __init__( **kwargs ): super(Export, self).__init__(e_tag=e_tag, **kwargs) + self.format = format + self.run_history = run_history + self.next_run_time_estimate = None self.type_properties_definition_type = type_properties_definition_type self.timeframe = timeframe self.time_period = time_period + self.granularity = granularity self.configuration = configuration - self.aggregation = aggregation - self.grouping = grouping - self.filter = filter self.destination = destination self.status = status self.recurrence = recurrence self.recurrence_period = recurrence_period +class ExportDatasetConfiguration(msrest.serialization.Model): + """The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns. + + :param columns: Array of column names to be included in the export. If not provided then the + export will include all available columns. The available columns can vary by customer channel + (see examples). + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__( + self, + *, + columns: Optional[List[str]] = None, + **kwargs + ): + super(ExportDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + class ExportDeliveryDestination(msrest.serialization.Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the Microsoft.CostManagementExports resource provider. This is required once per subscription. When creating an export in the Azure portal, it is done automatically, however API users need to register the subscription. For more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services . @@ -750,7 +900,7 @@ def __init__( class ExportExecution(Resource): - """A export execution. + """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -764,23 +914,26 @@ 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 - :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 execution_type: str or ~cost_management_client.models.ExecutionType + :param status: The last known status of the export execution. Possible values include: + "Queued", "InProgress", "Completed", "Failed", "Timeout", "NewDataNotAvailable", + "DataNotAvailable". + :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. + executions it is the user email. For scheduled executions it is 'System'. :type submitted_by: str :param submitted_time: The time when export was queued to be executed. :type submitted_time: ~datetime.datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: ~datetime.datetime - :param processing_end_time: The time when export execution finished. + :param processing_end_time: The time when the export execution finished. :type processing_end_time: ~datetime.datetime - :param file_name: The name of the file export got written to. + :param file_name: The name of the exported file. :type file_name: str - :param run_settings: The common properties of the export. - :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + :param run_settings: The export settings that were in effect for this execution. + :type run_settings: ~cost_management_client.models.CommonExportProperties + :param error: The details of any error. + :type error: ~cost_management_client.models.ErrorDetails """ _validation = { @@ -803,6 +956,7 @@ class ExportExecution(Resource): 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, 'file_name': {'key': 'properties.fileName', 'type': 'str'}, 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + 'error': {'key': 'properties.error', 'type': 'ErrorDetails'}, } def __init__( @@ -816,6 +970,7 @@ def __init__( processing_end_time: Optional[datetime.datetime] = None, file_name: Optional[str] = None, run_settings: Optional["CommonExportProperties"] = None, + error: Optional["ErrorDetails"] = None, **kwargs ): super(ExportExecution, self).__init__(**kwargs) @@ -827,15 +982,16 @@ def __init__( self.processing_end_time = processing_end_time self.file_name = file_name self.run_settings = run_settings + self.error = error class ExportExecutionListResult(msrest.serialization.Model): - """Result of listing exports execution history of a export by name. + """Result of listing the execution history of an export. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of export executions. - :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] + :ivar value: A list of export executions. + :vartype value: list[~cost_management_client.models.ExportExecution] """ _validation = { @@ -860,7 +1016,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 = { @@ -886,89 +1042,81 @@ class ExportProperties(CommonExportProperties): 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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + Possible values include: "Csv". + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the + next execution time. + :vartype next_run_time_estimate: ~datetime.datetime + :param type: Required. The type of the export. Note that 'Usage' is equivalent to 'ActualCost' + and is applicable to exports that do not yet provide data for charges or amortization for + service reservations. Possible values include: "Usage", "ActualCost", "AmortizedCost". + :type type: str or ~cost_management_client.models.ExportType + :param timeframe: Required. The time frame for pulling data for the export. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the 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 timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + Possible values include: "Daily". + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :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 + :type destination: ~cost_management_client.models.ExportDeliveryDestination + :param status: The status of the export's schedule. If 'Inactive', the export's schedule is + paused. Possible values include: "Active", "Inactive". + :type status: str or ~cost_management_client.models.StatusType :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", "Monthly", "Annually". - :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType + :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: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod + :type recurrence_period: ~cost_management_client.models.ExportRecurrencePeriod """ _validation = { - 'format': {'constant': True}, + 'next_run_time_estimate': {'readonly': True}, 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, 'destination': {'required': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'type': {'key': 'definition.type', 'type': 'str'}, 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, - 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'ExportTimePeriod'}, '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'}, + 'configuration': {'key': 'definition.dataSet.configuration', 'type': 'ExportDatasetConfiguration'}, 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, 'status': {'key': 'schedule.status', 'type': 'str'}, 'recurrence': {'key': 'schedule.recurrence', 'type': 'str'}, 'recurrence_period': {'key': 'schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, } - format = "Csv" - granularity = "Daily" - def __init__( self, *, type: Union[str, "ExportType"], timeframe: Union[str, "TimeframeType"], destination: "ExportDeliveryDestination", - time_period: Optional["QueryTimePeriod"] = None, - configuration: Optional["QueryDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "QueryAggregation"]] = None, - grouping: Optional[List["QueryGrouping"]] = None, - filter: Optional["QueryFilter"] = None, + format: Optional[Union[str, "FormatType"]] = None, + run_history: Optional["ExportExecutionListResult"] = None, + time_period: Optional["ExportTimePeriod"] = None, + granularity: Optional[Union[str, "GranularityType"]] = None, + configuration: Optional["ExportDatasetConfiguration"] = None, status: Optional[Union[str, "StatusType"]] = None, recurrence: Optional[Union[str, "RecurrenceType"]] = None, recurrence_period: Optional["ExportRecurrencePeriod"] = None, **kwargs ): - super(ExportProperties, self).__init__(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter, destination=destination, **kwargs) + super(ExportProperties, self).__init__(format=format, run_history=run_history, type=type, timeframe=timeframe, time_period=time_period, granularity=granularity, configuration=configuration, destination=destination, **kwargs) self.status = status self.recurrence = recurrence self.recurrence_period = recurrence_period @@ -1006,47 +1154,73 @@ def __init__( self.to = to +class ExportTimePeriod(msrest.serialization.Model): + """The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date for export data. + :type from_property: ~datetime.datetime + :param to: Required. The end date for export data. + :type to: ~datetime.datetime + """ + + _validation = { + 'from_property': {'required': True}, + 'to': {'required': True}, + } + + _attribute_map = { + 'from_property': {'key': 'from', 'type': 'iso-8601'}, + 'to': {'key': 'to', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + from_property: datetime.datetime, + to: datetime.datetime, + **kwargs + ): + super(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + class 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 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 granularity: The granularity of rows in the forecast. 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: ~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 + :type configuration: ~cost_management_client.models.QueryDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the forecast. The key of + each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param 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 aggregation: dict[str, ~cost_management_client.models.QueryAggregation] + :param filter: Has filter expression to use in the forecast. + :type filter: ~cost_management_client.models.QueryFilter """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, - 'grouping': {'max_items': 2, 'min_items': 0}, } _attribute_map = { @@ -1058,12 +1232,9 @@ class ForecastDefinition(msrest.serialization.Model): '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, *, @@ -1072,9 +1243,9 @@ def __init__( time_period: Optional["QueryTimePeriod"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, + 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 ): @@ -1084,9 +1255,9 @@ def __init__( self.time_period = time_period self.include_actual_cost = include_actual_cost self.include_fresh_partial_cost = include_fresh_partial_cost + self.granularity = granularity self.configuration = configuration self.aggregation = aggregation - self.grouping = grouping self.filter = filter @@ -1094,7 +1265,7 @@ 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 +1300,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 +1365,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 """ @@ -1222,7 +1393,7 @@ 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 """ @@ -1247,19 +1418,18 @@ def __init__( class QueryAggregation(msrest.serialization.Model): """The aggregation expression to be used in the query. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. :param name: Required. The name of the column to aggregate. :type name: str - :ivar function: Required. The name of the aggregation function to use. Default value: "Sum". - :vartype function: str + :param function: Required. The name of the aggregation function to use. Possible values + include: "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 +1437,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 +1484,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] """ @@ -1370,39 +1540,36 @@ 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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :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: ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :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, ~azure.mgmt.costmanagement.models.QueryAggregation] + :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[~azure.mgmt.costmanagement.models.QueryGrouping] + :type grouping: list[~cost_management_client.models.QueryGrouping] :param filter: Has filter expression to use in the query. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + :type filter: ~cost_management_client.models.QueryFilter """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, - 'granularity': {'constant': True}, 'grouping': {'max_items': 2, 'min_items': 0}, } @@ -1410,21 +1577,20 @@ class QueryDefinition(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, - 'granularity': {'key': 'dataSet.granularity', 'type': 'str'}, - 'configuration': {'key': 'dataSet.configuration', 'type': 'QueryDatasetConfiguration'}, - 'aggregation': {'key': 'dataSet.aggregation', 'type': '{QueryAggregation}'}, - 'grouping': {'key': 'dataSet.grouping', 'type': '[QueryGrouping]'}, - 'filter': {'key': 'dataSet.filter', 'type': 'QueryFilter'}, + 'granularity': {'key': 'dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'dataset.filter', 'type': 'QueryFilter'}, } - granularity = "Daily" - def __init__( self, *, type: Union[str, "ExportType"], timeframe: Union[str, "TimeframeType"], time_period: Optional["QueryTimePeriod"] = None, + granularity: Optional[Union[str, "GranularityType"]] = None, configuration: Optional["QueryDatasetConfiguration"] = None, aggregation: Optional[Dict[str, "QueryAggregation"]] = None, grouping: Optional[List["QueryGrouping"]] = None, @@ -1435,6 +1601,7 @@ def __init__( self.type = type self.timeframe = timeframe self.time_period = time_period + self.granularity = granularity self.configuration = configuration self.aggregation = aggregation self.grouping = grouping @@ -1445,15 +1612,15 @@ 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] + :type or_property: list[~cost_management_client.models.QueryFilter] :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.QueryFilter + :type not_property: ~cost_management_client.models.QueryFilter :param dimension: Has comparison expression for a dimension. - :type dimension: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :type dimension: ~cost_management_client.models.QueryComparisonExpression :param tag: Has comparison expression for a tag. - :type tag: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :type tag: ~cost_management_client.models.QueryComparisonExpression """ _validation = { @@ -1494,7 +1661,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 """ @@ -1537,7 +1704,7 @@ class QueryResult(Resource): :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]] """ @@ -1609,19 +1776,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: "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 +1795,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 +1816,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 +1852,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 +1928,15 @@ 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] + :type or_property: list[~cost_management_client.models.ReportConfigFilter] :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :type not_property: ~cost_management_client.models.ReportConfigFilter :param dimension: Has comparison expression for a dimension. - :type dimension: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :type dimension: ~cost_management_client.models.ReportConfigComparisonExpression :param tag: Has comparison expression for a tag. - :type tag: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :type tag: ~cost_management_client.models.ReportConfigComparisonExpression """ _validation = { @@ -1811,7 +1977,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 +2011,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 """ @@ -1944,29 +2110,29 @@ class View(ProxyResource): :vartype modified_on: ~datetime.datetime :param chart: Chart type of the main view in Cost Analysis. Required. Possible values include: "Area", "Line", "StackedColumn", "GroupedColumn", "Table". - :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :type dataset: ~cost_management_client.models.ReportConfigDataset """ _validation = { @@ -1975,7 +2141,6 @@ class View(ProxyResource): 'type': {'readonly': True}, 'created_on': {'readonly': True}, 'modified_on': {'readonly': True}, - 'type_properties_query_type': {'constant': True}, } _attribute_map = { @@ -1998,8 +2163,6 @@ class View(ProxyResource): 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, } - type_properties_query_type = "Usage" - def __init__( self, *, @@ -2011,6 +2174,7 @@ 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, @@ -2026,6 +2190,7 @@ def __init__( 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 @@ -2037,7 +2202,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/_alert_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py index dc1b90de5db..bb8740ae07d 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py @@ -17,7 +17,7 @@ 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, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -29,7 +29,7 @@ class AlertOperations(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. @@ -70,16 +70,17 @@ def list( 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 + :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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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), } @@ -93,7 +94,6 @@ def list( 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 @@ -106,10 +106,238 @@ def list( deserialized = self._deserialize('AlertsResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts'} + 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # 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'] = 'application/json' + + 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 + definition=None, # type: Optional["models.AlertPropertiesDefinition"] + description=None, # type: Optional[str] + source=None, # type: Optional[Union[str, "models.AlertSource"]] + cost_entity_id=None, # type: Optional[str] + status=None, # type: Optional[Union[str, "models.AlertStatus"]] + creation_time=None, # type: Optional[str] + close_time=None, # type: Optional[str] + modification_time=None, # type: Optional[str] + status_modification_user_name=None, # type: Optional[str] + status_modification_time=None, # type: Optional[str] + time_grain_type=None, # type: Optional[Union[str, "models.AlertTimeGrainType"]] + period_start_date=None, # type: Optional[str] + triggered_by=None, # type: Optional[str] + resource_group_filter=None, # type: Optional[List[object]] + resource_filter=None, # type: Optional[List[object]] + meter_filter=None, # type: Optional[List[object]] + tag_filter=None, # type: Optional[object] + threshold=None, # type: Optional[float] + operator=None, # type: Optional[Union[str, "models.AlertOperator"]] + amount=None, # type: Optional[float] + unit=None, # type: Optional[str] + current_spend=None, # type: Optional[float] + contact_emails=None, # type: Optional[List[str]] + contact_groups=None, # type: Optional[List[str]] + contact_roles=None, # type: Optional[List[str]] + overriding_alert=None, # type: Optional[str] + **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 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. + :type source: str or ~cost_management_client.models.AlertSource + :param cost_entity_id: related budget. + :type cost_entity_id: str + :param status: alert status. + :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 + :param time_grain_type: Type of timegrain cadence. + :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. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. + :type operator: str or ~cost_management_client.models.AlertOperator + :param amount: budget threshold amount. + :type amount: float + :param unit: unit of currency being used. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.DismissAlertPayload(definition=definition, description=description, source=source, cost_entity_id=cost_entity_id, status=status, creation_time=creation_time, close_time=close_time, modification_time=modification_time, status_modification_user_name=status_modification_user_name, status_modification_time=status_modification_time, time_grain_type=time_grain_type, period_start_date=period_start_date, triggered_by=triggered_by, resource_group_filter=resource_group_filter, resource_filter=resource_filter, meter_filter=meter_filter, tag_filter=tag_filter, threshold=threshold, operator=operator, amount=amount, unit=unit, current_spend=current_spend, contact_emails=contact_emails, contact_groups=contact_groups, contact_roles=contact_roles, overriding_alert=overriding_alert) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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, @@ -123,21 +351,22 @@ def list_external( :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 :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: 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # Construct URL - url = self.list_external.metadata['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'), @@ -152,7 +381,6 @@ def list_external( 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 @@ -165,7 +393,7 @@ def list_external( deserialized = self._deserialize('AlertsResult', 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'} + 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/_dimension_operations.py index aa72450bb03..e57617745c2 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py @@ -18,7 +18,7 @@ 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]] @@ -30,7 +30,7 @@ class DimensionOperations(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. @@ -54,76 +54,77 @@ 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.DimensionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + 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): @@ -149,7 +150,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 +162,68 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + 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 +249,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/_export_operations.py index b77ce24bc8a..9a7096c3366 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py @@ -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 ExportOperations(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,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer): def list( self, scope, # type: str + expand=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "models.ExportListResult" @@ -69,17 +70,21 @@ def list( '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. :type scope: str + :param expand: May be used to expand the properties within an export. Currently only + 'runHistory' is supported and will return information for the last execution of each export. + :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExportListResult or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.ExportListResult + :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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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), } @@ -88,12 +93,13 @@ def list( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] 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 @@ -106,15 +112,16 @@ 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, scope, # type: str export_name, # type: str + expand=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "models.Export" @@ -139,17 +146,21 @@ def get( :type scope: str :param export_name: Export Name. :type export_name: str + :param expand: May be used to expand the properties within an export. Currently only + 'runHistory' is supported and will return information for the last 10 executions of the export. + :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Export or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Export + :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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -159,12 +170,13 @@ def get( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] 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 @@ -177,23 +189,23 @@ 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] + format=None, # type: Optional[Union[str, "models.FormatType"]] + run_history=None, # type: Optional["models.ExportExecutionListResult"] 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"] + time_period=None, # type: Optional["models.ExportTimePeriod"] + granularity=None, # type: Optional[Union[str, "models.GranularityType"]] + configuration=None, # type: Optional["models.ExportDatasetConfiguration"] destination=None, # type: Optional["models.ExportDeliveryDestination"] status=None, # type: Optional[Union[str, "models.StatusType"]] recurrence=None, # type: Optional[Union[str, "models.RecurrenceType"]] @@ -201,7 +213,9 @@ def create_or_update( **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, @@ -225,49 +239,48 @@ def create_or_update( :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 + :param format: The format of the export being delivered. Currently only 'Csv' is supported. + :type format: str or ~cost_management_client.models.FormatType + :param run_history: If requested, has the most recent execution history for the export. + :type run_history: ~cost_management_client.models.ExportExecutionListResult + :param type: The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is + applicable to exports that do not yet provide data for charges or amortization for service + reservations. + :type type: str or ~cost_management_client.models.ExportType + :param timeframe: The time frame for pulling data for the export. 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 + :type timeframe: str or ~cost_management_client.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~cost_management_client.models.ExportTimePeriod + :param granularity: The granularity of rows in the export. Currently only 'Daily' is supported. + :type granularity: str or ~cost_management_client.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: ~cost_management_client.models.ExportDatasetConfiguration :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 + :type destination: ~cost_management_client.models.ExportDeliveryDestination + :param status: The status of the export's schedule. If 'Inactive', the export's schedule is + paused. + :type status: str or ~cost_management_client.models.StatusType :param recurrence: The schedule recurrence. - :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType + :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: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod + :type recurrence_period: ~cost_management_client.models.ExportRecurrencePeriod :keyword callable cls: A custom type or function that will be passed the direct response - :return: Export or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Export or ~azure.mgmt.costmanagement.models.Export + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _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) - api_version = "2019-11-01" + _parameters = models.Export(e_tag=e_tag, format=format, run_history=run_history, type_properties_definition_type=type, timeframe=timeframe, time_period=time_period, granularity=granularity, configuration=configuration, destination=destination, status=status, recurrence=recurrence, recurrence_period=recurrence_period) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -283,7 +296,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'Export') body_content_kwargs['content'] = body_content @@ -297,7 +309,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 +316,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 +350,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -362,7 +374,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,9 +384,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, @@ -384,7 +395,7 @@ def execute( **kwargs # type: Any ): # type: (...) -> None - """The operation to execute a export. + """The operation to execute an export. :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, @@ -406,16 +417,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -429,7 +441,6 @@ def execute( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -440,9 +451,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, @@ -451,7 +462,7 @@ def get_execution_history( **kwargs # type: Any ): # type: (...) -> "models.ExportExecutionListResult" - """The operation to get the execution history of an export for the defined scope by export name. + """The operation to get the execution history of an export for the defined scope and export name. :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, @@ -473,16 +484,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -497,7 +509,6 @@ def get_execution_history( 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 @@ -510,7 +521,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..3a0927f812a 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 @@ -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. @@ -53,9 +53,9 @@ def usage( time_period=None, # type: Optional["models.QueryTimePeriod"] include_actual_cost=None, # type: Optional[bool] include_fresh_partial_cost=None, # type: Optional[bool] + granularity=None, # type: Optional[Union[str, "models.GranularityType"]] configuration=None, # type: Optional["models.QueryDatasetConfiguration"] - aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] - grouping=None, # type: Optional[List["QueryGrouping"]] + aggregation=None, # type: Optional[Dict[str, "models.QueryAggregation"]] query_filter=None, # type: Optional["models.QueryFilter"] **kwargs # type: Any ): @@ -80,46 +80,46 @@ def usage( specific for partners. :type scope: str :param type: The type of the forecast. - :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.models.ForecastTimeframeType :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str :param time_period: Has time period for pulling data for the forecast. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :type time_period: ~cost_management_client.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 granularity: The granularity of rows in the forecast. + :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: ~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 + :type configuration: ~cost_management_client.models.QueryDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the forecast. The key of + each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param 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 + :type aggregation: dict[str, ~cost_management_client.models.QueryAggregation] + :param query_filter: Has filter expression to use in the forecast. + :type query_filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) - api_version = "2019-11-01" + _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, granularity=granularity, configuration=configuration, aggregation=aggregation, filter=query_filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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), } @@ -136,7 +136,6 @@ def usage( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'ForecastDefinition') body_content_kwargs['content'] = body_content @@ -153,10 +152,10 @@ def usage( 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, @@ -168,9 +167,9 @@ def external_cloud_provider_usage( time_period=None, # type: Optional["models.QueryTimePeriod"] include_actual_cost=None, # type: Optional[bool] include_fresh_partial_cost=None, # type: Optional[bool] + granularity=None, # type: Optional[Union[str, "models.GranularityType"]] configuration=None, # type: Optional["models.QueryDatasetConfiguration"] - aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] - grouping=None, # type: Optional[List["QueryGrouping"]] + aggregation=None, # type: Optional[Dict[str, "models.QueryAggregation"]] query_filter=None, # type: Optional["models.QueryFilter"] **kwargs # type: Any ): @@ -180,51 +179,51 @@ 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 + :type type: str or ~cost_management_client.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 + :type timeframe: str or ~cost_management_client.models.ForecastTimeframeType :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. :type filter: str :param time_period: Has time period for pulling data for the forecast. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :type time_period: ~cost_management_client.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 granularity: The granularity of rows in the forecast. + :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: ~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 + :type configuration: ~cost_management_client.models.QueryDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the forecast. The key of + each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param 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 + :type aggregation: dict[str, ~cost_management_client.models.QueryAggregation] + :param query_filter: Has filter expression to use in the forecast. + :type query_filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) - api_version = "2019-11-01" + _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, granularity=granularity, configuration=configuration, aggregation=aggregation, filter=query_filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -242,7 +241,6 @@ def external_cloud_provider_usage( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'ForecastDefinition') body_content_kwargs['content'] = body_content @@ -259,7 +257,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/_operation_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py index 6d83e16b9dc..1cb60557f8a 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py @@ -18,7 +18,7 @@ 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]] @@ -30,7 +30,7 @@ class OperationOperations(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. @@ -49,35 +49,36 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - else: - url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + 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): @@ -103,4 +104,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..b97422f04df 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 @@ -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. @@ -50,9 +50,10 @@ def usage( type, # type: Union[str, "models.ExportType"] timeframe, # type: Union[str, "models.TimeframeType"] time_period=None, # type: Optional["models.QueryTimePeriod"] + granularity=None, # type: Optional[Union[str, "models.GranularityType"]] configuration=None, # type: Optional["models.QueryDatasetConfiguration"] - aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] - grouping=None, # type: Optional[List["QueryGrouping"]] + aggregation=None, # type: Optional[Dict[str, "models.QueryAggregation"]] + grouping=None, # type: Optional[List["models.QueryGrouping"]] filter=None, # type: Optional["models.QueryFilter"] **kwargs # type: Any ): @@ -77,38 +78,41 @@ def usage( specific for partners. :type scope: str :param type: The type of the query. - :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :type type: str or ~cost_management_client.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 + :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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param granularity: The granularity of rows in the query. + :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: ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :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, ~azure.mgmt.costmanagement.models.QueryAggregation] + :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[~azure.mgmt.costmanagement.models.QueryGrouping] + :type grouping: list[~cost_management_client.models.QueryGrouping] :param filter: Has filter expression to use in the query. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + :type filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) - api_version = "2019-11-01" + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, granularity=granularity, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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), } @@ -123,7 +127,6 @@ def usage( 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 @@ -140,10 +143,10 @@ def usage( 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, @@ -152,9 +155,10 @@ def usage_by_external_cloud_provider_type( type, # type: Union[str, "models.ExportType"] timeframe, # type: Union[str, "models.TimeframeType"] time_period=None, # type: Optional["models.QueryTimePeriod"] + granularity=None, # type: Optional[Union[str, "models.GranularityType"]] configuration=None, # type: Optional["models.QueryDatasetConfiguration"] - aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] - grouping=None, # type: Optional[List["QueryGrouping"]] + aggregation=None, # type: Optional[Dict[str, "models.QueryAggregation"]] + grouping=None, # type: Optional[List["models.QueryGrouping"]] filter=None, # type: Optional["models.QueryFilter"] **kwargs # type: Any ): @@ -164,43 +168,46 @@ 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 + :type type: str or ~cost_management_client.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 + :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 + :type time_period: ~cost_management_client.models.QueryTimePeriod + :param granularity: The granularity of rows in the query. + :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: ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :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, ~azure.mgmt.costmanagement.models.QueryAggregation] + :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[~azure.mgmt.costmanagement.models.QueryGrouping] + :type grouping: list[~cost_management_client.models.QueryGrouping] :param filter: Has filter expression to use in the query. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + :type filter: ~cost_management_client.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}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) - api_version = "2019-11-01" + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, granularity=granularity, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -216,7 +223,6 @@ def usage_by_external_cloud_provider_type( 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 @@ -233,7 +239,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/_view_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py index bf08f8e37e3..7e14d32b97e 100644 --- a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py @@ -18,7 +18,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, Iterable, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -30,7 +30,7 @@ class ViewOperations(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. @@ -49,35 +49,36 @@ 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.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - else: - url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + 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): @@ -103,64 +104,65 @@ 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.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + 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): @@ -186,7 +188,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 +201,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), } @@ -222,7 +225,6 @@ def get( 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 @@ -235,10 +237,10 @@ 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, @@ -249,15 +251,18 @@ def create_or_update( 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"]] + kpis=None, # type: Optional[List["models.KpiProperties"]] + pivots=None, # type: Optional[List["models.PivotProperties"]] + type=None, # type: Optional[Union[str, "models.ReportType"]] timeframe=None, # type: Optional[Union[str, "models.ReportTimeframeType"]] time_period=None, # type: Optional["models.ReportConfigTimePeriod"] dataset=None, # type: Optional["models.ReportConfigDataset"] **kwargs # type: Any ): # type: (...) -> "models.View" - """The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + """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 @@ -285,36 +290,41 @@ def create_or_update( 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 + :type chart: str or ~cost_management_client.models.ChartType :param accumulated: Show costs accumulated over time. - :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. - :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] + :type pivots: list[~cost_management_client.models.PivotProperties] + :param 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. + :type 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. - :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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :type dataset: ~cost_management_client.models.ReportConfigDataset :keyword callable cls: A custom type or function that will be passed the direct response - :return: View or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) - api_version = "2019-11-01" + _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, type_properties_query_type=type, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), } @@ -329,7 +339,6 @@ def create_or_update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'View') body_content_kwargs['content'] = body_content @@ -343,7 +352,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 +359,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 +375,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), } @@ -389,7 +398,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -400,9 +408,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 +442,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -458,7 +467,6 @@ def get_by_scope( 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 @@ -471,10 +479,10 @@ 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, @@ -486,15 +494,18 @@ def create_or_update_by_scope( 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"]] + kpis=None, # type: Optional[List["models.KpiProperties"]] + pivots=None, # type: Optional[List["models.PivotProperties"]] + type=None, # type: Optional[Union[str, "models.ReportType"]] timeframe=None, # type: Optional[Union[str, "models.ReportTimeframeType"]] time_period=None, # type: Optional["models.ReportConfigTimePeriod"] dataset=None, # type: Optional["models.ReportConfigDataset"] **kwargs # type: Any ): # type: (...) -> "models.View" - """The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + """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, @@ -540,36 +551,41 @@ def create_or_update_by_scope( 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 + :type chart: str or ~cost_management_client.models.ChartType :param accumulated: Show costs accumulated over time. - :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. - :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] + :type pivots: list[~cost_management_client.models.PivotProperties] + :param 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. + :type 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. - :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 + :type time_period: ~cost_management_client.models.ReportConfigTimePeriod :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :type dataset: ~cost_management_client.models.ReportConfigDataset :keyword callable cls: A custom type or function that will be passed the direct response - :return: View or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) - _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=view_properties_scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) - api_version = "2019-11-01" + _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, type_properties_query_type=type, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2020-06-01" content_type = kwargs.pop("content_type", "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'), @@ -585,7 +601,6 @@ def create_or_update_by_scope( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_parameters, 'View') body_content_kwargs['content'] = body_content @@ -599,7 +614,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 +621,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 +656,17 @@ 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}) - api_version = "2019-11-01" + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" # 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'), @@ -665,7 +680,6 @@ def delete_by_scope( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -676,6 +690,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..429de4908f0 --- /dev/null +++ b/src/costmanagement/report.md @@ -0,0 +1,565 @@ +# Azure CLI Module Creation Report + +### costmanagement alert dismiss + +dismiss a costmanagement alert. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement alert|Alerts| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|dismiss|Dismiss| + +#### 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| +|**--details-time-grain-type**|choice|Type of timegrain cadence|time_grain_type|timeGrainType| +|**--details-period-start-date**|string|datetime of periodStartDate|period_start_date|periodStartDate| +|**--details-triggered-by**|string|notificationId that triggered this alert|triggered_by|triggeredBy| +|**--details-resource-group-filter**|array|array of resourceGroups to filter by|resource_group_filter|resourceGroupFilter| +|**--details-resource-filter**|array|array of resources to filter by|resource_filter|resourceFilter| +|**--details-meter-filter**|array|array of meters to filter by|meter_filter|meterFilter| +|**--details-tag-filter**|any|tags to filter by|tag_filter|tagFilter| +|**--details-threshold**|number|notification threshold percentage as a decimal which activated this alert|threshold|threshold| +|**--details-operator**|choice|operator used to compare currentSpend with amount|operator|operator| +|**--details-amount**|number|budget threshold amount|amount|amount| +|**--details-unit**|string|unit of currency being used|unit|unit| +|**--details-current-spend**|number|current spend|current_spend|currentSpend| +|**--details-contact-emails**|array|list of emails to contact|contact_emails|contactEmails| +|**--details-contact-groups**|array|list of action groups to broadcast to|contact_groups|contactGroups| +|**--details-contact-roles**|array|list of contact roles|contact_roles|contactRoles| +|**--details-overriding-alert**|string|overriding alert|overriding_alert|overridingAlert| + +### costmanagement alert list + +list a costmanagement alert. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement alert|Alerts| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### costmanagement alert list-external + +list-external a costmanagement alert. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement alert|Alerts| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list-external|ListExternal| + +#### 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| + +### costmanagement alert show + +show a costmanagement alert. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement alert|Alerts| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|show|Get| + +#### 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| + +### costmanagement dimension by-external-cloud-provider-type + +by-external-cloud-provider-type a costmanagement dimension. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement dimension|Dimensions| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|by-external-cloud-provider-type|ByExternalCloudProviderType| + +#### 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| + +### costmanagement dimension list + +list a costmanagement dimension. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement dimension|Dimensions| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| + +### costmanagement export create + +create a costmanagement export. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement export|Exports| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|create|CreateOrUpdate#Create| + +#### 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| +|**--definition-type**|choice|The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.|type|type| +|**--definition-timeframe**|choice|The time frame for pulling data for the export. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--definition-time-period**|object|Has time period for pulling data for the export.|time_period|timePeriod| +|**--definition-data-set-configuration**|object|The export dataset configuration.|configuration|configuration| +|**--delivery-info-destination**|object|Has destination for the export being delivered.|destination|destination| +|**--schedule-status**|choice|The status of the export's schedule. If 'Inactive', the export's schedule is paused.|status|status| +|**--schedule-recurrence**|choice|The schedule recurrence.|recurrence|recurrence| +|**--schedule-recurrence-period**|object|Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date.|recurrence_period|recurrencePeriod| + +### costmanagement export delete + +delete a costmanagement export. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement export|Exports| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|delete|Delete| + +#### 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| + +### costmanagement export execute + +execute a costmanagement export. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement export|Exports| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|execute|Execute| + +#### 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| + +### costmanagement export get-execution-history + +get-execution-history a costmanagement export. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement export|Exports| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|get-execution-history|GetExecutionHistory| + +#### 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| + +### costmanagement export list + +list a costmanagement export. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement export|Exports| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|List| + +#### 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| +|**--expand**|string|May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last execution of each export.|expand|$expand| + +### costmanagement export show + +show a costmanagement export. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement export|Exports| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|show|Get| + +#### 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| +|**--expand**|string|May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 executions of the export.|expand|$expand| + +### costmanagement export update + +update a costmanagement export. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement export|Exports| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|update|CreateOrUpdate#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| +|**--definition-type**|choice|The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations.|type|type| +|**--definition-timeframe**|choice|The time frame for pulling data for the export. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--definition-time-period**|object|Has time period for pulling data for the export.|time_period|timePeriod| +|**--definition-data-set-configuration**|object|The export dataset configuration.|configuration|configuration| +|**--delivery-info-destination**|object|Has destination for the export being delivered.|destination|destination| +|**--schedule-status**|choice|The status of the export's schedule. If 'Inactive', the export's schedule is paused.|status|status| +|**--schedule-recurrence**|choice|The schedule recurrence.|recurrence|recurrence| +|**--schedule-recurrence-period**|object|Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date.|recurrence_period|recurrencePeriod| + +### costmanagement forecast external-cloud-provider-usage + +external-cloud-provider-usage a costmanagement forecast. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement forecast|Forecast| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|external-cloud-provider-usage|ExternalCloudProviderUsage| + +#### 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| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--dataset-aggregation**|dictionary|Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses.|aggregation|aggregation| +|**--dataset-filter**|object|Has filter expression to use in the forecast.|query_filter|filter| + +### costmanagement forecast usage + +usage a costmanagement forecast. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement forecast|Forecast| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|usage|Usage| + +#### 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| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--dataset-aggregation**|dictionary|Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses.|aggregation|aggregation| +|**--dataset-filter**|object|Has filter expression to use in the forecast.|query_filter|filter| + +### costmanagement query usage + +usage a costmanagement query. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement query|Query| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|usage|Usage| + +#### 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| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--dataset-aggregation**|dictionary|Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses.|aggregation|aggregation| +|**--dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--dataset-filter**|object|Has filter expression to use in the query.|filter|filter| + +### costmanagement query usage-by-external-cloud-provider-type + +usage-by-external-cloud-provider-type a costmanagement query. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement query|Query| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|usage-by-external-cloud-provider-type|UsageByExternalCloudProviderType| + +#### 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| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration|configuration| +|**--dataset-aggregation**|dictionary|Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses.|aggregation|aggregation| +|**--dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping|grouping| +|**--dataset-filter**|object|Has filter expression to use in the query.|filter|filter| + +### costmanagement view create + +create a costmanagement view. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement view|Views| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|create|CreateOrUpdateByScope| +|create|CreateOrUpdate#Create| + +#### 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| +|**--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| +|**--query-timeframe**|choice|The time frame for pulling data for the report. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--query-time-period**|object|Has time period for pulling data for the report.|time_period|timePeriod| +|**--query-dataset**|object|Has definition for data in this report config.|dataset|dataset| +|**--scope**|string|Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.|scope|scope| + +### costmanagement view delete + +delete a costmanagement view. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement view|Views| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|delete|DeleteByScope| +|delete|Delete| + +#### 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| + +### costmanagement view get-by-scope + +get-by-scope a costmanagement view. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement view|Views| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|get-by-scope|GetByScope| + +#### 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| + +### costmanagement view list + +list a costmanagement view. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement view|Views| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|list|ListByScope| +|list|List| + +#### 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| + +### costmanagement view show + +show a costmanagement view. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement view|Views| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|show|Get| + +#### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--view-name**|string|View name|view_name|viewName| + +### costmanagement view update + +update a costmanagement view. + +#### Command group +|Name (az)|Swagger name| +|---------|------------| +|costmanagement view|Views| + +#### Methods +|Name (az)|Swagger name| +|---------|------------| +|update|CreateOrUpdate#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| +|**--query-timeframe**|choice|The time frame for pulling data for the report. If custom, then a specific time period must be provided.|timeframe|timeframe| +|**--query-time-period**|object|Has time period for pulling data for the report.|time_period|timePeriod| +|**--query-dataset**|object|Has definition for data in this report config.|dataset|dataset| diff --git a/src/costmanagement/setup.py b/src/costmanagement/setup.py index d99d8b3aa94..9864259ef8a 100644 --- a/src/costmanagement/setup.py +++ b/src/costmanagement/setup.py @@ -1,53 +1,57 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -from codecs import open -from setuptools import setup, find_packages - -# TODO: Confirm this is the right version number you want and it matches your -# HISTORY.rst entry. -VERSION = '0.1.0' - -# The full list of classifiers is available at -# https://pypi.python.org/pypi?%3Aaction=list_classifiers -CLASSIFIERS = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', -] - -# TODO: Add any additional SDK dependencies here -DEPENDENCIES = [] - -with open('README.md', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='costmanagement', - version=VERSION, - description='Microsoft Azure Command-Line Tools CostManagementClient Extension', - # TODO: Update author and email, if applicable - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - # TODO: consider pointing directly to your source code instead of the generic repo - url='https://github.com/Azure/azure-cli-extensions', - long_description=README + '\n\n' + HISTORY, - license='MIT', - classifiers=CLASSIFIERS, - packages=find_packages(), - install_requires=DEPENDENCIES, - package_data={'azext_costmanagement': ['azext_metadata.json']}, -) +#!/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 .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']}, +)