Skip to content

Commit

Permalink
autogenerated
Browse files Browse the repository at this point in the history
  • Loading branch information
chunyu3 committed Sep 2, 2021
1 parent e43ede7 commit 783d1ca
Show file tree
Hide file tree
Showing 12 changed files with 1,232 additions and 189 deletions.
Binary file modified src/azure-cli/azure/cli/command_modules/vm/gen.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ def cf_restore_point(cli_ctx, *_):
return cf_vm_cl(cli_ctx).restore_points


def cf_capacity_reservation_group(cli_ctx, *_):
return cf_vm_cl(cli_ctx).capacity_reservation_groups


def cf_capacity_reservation(cli_ctx, *_):
return cf_vm_cl(cli_ctx).capacity_reservations


def cf_virtual_machine_scale_set_vm_extension(cli_ctx, *_):
return cf_vm_cl(cli_ctx).virtual_machine_scale_set_vm_extensions

Expand Down
135 changes: 135 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/generated/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,105 @@
--name "rpName"
"""

helps['vm restore-point create'] = """
type: command
short-summary: "The operation to create the restore point. Updating properties of an existing restore point is not \
allowed."
parameters:
- name: --exclude-disks
short-summary: "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."
long-summary: |
Usage: --exclude-disks id=XX
id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/.\
..
Multiple actions can be specified by using more than one --exclude-disks argument.
examples:
- name: Create a restore point
text: |-
az vm restore-point create --exclude-disks id="/subscriptions/{subscription-id}/resourceGroups/myResourc\
eGroup/providers/Microsoft.Compute/disks/disk123" --resource-group "myResourceGroup" --restore-point-collection-name \
"rpcName" --name "rpName"
"""

helps['vm restore-point delete'] = """
type: command
short-summary: "The operation to delete the restore point."
"""

helps['vm restore-point wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the vm restore-point is met.
examples:
- name: Pause executing next line of CLI script until the vm restore-point is successfully created.
text: |-
az vm restore-point wait --resource-group "myResourceGroup" --restore-point-collection-name "rpcName" \
--name "rpName" --created
- name: Pause executing next line of CLI script until the vm restore-point is successfully deleted.
text: |-
az vm restore-point wait --resource-group "myResourceGroup" --restore-point-collection-name "rpcName" \
--name "rpName" --deleted
"""

helps['vm capacity-reservation-group'] = """
type: group
short-summary: Manage capacity reservation group with vm
"""

helps['vm capacity-reservation-group list'] = """
type: command
short-summary: "Lists all of the capacity reservation groups in the specified resource group. Use the nextLink \
property in the response to get the next page of capacity reservation groups. And Lists all of the capacity \
reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity \
reservation groups."
examples:
- name: List capacity reservation groups in resource group.
text: |-
az vm capacity-reservation-group list --expand "virtualMachines/$ref" --resource-group \
"myResourceGroup"
- name: List capacity reservation groups in subscription.
text: |-
az vm capacity-reservation-group list --expand "virtualMachines/$ref"
"""

helps['vm capacity-reservation-group show'] = """
type: command
short-summary: "The operation that retrieves information about a capacity reservation group."
examples:
- name: Get a capacity reservation Group.
text: |-
az vm capacity-reservation-group show --name "myCapacityReservationGroup" --resource-group \
"myResourceGroup"
"""

helps['vm capacity-reservation'] = """
type: group
short-summary: Manage capacity reservation with vm
"""

helps['vm capacity-reservation list'] = """
type: command
short-summary: "Lists all of the capacity reservations in the specified capacity reservation group. Use the \
nextLink property in the response to get the next page of capacity reservations."
examples:
- name: List capacity reservations in reservation group.
text: |-
az vm capacity-reservation list --capacity-reservation-group-name "myCapacityReservationGroup" \
--resource-group "myResourceGroup"
"""

helps['vm capacity-reservation show'] = """
type: command
short-summary: "The operation that retrieves information about the capacity reservation."
examples:
- name: Get a capacity reservation.
text: |-
az vm capacity-reservation show --capacity-reservation-group-name "myCapacityReservationGroup" --name \
"myCapacityReservation" --resource-group "myResourceGroup"
"""

helps['vm virtual-machine-scale-set-vm-extension'] = """
type: group
short-summary: Manage virtual machine scale set vm extension with vm
Expand Down Expand Up @@ -276,6 +375,11 @@
short-summary: Manage virtual machine scale set v ms with vm
"""

