Skip to content

Commit 6f8b6a2

Browse files
author
SDKAuto
committed
CodeGen from PR 14999 in Azure/azure-rest-api-specs
Merge d5a3a6c634ff59d537674a021a427975eeaf4e5c into 7601061
1 parent b4e0709 commit 6f8b6a2

36 files changed

+1346
-2117
lines changed

src/guestconfig/azext_guestconfig/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@
1010

1111
from azure.cli.core import AzCommandsLoader
1212
from azext_guestconfig.generated._help import helps # pylint: disable=unused-import
13+
try:
14+
from azext_guestconfig.manual._help import helps # pylint: disable=reimported
15+
except ImportError:
16+
pass
1317

1418

1519
class GuestConfigurationClientCommandsLoader(AzCommandsLoader):
1620

1721
def __init__(self, cli_ctx=None):
1822
from azure.cli.core.commands import CliCommandType
19-
from azext_guestconfig.generated._client_factory import cf_guestconfig
23+
from azext_guestconfig.generated._client_factory import cf_guestconfig_cl
2024
guestconfig_custom = CliCommandType(
2125
operations_tmpl='azext_guestconfig.custom#{}',
22-
client_factory=cf_guestconfig)
26+
client_factory=cf_guestconfig_cl)
2327
parent = super(GuestConfigurationClientCommandsLoader, self)
2428
parent.__init__(cli_ctx=cli_ctx, custom_command_type=guestconfig_custom)
2529

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"azext.isExperimental": true,
3-
"azext.minCliCoreVersion": "2.3.1"
3+
"azext.minCliCoreVersion": "2.15.0"
44
}

src/guestconfig/azext_guestconfig/generated/_client_factory.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@
99
# --------------------------------------------------------------------------
1010

1111

12-
def cf_guestconfig(cli_ctx, *_):
12+
def cf_guestconfig_cl(cli_ctx, *_):
1313
from azure.cli.core.commands.client_factory import get_mgmt_service_client
14-
from ..vendored_sdks.guestconfig import GuestConfigurationClient
15-
return get_mgmt_service_client(cli_ctx, GuestConfigurationClient)
14+
from azext_guestconfig.vendored_sdks.guestconfig import GuestConfigurationClient
15+
return get_mgmt_service_client(cli_ctx,
16+
GuestConfigurationClient)
1617

1718

1819
def cf_guest_configuration_assignment(cli_ctx, *_):
19-
return cf_guestconfig(cli_ctx).guest_configuration_assignment
20+
return cf_guestconfig_cl(cli_ctx).guest_configuration_assignments
2021

2122

2223
def cf_guest_configuration_assignment_report(cli_ctx, *_):
23-
return cf_guestconfig(cli_ctx).guest_configuration_assignment_report
24+
return cf_guestconfig_cl(cli_ctx).guest_configuration_assignment_reports
2425

2526

2627
def cf_guest_configuration_hcrp_assignment(cli_ctx, *_):
27-
return cf_guestconfig(cli_ctx).guest_configuration_hcrp_assignment
28+
return cf_guestconfig_cl(cli_ctx).guest_configuration_hcrp_assignments
2829

2930

3031
def cf_guest_configuration_hcrp_assignment_report(cli_ctx, *_):
31-
return cf_guestconfig(cli_ctx).guest_configuration_hcrp_assignment_report
32+
return cf_guestconfig_cl(cli_ctx).guest_configuration_hcrp_assignment_reports

src/guestconfig/azext_guestconfig/generated/_help.py

Lines changed: 28 additions & 262 deletions
Large diffs are not rendered by default.

src/guestconfig/azext_guestconfig/generated/_params.py

Lines changed: 22 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -10,154 +10,54 @@
1010
# pylint: disable=too-many-lines
1111
# pylint: disable=too-many-statements
1212

13-
from knack.arguments import CLIArgumentType
14-
from azure.cli.core.commands.parameters import (
15-
resource_group_name_type,
16-
get_location_type
17-
)
18-
from azure.cli.core.commands.validators import get_default_location_from_resource_group
19-
from azext_guestconfig.action import (
20-
AddGuestConfigurationConfigurationParameter,
21-
AddGuestConfigurationConfigurationSetting
22-
)
13+
from azure.cli.core.commands.parameters import resource_group_name_type
2314

2415

2516
def load_arguments(self, _):
2617

2718
with self.argument_context('guestconfig guest-configuration-assignment list') as c:
2819
c.argument('resource_group_name', resource_group_name_type)
29-
c.argument('vm_name', help='The name of the virtual machine.')
20+
c.argument('vm_name', type=str, help='The name of the virtual machine.')
3021

