Skip to content

Commit 90d202b

Browse files
authored
Renamed subgroups of the connectedmachine extension and added a table format support (Azure#2637)
1 parent 7ad727a commit 90d202b

File tree

17 files changed

+2615
-3165
lines changed

17 files changed

+2615
-3165
lines changed

src/connectedmachine/HISTORY.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
Release History
44
===============
55

6-
0.2.0
7-
+++++
8-
* machineextensions support
6+
0.3.0
7+
+++++
8+
* Renamed machine-extension subgroup to extension
9+
* Moved all commands under the machine subgroup to the extension level
910

10-
0.1.1
11-
+++++
12-
* Remove the limitation of max compatible cli core version
11+
0.2.0
12+
+++++
13+
* machineextensions support
14+
15+
0.1.1
16+
+++++
17+
* Remove the limitation of max compatible cli core version
1318

1419
0.1.0
1520
++++++

src/connectedmachine/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ az connectedmachine delete \
5454
##### Create or Update a Machine Extension
5555

5656
```sh
57-
az connectedmachine machine-extension create \
57+
az connectedmachine extension create \
5858
--machine-name "myMachine" \
5959
--name "customScriptExtension" \
6060
--location "eastus2euap" \
@@ -68,15 +68,15 @@ az connectedmachine machine-extension create \
6868
##### Get all Machine Extensions
6969

7070
```sh
71-
az connectedmachine machine-extension list \
71+
az connectedmachine extension list \
7272
--machine-name "myMachine" \
7373
--resource-group "myResourceGroup"
7474
```
7575

7676
##### Get a Machine Extension
7777

7878
```sh
79-
az connectedmachine machine-extension show \
79+
az connectedmachine extension show \
8080
--machine-name "myMachine" \
8181
--name "CustomScriptExtension" \
8282
--resource-group "myResourceGroup"
@@ -85,7 +85,7 @@ az connectedmachine machine-extension show \
8585
##### Update a Machine Extension
8686

8787
```sh
88-
az connectedmachine machine-extension update \
88+
az connectedmachine extension update \
8989
--machine-name "myMachine" \
9090
--name "CustomScriptExtension" \
9191
--type "CustomScriptExtension" \
@@ -97,7 +97,7 @@ az connectedmachine machine-extension update \
9797
##### Delete a Machine Extension
9898

9999
```sh
100-
az connectedmachine machine-extension delete \
100+
az connectedmachine extension delete \
101101
--machine-name "myMachine" \
102102
--name "MMA" \
103103
--resource-group "myResourceGroup"

src/connectedmachine/azext_connectedmachine/generated/_help.py

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,115 +12,110 @@
1212
from knack.help_files import helps
1313

1414

15-
helps['connectedmachine machine'] = """
15+
helps['connectedmachine'] = """
1616
type: group
17-
short-summary: connectedmachine machine
17+
short-summary: connectedmachine
1818
"""
1919

20-
helps['connectedmachine machine list'] = """
20+
helps['connectedmachine list'] = """
2121
type: command
2222
short-summary: "Lists all the hybrid machines in the specified subscription."
2323
examples:
2424
- name: List Machines by resource group
2525
text: |-
26-
az connectedmachine machine list --resource-group "myResourceGroup"
26+
az connectedmachine list --resource-group "myResourceGroup"
2727
"""
2828

29-
helps['connectedmachine machine show'] = """
29+
helps['connectedmachine show'] = """
3030
type: command
3131
short-summary: "Retrieves information about the model view or the instance view of a hybrid machine."
3232
examples:
3333
- name: Get Machine
3434
text: |-
35-
az connectedmachine machine show --name "myMachine" --resource-group "myResourceGroup"
35+
az connectedmachine show --name "myMachine" --resource-group "myResourceGroup"
3636
"""
3737

38-
helps['connectedmachine machine delete'] = """
38+
helps['connectedmachine delete'] = """
3939
type: command
4040
short-summary: "The operation to remove a hybrid machine identity in Azure."
4141
examples:
4242
- name: Delete a Machine
4343
text: |-
44-
az connectedmachine machine delete --name "myMachine" --resource-group "myResourceGroup"
44+
az connectedmachine delete --name "myMachine" --resource-group "myResourceGroup"
4545
"""
4646

47-
helps['connectedmachine machine-extension'] = """
47+
helps['connectedmachine extension'] = """
4848
type: group
49-
short-summary: connectedmachine machine-extension
49+
short-summary: connectedmachine extension
5050
"""
5151

52-
helps['connectedmachine machine-extension list'] = """
52+
helps['connectedmachine extension list'] = """
5353
type: command
5454
short-summary: "The operation to get all extensions of a non-Azure machine"
5555
examples:
5656
- name: Get all Machine Extensions
5757
text: |-
58-
az connectedmachine machine-extension list --machine-name "myMachine" --resource-group \
59-
"myResourceGroup"
58+
az connectedmachine extension list --machine-name "myMachine" --resource-group "myResourceGroup"
6059
"""
6160

62-
helps['connectedmachine machine-extension show'] = """
61+
helps['connectedmachine extension show'] = """
6362
type: command
6463
short-summary: "The operation to get the extension."
6564
examples:
6665
- name: Get Machine Extension
6766
text: |-
68-
az connectedmachine machine-extension show --machine-name "myMachine" --name "CustomScriptExtension" \
67+
az connectedmachine extension show --machine-name "myMachine" --name "CustomScriptExtension" \
6968
--resource-group "myResourceGroup"
7069
"""
7170

72-
helps['connectedmachine machine-extension create'] = """
71+
helps['connectedmachine extension create'] = """
7372
type: command
7473
short-summary: "The operation to create or update the extension."
7574
examples:
76-
- name: Create or Update a Machine Extension
75+
- name: Create a Machine Extension (PUT)
7776
text: |-
78-
az connectedmachine machine-extension create --machine-name "myMachine" --name "CustomScriptExtension" \
79-
--location "eastus2euap" --type "CustomScriptExtension" --publisher "Microsoft.Compute" --settings \
80-
"{\\"commandToExecute\\":\\"powershell.exe -c \\\\\\"Get-Process | Where-Object { $_.CPU -gt 10000 }\\\\\\"\\"}" \
81-
--type-handler-version "1.10" --resource-group "myResourceGroup"
77+
az connectedmachine extension create --machine-name "myMachine" --name "CustomScriptExtension" --location \
78+
"eastus2euap" --type "CustomScriptExtension" --publisher "Microsoft.Compute" --settings "{\\"commandToExecute\\":\\"pow\
79+
ershell.exe -c \\\\\\"Get-Process | Where-Object { $_.CPU -gt 10000 }\\\\\\"\\"}" --type-handler-version "1.10" \
80+
--resource-group "myResourceGroup"
8281
"""
8382

84-
helps['connectedmachine machine-extension update'] = """
83+
helps['connectedmachine extension update'] = """
8584
type: command
8685
short-summary: "The operation to update the extension."
8786
examples:
88-
- name: Update a Machine Extension
87+
- name: Update a Machine Extension (PATCH)
8988
text: |-
90-
az connectedmachine machine-extension update --machine-name "myMachine" --name "CustomScriptExtension" \
91-
--type "CustomScriptExtension" --publisher "Microsoft.Compute" --settings "{\\"commandToExecute\\":\\"powershell.exe \
92-
-c \\\\\\"Get-Process | Where-Object { $_.CPU -lt 100 }\\\\\\"\\"}" --type-handler-version "1.10" --resource-group \
89+
az connectedmachine extension update --machine-name "myMachine" --name "CustomScriptExtension" --type \
90+
"CustomScriptExtension" --publisher "Microsoft.Compute" --settings "{\\"commandToExecute\\":\\"powershell.exe -c \
91+
\\\\\\"Get-Process | Where-Object { $_.CPU -lt 100 }\\\\\\"\\"}" --type-handler-version "1.10" --resource-group \
9392
"myResourceGroup"
9493
"""
9594

96-
helps['connectedmachine machine-extension delete'] = """
95+
helps['connectedmachine extension delete'] = """
9796
type: command
9897
short-summary: "The operation to delete the extension."
9998
examples:
10099
- name: Delete a Machine Extension
101100
text: |-
102-
az connectedmachine machine-extension delete --machine-name "myMachine" --name "MMA" --resource-group \
101+
az connectedmachine extension delete --machine-name "myMachine" --name "MMA" --resource-group \
103102
"myResourceGroup"
104103
"""
105104

106-
helps['connectedmachine machine-extension wait'] = """
105+
helps['connectedmachine extension wait'] = """
107106
type: command
108-
short-summary: Place the CLI in a waiting state until a condition of the connectedmachine machine-extension is \
109-
met.
107+
short-summary: Place the CLI in a waiting state until a condition of the connectedmachine extension is met.
110108
examples:
111-
- name: Pause executing next line of CLI script until the connectedmachine machine-extension is successfully \
112-
created.
109+
- name: Pause executing next line of CLI script until the connectedmachine extension is successfully created.
113110
text: |-
114-
az connectedmachine machine-extension wait --machine-name "myMachine" --name "CustomScriptExtension" \
111+
az connectedmachine extension wait --machine-name "myMachine" --name "CustomScriptExtension" \
115112
--resource-group "myResourceGroup" --created
116-
- name: Pause executing next line of CLI script until the connectedmachine machine-extension is successfully \
117-
updated.
113+
- name: Pause executing next line of CLI script until the connectedmachine extension is successfully updated.
118114
text: |-
119-
az connectedmachine machine-extension wait --machine-name "myMachine" --name "CustomScriptExtension" \
115+
az connectedmachine extension wait --machine-name "myMachine" --name "CustomScriptExtension" \
120116
--resource-group "myResourceGroup" --updated
121-
- name: Pause executing next line of CLI script until the connectedmachine machine-extension is successfully \
122-
deleted.
117+
- name: Pause executing next line of CLI script until the connectedmachine extension is successfully deleted.
123118
text: |-
124-
az connectedmachine machine-extension wait --machine-name "myMachine" --name "CustomScriptExtension" \
119+
az connectedmachine extension wait --machine-name "myMachine" --name "CustomScriptExtension" \
125120
--resource-group "myResourceGroup" --deleted
126121
"""

src/connectedmachine/azext_connectedmachine/generated/_params.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,36 @@
2424

2525
def load_arguments(self, _):
2626

27-
with self.argument_context('connectedmachine machine list') as c:
27+
with self.argument_context('connectedmachine list') as c:
2828
c.argument('resource_group_name', resource_group_name_type)
2929

30-
with self.argument_context('connectedmachine machine show') as c:
30+
with self.argument_context('connectedmachine show') as c:
3131
c.argument('resource_group_name', resource_group_name_type)
3232
c.argument('machine_name', options_list=['--name', '-n', '--machine-name'], type=str, help='The name of the '
3333
'hybrid machine.', id_part='name')
3434

35-
with self.argument_context('connectedmachine machine delete') as c:
35+
with self.argument_context('connectedmachine delete') as c:
3636
c.argument('resource_group_name', resource_group_name_type)
3737
c.argument('machine_name', options_list=['--name', '-n', '--machine-name'], type=str, help='The name of the '
3838
'hybrid machine.', id_part='name')
3939

40-
with self.argument_context('connectedmachine machine-extension list') as c:
40+
with self.argument_context('connectedmachine extension list') as c:
4141
c.argument('resource_group_name', resource_group_name_type)
4242
c.argument('machine_name', type=str, help='The name of the machine containing the extension.')
4343
c.argument('expand', type=str, help='The expand expression to apply on the operation.')
4444

45-
with self.argument_context('connectedmachine machine-extension show') as c:
45+
with self.argument_context('connectedmachine extension show') as c:
4646
c.argument('resource_group_name', resource_group_name_type)
4747
c.argument('machine_name', type=str, help='The name of the machine containing the extension.', id_part='name')
48-
c.argument('name', options_list=['--name', '-n', '--extension-name'], type=str, help='The name of the machine extension.', id_part='child_name_1')
48+
c.argument('name', options_list=['-n', '--extension-name', '--name'], type=str, help='The name of the machine '
49+
'extension.', id_part='child_name_1')
4950

50-
with self.argument_context('connectedmachine machine-extension create') as c:
51+
with self.argument_context('connectedmachine extension create') as c:
5152
c.argument('resource_group_name', resource_group_name_type)
5253
c.argument('machine_name', type=str, help='The name of the machine where the extension should be created or '
5354
'updated.')
54-
c.argument('name', options_list=['--name', '-n', '--extension-name'], type=str, help='The name of the machine extension.')
55+
c.argument('name', options_list=['-n', '--extension-name', '--name'], type=str, help='The name of the machine '
56+
'extension.')
5557
c.argument('tags', tags_type)
5658
c.argument('location', arg_type=get_location_type(self.cli_ctx),
5759
validator=get_default_location_from_resource_group)
@@ -71,11 +73,12 @@ def load_arguments(self, _):
7173
'protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. Expected '
7274
'value: json-string/@json-file.')
7375

74-
with self.argument_context('connectedmachine machine-extension update') as c:
76+
with self.argument_context('connectedmachine extension update') as c:
7577
c.argument('resource_group_name', resource_group_name_type)
7678
c.argument('machine_name', type=str, help='The name of the machine where the extension should be created or '
7779
'updated.', id_part='name')
78-
c.argument('name', options_list=['--name', '-n', '--extension-name'], type=str, help='The name of the machine extension.', id_part='child_name_1')
80+
c.argument('name', options_list=['-n', '--extension-name', '--name'], type=str, help='The name of the machine '
81+
'extension.', id_part='child_name_1')
7982
c.argument('tags', tags_type)
8083
c.argument('force_update_tag', type=str, help='How the extension handler should be forced to update even if '
8184
'the extension configuration has not changed.')
@@ -93,13 +96,15 @@ def load_arguments(self, _):
9396
'protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. Expected '
9497
'value: json-string/@json-file.')
9598

96-
with self.argument_context('connectedmachine machine-extension delete') as c:
99+
with self.argument_context('connectedmachine extension delete') as c:
97100
c.argument('resource_group_name', resource_group_name_type)
98101
c.argument('machine_name', type=str, help='The name of the machine where the extension should be deleted.',
99102
id_part='name')
100-
c.argument('name', options_list=['--name', '-n', '--extension-name'], type=str, help='The name of the machine extension.', id_part='child_name_1')
103+
c.argument('name', options_list=['-n', '--extension-name', '--name'], type=str, help='The name of the machine '
104+
'extension.', id_part='child_name_1')
101105

102-
with self.argument_context('connectedmachine machine-extension wait') as c:
106+
with self.argument_context('connectedmachine extension wait') as c:
103107
c.argument('resource_group_name', resource_group_name_type)
104108
c.argument('machine_name', type=str, help='The name of the machine containing the extension.', id_part='name')
105-
c.argument('name', options_list=['--name', '-n', '--extension-name'], type=str, help='The name of the machine extension.', id_part='child_name_1')
109+
c.argument('name', options_list=['-n', '--extension-name', '--name'], type=str, help='The name of the machine '
110+
'extension.', id_part='child_name_1')

src/connectedmachine/azext_connectedmachine/generated/commands.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,21 @@ def load_command_table(self, _):
2020
operations_tmpl='azext_connectedmachine.vendored_sdks.connectedmachine.operations._machine_operations#MachineOp'
2121
'erations.{}',
2222
client_factory=cf_machine)
23-
with self.command_group('connectedmachine machine', connectedmachine_machine, client_factory=cf_machine,
24-
is_experimental=True) as g:
25-
g.custom_command('list', 'connectedmachine_machine_list')
26-
g.custom_show_command('show', 'connectedmachine_machine_show')
27-
g.custom_command('delete', 'connectedmachine_machine_delete', confirmation=True)
23+
with self.command_group('connectedmachine', connectedmachine_machine, client_factory=cf_machine) as g:
24+
g.custom_command('list', 'connectedmachine_list')
25+
g.custom_show_command('show', 'connectedmachine_show')
26+
g.custom_command('delete', 'connectedmachine_delete', confirmation=True)
2827

2928
from azext_connectedmachine.generated._client_factory import cf_machine_extension
3029
connectedmachine_machine_extension = CliCommandType(
3130
operations_tmpl='azext_connectedmachine.vendored_sdks.connectedmachine.operations._machine_extension_operations'
3231
'#MachineExtensionOperations.{}',
3332
client_factory=cf_machine_extension)
34-
with self.command_group('connectedmachine machine-extension', connectedmachine_machine_extension,
33+
with self.command_group('connectedmachine extension', connectedmachine_machine_extension,
3534
client_factory=cf_machine_extension, is_experimental=True) as g:
36-
g.custom_command('list', 'connectedmachine_machine_extension_list')
37-
g.custom_show_command('show', 'connectedmachine_machine_extension_show')
38-
g.custom_command('create', 'connectedmachine_machine_extension_create', supports_no_wait=True)
39-
g.custom_command('update', 'connectedmachine_machine_extension_update', supports_no_wait=True)
40-
g.custom_command('delete', 'connectedmachine_machine_extension_delete', supports_no_wait=True,
41-
confirmation=True)
42-
g.custom_wait_command('wait', 'connectedmachine_machine_extension_show')
35+
g.custom_command('list', 'connectedmachine_extension_list')
36+
g.custom_show_command('show', 'connectedmachine_extension_show')
37+
g.custom_command('create', 'connectedmachine_extension_create', supports_no_wait=True)
38+
g.custom_command('update', 'connectedmachine_extension_update', supports_no_wait=True)
39+
g.custom_command('delete', 'connectedmachine_extension_delete', supports_no_wait=True, confirmation=True)
40+
g.custom_wait_command('wait', 'connectedmachine_extension_show')

0 commit comments

Comments
 (0)