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

[Network] Fix DNS Zone Show/List Table Format #1971

Merged
merged 1 commit into from Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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