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

[Backup] Add table output to backup commands #11764

Merged
merged 1 commit into from
Jan 13, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/backup/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def transform_job(result):
columns.append(('Duration', result['properties']['duration']))
elif result['properties']['backupManagementType'] == 'AzureStorage':
columns.append(('Duration', result['properties']['additionalProperties']['duration']))
elif result['properties']['backupManagementType'] == 'AzureWorkload':
columns.append(('Duration', result['properties']['duration']))

return OrderedDict(columns)

Expand Down
8 changes: 4 additions & 4 deletions src/azure-cli/azure/cli/command_modules/backup/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
protection_containers_cf, protection_intent_cf # pylint: disable=unused-variable
from azure.cli.command_modules.backup._format import (
transform_container_list, transform_policy_list, transform_item_list, transform_job_list,
transform_recovery_point_list, transform_container, transform_item, transform_protectable_item_list)
transform_recovery_point_list, transform_container, transform_item, transform_protectable_item_list, transform_job)


# pylint: disable=line-too-long
Expand Down Expand Up @@ -60,7 +60,7 @@ def load_command_table(self, _):
g.command('update-for-vm', 'update_protection_for_vm')

with self.command_group('backup protection', custom_command_type=backup_custom_base, client_factory=protected_items_cf) as g:
g.custom_command('backup-now', 'backup_now', client_factory=backups_cf)
g.custom_command('backup-now', 'backup_now', client_factory=backups_cf, table_transformer=transform_job)
g.custom_command('disable', 'disable_protection', confirmation=True)
g.custom_command('enable-for-azurefileshare', 'enable_for_azurefileshare')
g.custom_command('enable-for-azurewl', 'enable_protection_for_azure_wl')
Expand All @@ -72,7 +72,7 @@ def load_command_table(self, _):
with self.command_group('backup item', backup_custom_base, client_factory=protected_items_cf) as g:
g.show_command('show', 'show_item', client_factory=backup_protected_items_cf, table_transformer=transform_item)
g.command('list', 'list_items', table_transformer=transform_item_list, client_factory=backup_protected_items_cf)
g.command('set-policy', 'update_policy_for_item')
g.command('set-policy', 'update_policy_for_item', table_transformer=transform_job)

with self.command_group('backup protectable-item', backup_custom_base, client_factory=backup_protectable_items_cf) as g:
g.show_command('show', 'show_protectable_item')
Expand All @@ -96,7 +96,7 @@ def load_command_table(self, _):
with self.command_group('backup restore', custom_command_type=backup_custom_base, client_factory=restores_cf) as g:
g.custom_command('restore-azurefileshare', 'restore_azurefileshare')
g.custom_command('restore-azurefiles', 'restore_azurefiles')
g.custom_command('restore-azurewl', 'restore_azure_wl')
g.custom_command('restore-azurewl', 'restore_azure_wl', table_transformer=transform_job)

with self.command_group('backup restore files', backup_custom, client_factory=item_level_recovery_connections_cf) as g:
g.command('mount-rp', 'restore_files_mount_rp')
Expand Down