helps['vm virtual-machine-scale-set-v-ms perform-maintenance'] = """
type: command
short-summary: "Performs maintenance on a virtual machine in a VM scale set."
"""

helps['vm virtual-machine-scale-set-v-ms redeploy'] = """
type: command
short-summary: "Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and \
Expand Down Expand Up @@ -383,3 +487,34 @@
az vm disk-restore-point show --name "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"\
--resource-group "myResourceGroup" --restore-point-collection-name "rpc" --vm-restore-point-name "vmrp"
"""

helps['vm disk-restore-point grant-access'] = """
type: command
short-summary: "Grants access to a diskRestorePoint."
examples:
- name: Grants access to a diskRestorePoint.
text: |-
az vm disk-restore-point grant-access --name "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415e\
aa12745" --access "Read" --duration-in-seconds 300 --resource-group "myResourceGroup" --restore-point-collection-name \
"rpc" --vm-restore-point-name "vmrp"
"""

helps['vm disk-restore-point revoke-access'] = """
type: command
short-summary: "Revokes access to a diskRestorePoint."
examples:
- name: Revokes access to a diskRestorePoint.
text: |-
az vm disk-restore-point revoke-access --name "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415\
eaa12745" --resource-group "myResourceGroup" --restore-point-collection-name "rpc" --vm-restore-point-name "vmrp"
"""