3122
with self.argument_context('guestconfig guest-configuration-assignment show') as c:
3223
c.argument('resource_group_name', resource_group_name_type)
33-
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='The guest configuration '
34-
'assignment name.', id_part='child_name_1')
35-
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
36-
37-
with self.argument_context('guestconfig guest-configuration-assignment create') as c:
38-
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.')
39-
c.argument('resource_group_name', resource_group_name_type)
40-
c.argument('vm_name', help='The name of the virtual machine.')
41-
c.argument('name', help='Name of the guest configuration assignment.')
42-
c.argument('location', arg_type=get_location_type(self.cli_ctx),
43-
validator=get_default_location_from_resource_group)
44-
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
45-
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
46-
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
47-
c.argument('guest_configuration_name', help='Name of the guest configuration.')
48-
c.argument('guest_configuration_version', help='Version of the guest configuration.')
49-
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
50-
nargs='+', help='The configuration parameters for the guest configuration.')
51-
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
52-
nargs='+', help='The configuration setting for the guest configuration.')
53-
54-
with self.argument_context('guestconfig guest-configuration-assignment update') as c:
55-
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.', id_part='child_name_1')
56-
c.argument('resource_group_name', resource_group_name_type)
57-
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
58-
c.argument('name', help='Name of the guest configuration assignment.')
59-
c.argument('location', arg_type=get_location_type(self.cli_ctx),
60-
validator=get_default_location_from_resource_group)
61-
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
62-
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
63-
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
64-
c.argument('guest_configuration_name', help='Name of the guest configuration.')
65-
c.argument('guest_configuration_version', help='Version of the guest configuration.')
66-
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
67-
nargs='+', help='The configuration parameters for the guest configuration.')
68-
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
69-
nargs='+', help='The configuration setting for the guest configuration.')
70-
71-
with self.argument_context('guestconfig guest-configuration-assignment delete') as c:
72-
c.argument('resource_group_name', resource_group_name_type)
73-
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='Name of the guest config'
74-
'uration assignment', id_part='child_name_1')
75-
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
76-
77-
with self.argument_context('guestconfig guest-configuration-assignment wait') as c:
78-
c.argument('resource_group_name', resource_group_name_type)
79-
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='The guest configuration '
80-
'assignment name.', id_part='child_name_1')
81-
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
24+
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n',
25+
'--guest-configuration-assignment-name'],
26+
type=str, help='The guest configuration assignment name.', id_part='child_name_1')
27+
c.argument('vm_name', type=str, help='The name of the virtual machine.', id_part='name')
8228

8329
with self.argument_context('guestconfig guest-configuration-assignment-report list') as c:
8430
c.argument('resource_group_name', resource_group_name_type)
85-
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.')
86-
c.argument('vm_name', help='The name of the virtual machine.')
31+
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.')
32+
c.argument('vm_name', type=str, help='The name of the virtual machine.')
8733

8834
with self.argument_context('guestconfig guest-configuration-assignment-report show') as c:
8935
c.argument('resource_group_name', resource_group_name_type)
90-
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
91-
'ld_name_1')
92-
c.argument('report_id', help='The GUID for the guest configuration assignment report.',
36+
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.',
37+
id_part='child_name_1')
38+
c.argument('report_id', type=str, help='The GUID for the guest configuration assignment report.',
9339
id_part='child_name_2')
94-
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
40+
c.argument('vm_name', type=str, help='The name of the virtual machine.', id_part='name')
9541

9642
with self.argument_context('guestconfig guest-configuration-hcrp-assignment list') as c:
9743
c.argument('resource_group_name', resource_group_name_type)
98-
c.argument('machine_name', help='The name of the ARC machine.')
44+
c.argument('machine_name', type=str, help='The name of the ARC machine.')
9945

10046
with self.argument_context('guestconfig guest-configuration-hcrp-assignment show') as c:
10147
c.argument('resource_group_name', resource_group_name_type)
102-
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
103-
'ld_name_1')
104-
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
105-
106-
with self.argument_context('guestconfig guest-configuration-hcrp-assignment create') as c:
107-
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.')
108-
c.argument('resource_group_name', resource_group_name_type)
109-
c.argument('machine_name', help='The name of the ARC machine.')
110-
c.argument('name', help='Name of the guest configuration assignment.')
111-
c.argument('location', arg_type=get_location_type(self.cli_ctx),
112-
validator=get_default_location_from_resource_group)
113-
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
114-
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
115-
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
116-
c.argument('guest_configuration_name', help='Name of the guest configuration.')
117-
c.argument('guest_configuration_version', help='Version of the guest configuration.')
118-
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
119-
nargs='+', help='The configuration parameters for the guest configuration.')
120-
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
121-
nargs='+', help='The configuration setting for the guest configuration.')
122-
123-
with self.argument_context('guestconfig guest-configuration-hcrp-assignment update') as c:
124-
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.', id_part='child_name_1')
125-
c.argument('resource_group_name', resource_group_name_type)
126-
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
127-
c.argument('name', help='Name of the guest configuration assignment.')
128-
c.argument('location', arg_type=get_location_type(self.cli_ctx),
129-
validator=get_default_location_from_resource_group)
130-
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
131-
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
132-
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
133-
c.argument('guest_configuration_name', help='Name of the guest configuration.')
134-
c.argument('guest_configuration_version', help='Version of the guest configuration.')
135-
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
136-
nargs='+', help='The configuration parameters for the guest configuration.')
137-
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
138-
nargs='+', help='The configuration setting for the guest configuration.')
139-
140-
with self.argument_context('guestconfig guest-configuration-hcrp-assignment delete') as c:
141-
c.argument('resource_group_name', resource_group_name_type)
142-
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment', id_part='c'
143-
'hild_name_1')
144-
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
145-
146-
with self.argument_context('guestconfig guest-configuration-hcrp-assignment wait') as c:
147-
c.argument('resource_group_name', resource_group_name_type)
148-
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
149-
'ld_name_1')
150-
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
48+
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.',
49+
id_part='child_name_1')
50+
c.argument('machine_name', type=str, help='The name of the ARC machine.', id_part='name')
15151

