Skip to content

Commit

Permalink
Fixes #1860. (#1971)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott committed Feb 3, 2017
1 parent 5d15dbf commit d12899e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Expand Up @@ -40,6 +40,24 @@ def transform_dns_record_set_table_output(result):
table_output.append(table_row)
return table_output

def transform_dns_zone_table_output(result):
is_list = isinstance(result, list)

if not is_list:
result = [result]

final_result = []
for item in result:
new_item = OrderedDict([
('ZoneName', item['name']),
('ResourceGroup', item['resourceGroup']),
('RecordSets', item['numberOfRecordSets']),
('MaxRecordSets', item['maxNumberOfRecordSets'])
])
final_result.append(new_item)

return final_result if is_list else final_result[0]

def transform_local_gateway_table_output(result):
final_result = []
for item in result:
Expand Down
Expand Up @@ -14,7 +14,7 @@
delete_network_resource_property_entry)
from ._format import \
(transform_local_gateway_table_output, transform_dns_record_set_output,
transform_dns_record_set_table_output)
transform_dns_record_set_table_output, transform_dns_zone_table_output)

custom_path = 'azure.cli.command_modules.network.custom#{}'

Expand Down Expand Up @@ -402,9 +402,9 @@ def _make_singular(value):
custom_function_op=custom_path.format('update_traffic_manager_endpoint'))

# DNS ZonesOperations
cli_command(__name__, 'network dns zone show', 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.get', cf_dns_mgmt_zones)
cli_command(__name__, 'network dns zone show', 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.get', cf_dns_mgmt_zones, table_transformer=transform_dns_zone_table_output)
cli_command(__name__, 'network dns zone delete', 'azure.mgmt.dns.operations.zones_operations#ZonesOperations.delete', cf_dns_mgmt_zones, confirmation=True)
cli_command(__name__, 'network dns zone list', custom_path.format('list_dns_zones'))
cli_command(__name__, 'network dns zone list', custom_path.format('list_dns_zones'), table_transformer=transform_dns_zone_table_output)
cli_generic_update_command(__name__, 'network dns zone update',
'azure.mgmt.dns.operations.zones_operations#ZonesOperations.get',
'azure.mgmt.dns.operations.zones_operations#ZonesOperations.create_or_update',
Expand Down

0 comments on commit d12899e

Please sign in to comment.