helps['vm disk-restore-point wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the vm disk-restore-point is met.
examples:
- name: Pause executing next line of CLI script until the vm disk-restore-point is successfully created.
text: |-
az vm disk-restore-point wait --name "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"\
--resource-group "myResourceGroup" --restore-point-collection-name "rpc" --vm-restore-point-name "vmrp" --created
"""
95 changes: 95 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/generated/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from azure.cli.core.commands.parameters import (
tags_type,
get_three_state_flag,
get_enum_type,
resource_group_name_type,
get_location_type
)
Expand All @@ -22,6 +23,7 @@
validate_file_or_dict
)
from .._actions import (
AddExcludeDisks,
AddSubstatuses,
AddStatuses
)
Expand Down Expand Up @@ -136,6 +138,53 @@ def load_arguments(self, _):
c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'], type=str, help='The '
'name of the restore point.', id_part='child_name_1')

with self.argument_context('vm restore-point create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('restore_point_collection_name', type=str, help='The name of the restore point collection.')
c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'], type=str, help='The '
'name of the restore point.')
c.argument('exclude_disks', action=AddExcludeDisks, 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.')

with self.argument_context('vm restore-point delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('restore_point_collection_name', type=str, help='The name of the Restore Point Collection.',
id_part='name')
c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'], type=str, help='The '
'name of the restore point.', id_part='child_name_1')

with self.argument_context('vm restore-point wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('restore_point_collection_name', type=str, help='The name of the restore point collection.',
id_part='name')
c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'], type=str, help='The '
'name of the restore point.', id_part='child_name_1')

with self.argument_context('vm capacity-reservation-group list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('expand', arg_type=get_enum_type(['virtualMachineScaleSetVMs/$ref', 'virtualMachines/$ref']),
help='The expand expression to apply on the operation. Based on the expand param(s) specified we '
'return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to '
'capacity reservation group in the response.')

with self.argument_context('vm capacity-reservation-group show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('capacity_reservation_group_name', options_list=['--name', '-n',
'--capacity-reservation-group-name'], type=str,
help='The name of the capacity reservation group.', id_part='name')

with self.argument_context('vm capacity-reservation list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('capacity_reservation_group_name', type=str, help='The name of the capacity reservation group.')

with self.argument_context('vm capacity-reservation show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('capacity_reservation_group_name', type=str, help='The name of the capacity reservation group.',
id_part='name')
c.argument('capacity_reservation_name', options_list=['--name', '-n', '--capacity-reservation-name'], type=str,
help='The name of the capacity reservation.', id_part='child_name_1')

with self.argument_context('vm virtual-machine-scale-set-vm-extension list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('vm_scale_set_name', type=str, help='The name of the VM scale set.')
Expand Down Expand Up @@ -173,6 +222,9 @@ def load_arguments(self, _):
c.argument('protected_settings', type=validate_file_or_dict, help='The extension can contain either '
'protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. Expected '
'value: json-string/json-file/@json-file.')
c.argument('suppress_failures', arg_type=get_three_state_flag(), help='Indicates whether failures stemming '
'from the extension will be suppressed (Operational failures such as not connecting to the VM will '
'not be suppressed regardless of this value). The default is false.')
c.argument('name', type=str, help='The virtual machine extension name.', arg_group='Instance View')
c.argument('type_', options_list=['--type'], type=str, help='Specifies the type of the extension; an example '
'is "CustomScriptExtension".', arg_group='Instance View')
Expand All @@ -191,6 +243,11 @@ def load_arguments(self, _):
id_part='child_name_2')
c.argument('expand', type=str, help='The expand expression to apply on the operation.')

with self.argument_context('vm virtual-machine-scale-set-v-ms perform-maintenance') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('vm_scale_set_name', type=str, help='The name of the VM scale set.', id_part='name')
c.argument('instance_id', type=str, help='The instance ID of the virtual machine.', id_part='child_name_1')

with self.argument_context('vm virtual-machine-scale-set-v-ms redeploy') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('vm_scale_set_name', type=str, help='The name of the VM scale set.', id_part='name')
Expand Down Expand Up @@ -249,3 +306,41 @@ def load_arguments(self, _):
c.argument('disk_restore_point_name', options_list=['--name', '-n', '--disk-restore-point-name'], type=str,
help='The name of the disk restore point created. Supported characters for the name are a-z, A-Z, '
'0-9 and _. The maximum name length is 80 characters.', id_part='child_name_2')

with self.argument_context('vm disk-restore-point grant-access') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('restore_point_collection_name', type=str, help='The name of the restore point collection that the '
'disk restore point belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum '
'name length is 80 characters.', id_part='name')
c.argument('vm_restore_point_name', type=str, help='The name of the vm restore point that the disk disk '
'restore point belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name '
'length is 80 characters.', id_part='child_name_1')
c.argument('disk_restore_point_name', options_list=['--name', '-n', '--disk-restore-point-name'], type=str,
help='The name of the disk restore point created. Supported characters for the name are a-z, A-Z, '
'0-9 and _. The maximum name length is 80 characters.', id_part='child_name_2')
c.argument('access', arg_type=get_enum_type(['None', 'Read', 'Write']), help='')
c.argument('duration_in_seconds', type=int, help='Time duration in seconds until the SAS access expires.')

with self.argument_context('vm disk-restore-point revoke-access') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('restore_point_collection_name', type=str, help='The name of the restore point collection that the '
'disk restore point belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum '
'name length is 80 characters.', id_part='name')
c.argument('vm_restore_point_name', type=str, help='The name of the vm restore point that the disk disk '
'restore point belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name '
'length is 80 characters.', id_part='child_name_1')
c.argument('disk_restore_point_name', options_list=['--name', '-n', '--disk-restore-point-name'], type=str,
help='The name of the disk restore point created. Supported characters for the name are a-z, A-Z, '
'0-9 and _. The maximum name length is 80 characters.', id_part='child_name_2')

with self.argument_context('vm disk-restore-point wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('restore_point_collection_name', type=str, help='The name of the restore point collection that the '
'disk restore point belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum '
'name length is 80 characters.', id_part='name')
c.argument('vm_restore_point_name', type=str, help='The name of the vm restore point that the disk disk '
'restore point belongs. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name '
'length is 80 characters.', id_part='child_name_1')
c.argument('disk_restore_point_name', options_list=['--name', '-n', '--disk-restore-point-name'], type=str,
help='The name of the disk restore point created. Supported characters for the name are a-z, A-Z, '
'0-9 and _. The maximum name length is 80 characters.', id_part='child_name_2')
32 changes: 32 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/generated/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,38 @@
from knack.util import CLIError


class AddExcludeDisks(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(AddExcludeDisks, self).__call__(parser, namespace, action, option_string)

def get_action(self, values, option_string):
try:
properties = defaultdict(list)
for (k, v) in (x.split('=', 1) for x in values):
properties[k].append(v)
properties = dict(properties)
except ValueError:
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
d = {}
for k in properties:

kl = k.lower()

v = properties[k]

if kl == 'id':

d['id'] = v[0]

else:
raise CLIError(
'Unsupported Key {} is provided for parameter exclude-disks. All possible keys are: id'.format(k)
)

return d


class AddSubstatuses(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
Expand Down
Loading

0 comments on commit 783d1ca

Please sign in to comment.