Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,9 @@ backup vault backup-properties set:
soft_delete_feature_state:
rule_exclusions:
- option_length_too_long
cross_region_restore_flag:
rule_exclusions:
- option_length_too_long
batch account create:
parameters:
encryption_key_identifier:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,18 @@ def backup_protected_items_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_protected_items


def backup_protected_items_crr_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_protected_items_crr


def backup_operation_statuses_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_operation_statuses


def crr_operation_status_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).crr_operation_status


def backups_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backups

Expand All @@ -112,6 +120,10 @@ def backup_jobs_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_jobs


def backup_crr_jobs_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_crr_jobs


def backup_workload_items_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_workload_items

Expand All @@ -121,6 +133,10 @@ def job_details_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).job_details


def backup_crr_job_details_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_crr_job_details


def job_cancellations_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).job_cancellations

Expand All @@ -130,13 +146,26 @@ def recovery_points_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).recovery_points


def recovery_points_crr_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).recovery_points_crr


def restores_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).restores


def cross_region_restore_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).cross_region_restore


def item_level_recovery_connections_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).item_level_recovery_connections


def backup_resource_vault_config_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_resource_vault_configs


# Azure Active Directory Client Factories
def aad_properties_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).aad_properties
12 changes: 11 additions & 1 deletion src/azure-cli/azure/cli/command_modules/backup/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def load_arguments(self, _):
with self.argument_context('backup vault backup-properties set') as c:
c.argument('backup_storage_redundancy', arg_type=get_enum_type(['GeoRedundant', 'LocallyRedundant']), help='Sets backup storage properties for a Recovery Services vault.')
c.argument('soft_delete_feature_state', arg_type=get_enum_type(['Enable', 'Disable']), help='Set soft-delete feature state for a Recovery Services Vault.')
c.argument('cross_region_restore_flag', arg_type=get_enum_type(["True", "False"]), help='Set cross-region-restore feature state for a Recovery Services Vault. Default: False.')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cross_region_restore_flag will be treated as a str, you may need to convert it to bool before you pass it to SDK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the changes. Please review once.


# Container
with self.argument_context('backup container') as c:
Expand All @@ -87,9 +88,12 @@ def load_arguments(self, _):
with self.argument_context('backup container show') as c:
c.argument('name', container_name_type, options_list=['--name', '-n'], help='Name of the container. You can use the backup container list command to get the name of a container.')
c.argument('backup_management_type', backup_management_type)
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to show container in secondary region. Default: false.')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a command behavior switch, not a resource property. It's recommended to use action='store_true' for such cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the changes. Please review once.


with self.argument_context('backup container list') as c:
c.argument('vault_name', vault_name_type, id_part=None)
c.argument('backup_management_type', backup_management_type)
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to list containers in secondary region. Default: false.')

with self.argument_context('backup container unregister') as c:
c.argument('backup_management_type', backup_management_type)
Expand All @@ -114,6 +118,7 @@ def load_arguments(self, _):
c.argument('name', item_name_type, options_list=['--name', '-n'], help='Name of the backed up item. You can use the backup item list command to get the name of a backed up item.')
c.argument('backup_management_type', backup_management_type)
c.argument('workload_type', workload_type)
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to show item in secondary region. Default: false.')

# TODO: Need to use item.id once https://github.com/Azure/msrestazure-for-python/issues/80 is fixed.
with self.argument_context('backup item set-policy') as c:
Expand All @@ -126,6 +131,7 @@ def load_arguments(self, _):
c.argument('vault_name', vault_name_type, id_part=None)
c.argument('backup_management_type', arg_type=get_enum_type(allowed_backup_management_types + ["MAB"]), help=backup_management_type_help)
c.argument('workload_type', workload_type)
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to list items in secondary region. Default: false.')

# Policy
with self.argument_context('backup policy') as c:
Expand Down Expand Up @@ -170,12 +176,14 @@ def load_arguments(self, _):
c.argument('backup_management_type', backup_management_type)
c.argument('container_name', container_name_type)
c.argument('workload_type', workload_type)
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to list recoverypoints in secondary region. Default: false.')

with self.argument_context('backup recoverypoint show') as c:
c.argument('name', rp_name_type, options_list=['--name', '-n'], help='Name of the recovery point. You can use the backup recovery point list command to get the name of a backed up item.')
c.argument('backup_management_type', backup_management_type)
c.argument('container_name', container_name_type)
c.argument('workload_type', workload_type)
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to show recoverypoints in secondary region. Default: false.')

# Protection
with self.argument_context('backup protection') as c:
Expand Down Expand Up @@ -251,6 +259,7 @@ def load_arguments(self, _):
c.argument('diskslist', diskslist_type)
c.argument('restore_only_osdisk', arg_type=get_three_state_flag(), help='Use this flag to restore only OS disks of a backed up VM.')
c.argument('restore_as_unmanaged_disks', arg_type=get_three_state_flag(), help='Use this flag to specify to restore as unmanaged disks')
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to show recoverypoints in secondary region. Default: false.')

with self.argument_context('backup restore restore-azurefileshare') as c:
c.argument('resolve_conflict', resolve_conflict_type)
Expand Down Expand Up @@ -296,14 +305,15 @@ def load_arguments(self, _):
for command in ['show', 'stop', 'wait']:
with self.argument_context('backup job ' + command) as c:
c.argument('name', job_name_type, help='Name of the job. You can use the backup job list command to get the name of a job.')
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to show recoverypoints in secondary region. Default: false.')

with self.argument_context('backup job list') as c:
c.argument('vault_name', vault_name_type, id_part=None)
c.argument('status', arg_type=get_enum_type(['Cancelled', 'Completed', 'CompletedWithWarnings', 'Failed', 'InProgress']), help='Status of the Job.')
c.argument('operation', arg_type=get_enum_type(['Backup', 'ConfigureBackup', 'DeleteBackupData', 'DisableBackup', 'Restore']), help='User initiated operation.')
c.argument('start_date', type=datetime_type, help='The start date of the range in UTC (d-m-Y).')
c.argument('end_date', type=datetime_type, help='The end date of the range in UTC (d-m-Y).')
c.argument('backup_management_type', backup_management_type)
c.argument('use_secondary_region', arg_type=get_three_state_flag(), help='Use this flag to show recoverypoints in secondary region. Default: false.')

with self.argument_context('backup job wait') as c:
c.argument('timeout', type=int, help='Maximum time, in seconds, to wait before aborting.')
Loading