15252
with self.argument_context('guestconfig guest-configuration-hcrp-assignment-report list') as c:
15353
c.argument('resource_group_name', resource_group_name_type)
154-
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.')
155-
c.argument('machine_name', help='The name of the ARC machine.')
54+
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.')
55+
c.argument('machine_name', type=str, help='The name of the ARC machine.')
15656

15757
with self.argument_context('guestconfig guest-configuration-hcrp-assignment-report show') as c:
15858
c.argument('resource_group_name', resource_group_name_type)
159-
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
160-
'ld_name_1')
161-
c.argument('report_id', help='The GUID for the guest configuration assignment report.',
59+
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.',
60+
id_part='child_name_1')
61+
c.argument('report_id', type=str, help='The GUID for the guest configuration assignment report.',
16262
id_part='child_name_2')
163-
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
63+
c.argument('machine_name', type=str, help='The name of the ARC machine.', id_part='name')

src/guestconfig/azext_guestconfig/generated/action.py

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -8,66 +8,3 @@
88
# regenerated.
99
# --------------------------------------------------------------------------
1010
# pylint: disable=protected-access
11-
12-
import argparse
13-
from knack.util import CLIError
14-
from collections import defaultdict
15-
16-
17-
class AddGuestConfigurationConfigurationParameter(argparse._AppendAction):
18-
def __call__(self, parser, namespace, values, option_string=None):
19-
action = self.get_action(values, option_string)
20-
super(AddGuestConfigurationConfigurationParameter, self).__call__(parser, namespace, action, option_string)
21-
22-
def get_action(self, values, option_string): # pylint: disable=no-self-use
23-
try:
24-
properties = defaultdict(list)
25-
for (k, v) in (x.split('=', 1) for x in values):
26-
properties[k].append(v)
27-
properties = dict(properties)
28-
except ValueError:
29-
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
30-
d = {}
31-
for k in properties:
32-
kl = k.lower()
33-
v = properties[k]
34-
if kl == 'name':
35-
d['name'] = v[0]
36-
elif kl == 'value':
37-
d['value'] = v[0]
38-
return d
39-
40-
41-
class AddGuestConfigurationConfigurationSetting(argparse.Action):
42-
def __call__(self, parser, namespace, values, option_string=None):
43-
action = self.get_action(values, option_string)
44-
namespace.guest_configuration_configuration_setting = action
45-
46-
def get_action(self, values, option_string): # pylint: disable=no-self-use
47-
try:
48-
properties = defaultdict(list)
49-
for (k, v) in (x.split('=', 1) for x in values):
50-
properties[k].append(v)
51-
properties = dict(properties)
52-
except ValueError:
53-
raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))
54-
d = {}
55-
d['refresh_frequency_mins'] = 30
56-
d['reboot_if_needed'] = "False"
57-
d['configuration_mode_frequency_mins'] = 15
58-
for k in properties:
59-
kl = k.lower()
60-
v = properties[k]
61-
if kl == 'configuration-mode':
62-
d['configuration_mode'] = v[0]
63-
elif kl == 'allow-module-overwrite':
64-
d['allow_module_overwrite'] = v[0]
65-
elif kl == 'action-after-reboot':
66-
d['action_after_reboot'] = v[0]
67-
elif kl == 'refresh-frequency-mins':
68-
d['refresh_frequency_mins'] = v[0]
69-
elif kl == 'reboot-if-needed':
70-
d['reboot_if_needed'] = v[0]
71-
elif kl == 'configuration-mode-frequency-mins':
72-
d['configuration_mode_frequency_mins'] = v[0]
73-
return d

0 commit comments

Comments
 (0)