Skip to content

Commit d62f4b9

Browse files
authored
[Compute] az vm list-sizes: Mark the command as deprecated (#31080)
1 parent bd42dd6 commit d62f4b9

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/azure-cli/azure/cli/command_modules/vm/_help.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,14 @@
10181018
text: az vm auto-shutdown -g MyResourceGroup -n MyVm --off
10191019
"""
10201020

1021+
helps['vm list-sizes'] = """
1022+
type: command
1023+
short-summary: List available sizes for VMs.
1024+
examples:
1025+
- name: List the available VM sizes in the West US region.
1026+
text: az vm list-sizes -l westus
1027+
"""
1028+
10211029
helps['vm availability-set convert'] = """
10221030
type: command
10231031
short-summary: Convert an Azure Availability Set to contain VMs with managed disks.

src/azure-cli/azure/cli/command_modules/vm/_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,9 @@ def load_arguments(self, _):
984984
c.argument('location', arg_type=get_location_type(self.cli_ctx))
985985
c.argument('command_id', help='The command id.')
986986

987+
with self.argument_context('vm list-sizes') as c:
988+
c.argument('location', arg_type=get_location_type(self.cli_ctx))
989+
987990
run_cmd_vmss_name = CLIArgumentType(options_list=['--vmss-name'], help='The name of the VM scale set.')
988991
for scope in ['create', 'update']:
989992
with self.argument_context('vmss run-command {}'.format(scope)) as c:

src/azure-cli/azure/cli/command_modules/vm/commands.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ def load_command_table(self, _):
331331
g.generic_update_command('update', getter_name='get_vm_to_update', setter_name='update_vm', setter_type=compute_custom, command_type=compute_custom, supports_no_wait=True, validator=process_vm_update_namespace)
332332
g.wait_command('wait', getter_name='get_instance_view', getter_type=compute_custom)
333333
g.custom_command('auto-shutdown', 'auto_shutdown_vm')
334-
from .operations.vm import VMListSizes
335-
self.command_table['vm list-sizes'] = VMListSizes(loader=self)
334+
g.custom_command('list-sizes', 'list_vm_sizes', deprecate_info=g.deprecate(redirect='az vm list-skus'))
336335

337336
with self.command_group('vm', compute_vm_sdk, client_factory=cf_vm) as g:
338337
g.custom_command('install-patches', 'install_vm_patches', supports_no_wait=True, min_api='2020-12-01')

src/azure-cli/azure/cli/command_modules/vm/custom.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5911,4 +5911,13 @@ def sig_community_image_version_list(client, location, public_gallery_name, gall
59115911
generator = client.list(location=location, public_gallery_name=public_gallery_name,
59125912
gallery_image_name=gallery_image_name)
59135913
return get_page_result(generator, marker, show_next_marker)
5914+
5915+
5916+
def list_vm_sizes(cmd, location):
5917+
from .operations.vm import VMListSizes
5918+
return VMListSizes(cli_ctx=cmd.cli_ctx)(command_args={
5919+
"location": location,
5920+
})
5921+
5922+
59145923
# endRegion

0 commit comments

Comments
 (0)