Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR costmanagement] test-costmanagement-automation #117

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/costmanagement/azext_costmanagement/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def __init__(self, cli_ctx=None):
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)
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
Expand Down
629 changes: 443 additions & 186 deletions src/costmanagement/azext_costmanagement/generated/_help.py

Large diffs are not rendered by default.

131 changes: 68 additions & 63 deletions src/costmanagement/azext_costmanagement/generated/_params.py

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions src/costmanagement/azext_costmanagement/generated/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,3 @@
# 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
)
9 changes: 0 additions & 9 deletions src/costmanagement/azext_costmanagement/generated/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ 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)
Expand All @@ -46,7 +45,6 @@ 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)
Expand All @@ -71,7 +69,6 @@ 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)
Expand All @@ -96,7 +93,6 @@ 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)
Expand All @@ -123,7 +119,6 @@ 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)
Expand All @@ -148,7 +143,6 @@ 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)
Expand All @@ -171,7 +165,6 @@ 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)
Expand All @@ -196,7 +189,6 @@ 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)
Expand All @@ -223,7 +215,6 @@ 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)
Expand Down
2 changes: 2 additions & 0 deletions src/costmanagement/azext_costmanagement/generated/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def load_command_table(self, _):
g.custom_show_command('show', 'costmanagement_view_show')
g.custom_command('create', 'costmanagement_view_create')
g.custom_command('delete', 'costmanagement_view_delete')
g.custom_command('get-by-scope', 'costmanagement_view_get_by_scope')

from azext_costmanagement.generated._client_factory import cf_alert
costmanagement_alert = CliCommandType(
Expand Down Expand Up @@ -82,3 +83,4 @@ def load_command_table(self, _):
g.custom_command('update', 'costmanagement_export_update')
g.custom_command('delete', 'costmanagement_export_delete')
g.custom_command('execute', 'costmanagement_export_execute')
g.custom_command('get-execution-history', 'costmanagement_export_get_execution_history')
77 changes: 40 additions & 37 deletions src/costmanagement/azext_costmanagement/generated/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,19 @@
import json


def costmanagement_view_list(cmd, client,
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(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)
def costmanagement_view_show(client,
view_name):
return client.get(view_name=view_name)


def costmanagement_view_create(cmd, client,
def costmanagement_view_create(client,
view_name,
scope=None,
e_tag=None,
Expand All @@ -44,7 +40,9 @@ def costmanagement_view_create(cmd, client,
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:
if isinstance(query_dataset, str):
query_dataset = json.loads(query_dataset)
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,
Expand Down Expand Up @@ -72,7 +70,7 @@ def costmanagement_view_create(cmd, client,
dataset=query_dataset)


def costmanagement_view_delete(cmd, client,
def costmanagement_view_delete(client,
view_name,
scope=None):
if scope is not None and view_name is not None:
Expand All @@ -81,19 +79,26 @@ def costmanagement_view_delete(cmd, client,
return client.delete(view_name=view_name)


def costmanagement_alert_list(cmd, client,
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(cmd, client,
def costmanagement_alert_show(client,
scope,
alert_id):
return client.get(scope=scope,
alert_id=alert_id)


def costmanagement_alert_dismiss(cmd, client,
def costmanagement_alert_dismiss(client,
scope,
alert_id,
definition=None,
Expand Down Expand Up @@ -130,12 +135,6 @@ def costmanagement_alert_dismiss(cmd, client,
details_meter_filter = json.loads(details_meter_filter)
if isinstance(details_tag_filter, str):
details_tag_filter = json.loads(details_tag_filter)
if isinstance(details_contact_emails, str):
details_contact_emails = json.loads(details_contact_emails)
if isinstance(details_contact_groups, str):
details_contact_groups = json.loads(details_contact_groups)
if isinstance(details_contact_roles, str):
details_contact_roles = json.loads(details_contact_roles)
return client.dismiss(scope=scope,
alert_id=alert_id,
definition=definition,
Expand Down Expand Up @@ -166,14 +165,14 @@ def costmanagement_alert_dismiss(cmd, client,
overriding_alert=details_overriding_alert)


def costmanagement_alert_list_external(cmd, client,
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(cmd, client,
def costmanagement_forecast_external_cloud_provider_usage(client,
external_cloud_provider_type,
external_cloud_provider_id,
type_,
Expand Down Expand Up @@ -204,7 +203,7 @@ def costmanagement_forecast_external_cloud_provider_usage(cmd, client,
query_filter=dataset_filter)


def costmanagement_forecast_usage(cmd, client,
def costmanagement_forecast_usage(client,
scope,
type_,
timeframe,
Expand Down Expand Up @@ -233,7 +232,7 @@ def costmanagement_forecast_usage(cmd, client,
query_filter=dataset_filter)


def costmanagement_dimension_list(cmd, client,
def costmanagement_dimension_list(client,
scope,
filter=None,
expand=None,
Expand All @@ -246,7 +245,7 @@ def costmanagement_dimension_list(cmd, client,
top=top)


def costmanagement_dimension_by_external_cloud_provider_type(cmd, client,
def costmanagement_dimension_by_external_cloud_provider_type(client,
external_cloud_provider_type,
external_cloud_provider_id,
filter=None,
Expand All @@ -261,7 +260,7 @@ def costmanagement_dimension_by_external_cloud_provider_type(cmd, client,
top=top)


def costmanagement_query_usage(cmd, client,
def costmanagement_query_usage(client,
scope,
type_,
timeframe,
Expand All @@ -284,7 +283,7 @@ def costmanagement_query_usage(cmd, client,
filter=dataset_filter)


def costmanagement_query_usage_by_external_cloud_provider_type(cmd, client,
def costmanagement_query_usage_by_external_cloud_provider_type(client,
external_cloud_provider_type,
external_cloud_provider_id,
type_,
Expand All @@ -309,22 +308,19 @@ def costmanagement_query_usage_by_external_cloud_provider_type(cmd, client,
filter=dataset_filter)


def costmanagement_export_list(cmd, client,
def costmanagement_export_list(client,
scope):
return client.list(scope=scope)


def costmanagement_export_show(cmd, client,
def costmanagement_export_show(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)
return client.get(scope=scope,
export_name=export_name)


def costmanagement_export_create(cmd, client,
def costmanagement_export_create(client,
scope,
export_name,
definition_type=None,
Expand Down Expand Up @@ -357,7 +353,7 @@ def costmanagement_export_create(cmd, client,
recurrence_period=schedule_recurrence_period)


def costmanagement_export_update(cmd, client,
def costmanagement_export_update(client,
scope,
export_name,
definition_type=None,
Expand Down Expand Up @@ -390,15 +386,22 @@ def costmanagement_export_update(cmd, client,
recurrence_period=schedule_recurrence_period)


def costmanagement_export_delete(cmd, client,
def costmanagement_export_delete(client,
scope,
export_name):
return client.delete(scope=scope,
export_name=export_name)


def costmanagement_export_execute(cmd, client,
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)
Loading