Skip to content

Commit

Permalink
[Compute] az restore-point: Add new parameters to support cross reg…
Browse files Browse the repository at this point in the history
…ion copy (#21841)
  • Loading branch information
Jing-song authored Apr 18, 2022
1 parent d94af4d commit 7e87e11
Show file tree
Hide file tree
Showing 7 changed files with 1,718 additions and 370 deletions.
9 changes: 9 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,10 +1439,14 @@ def load_arguments(self, _):
c.argument('exclude_disks', nargs='+', help='List of disk resource ids that the '
'customer wishes to exclude from the restore point. If no disks are specified, all disks will be '
'included.')
c.argument('source_restore_point', help='Resource Id of the source restore point from which a copy needs to be created')

with self.argument_context('restore-point show') as c:
c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'],
help='The name of the restore point.')
c.argument('expand', help='The expand expression to apply on the operation.',
deprecate_info=c.deprecate(hide=True))
c.argument('instance_view', action='store_true', help='Show the instance view of a restore point.')

with self.argument_context('restore-point delete') as c:
c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'],
Expand All @@ -1464,4 +1468,9 @@ def load_arguments(self, _):
with self.argument_context('restore-point collection update') as c:
c.argument('tags', tags_type)

with self.argument_context('restore-point collection show') as c:
c.argument('expand', help='The expand expression to apply on the operation.',
deprecate_info=c.deprecate(hide=True))
c.argument('restore_points', action='store_true', help='Show all contained restore points in the restore point collection.')

# endRegion
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/vm/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def load_command_table(self, _):
g.custom_command('list', 'list_capacity_reservation')

with self.command_group('restore-point', restore_point, client_factory=cf_restore_point, min_api='2021-03-01') as g:
g.show_command('show', 'get')
g.custom_show_command('show', 'restore_point_show')
g.custom_command('create', 'restore_point_create', supports_no_wait=True)
g.command('delete', 'begin_delete', supports_no_wait=True, confirmation=True)
g.wait_command('wait')
Expand Down
25 changes: 23 additions & 2 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4934,29 +4934,50 @@ def restore_point_create(client,
restore_point_collection_name,
restore_point_name,
exclude_disks=None,
source_restore_point=None,
no_wait=False):
parameters = {}
if exclude_disks is not None:
parameters['exclude_disks'] = []
for disk in exclude_disks:
parameters['exclude_disks'].append({'id': disk})
if source_restore_point is not None:
parameters['source_restore_point'] = {'id': source_restore_point}
return sdk_no_wait(no_wait,
client.begin_create,
resource_group_name=resource_group_name,
restore_point_collection_name=restore_point_collection_name,
restore_point_name=restore_point_name,
parameters=parameters)


def restore_point_show(client,
resource_group_name,
restore_point_name,
restore_point_collection_name,
expand=None,
instance_view=None):
if instance_view is not None:
expand = 'instanceView'
return client.get(resource_group_name=resource_group_name,
restore_point_name=restore_point_name,
restore_point_collection_name=restore_point_collection_name,
expand=expand)

# endRegion


# region Restore point collection
def restore_point_collection_show(client,
resource_group_name,
restore_point_collection_name):
restore_point_collection_name,
expand=None,
restore_points=None):
if restore_points is not None:
expand = 'restorePoints'
return client.get(resource_group_name=resource_group_name,
restore_point_collection_name=restore_point_collection_name,
expand="restorePoints")
expand=expand)


def restore_point_collection_create(client,
Expand Down
Loading

0 comments on commit 7e87e11

Please sign in to comment.