Skip to content

Commit

Permalink
CodeGen from PR 15366 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 99916ed0a9e2c7bc267f59b3a84813712938aa4e into 57e30b5
  • Loading branch information
SDKAuto committed Jul 28, 2021
1 parent cb5c2a5 commit 5491556
Show file tree
Hide file tree
Showing 38 changed files with 1,462 additions and 2,190 deletions.
4 changes: 2 additions & 2 deletions src/guestconfig/azext_guestconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class GuestConfigurationClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_guestconfig.generated._client_factory import cf_guestconfig
from azext_guestconfig.generated._client_factory import cf_guestconfig_cl
guestconfig_custom = CliCommandType(
operations_tmpl='azext_guestconfig.custom#{}',
client_factory=cf_guestconfig)
client_factory=cf_guestconfig_cl)
parent = super(GuestConfigurationClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=guestconfig_custom)

Expand Down
2 changes: 1 addition & 1 deletion src/guestconfig/azext_guestconfig/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
"azext.minCliCoreVersion": "2.15.0"
}
15 changes: 8 additions & 7 deletions src/guestconfig/azext_guestconfig/generated/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@
# --------------------------------------------------------------------------


def cf_guestconfig(cli_ctx, *_):
def cf_guestconfig_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.guestconfig import GuestConfigurationClient
return get_mgmt_service_client(cli_ctx, GuestConfigurationClient)
from azext_guestconfig.vendored_sdks.guestconfig import GuestConfigurationClient
return get_mgmt_service_client(cli_ctx,
GuestConfigurationClient)


def cf_guest_configuration_assignment(cli_ctx, *_):
return cf_guestconfig(cli_ctx).guest_configuration_assignment
return cf_guestconfig_cl(cli_ctx).guest_configuration_assignments


def cf_guest_configuration_assignment_report(cli_ctx, *_):
return cf_guestconfig(cli_ctx).guest_configuration_assignment_report
return cf_guestconfig_cl(cli_ctx).guest_configuration_assignment_reports


def cf_guest_configuration_hcrp_assignment(cli_ctx, *_):
return cf_guestconfig(cli_ctx).guest_configuration_hcrp_assignment
return cf_guestconfig_cl(cli_ctx).guest_configuration_hcrp_assignments


def cf_guest_configuration_hcrp_assignment_report(cli_ctx, *_):
return cf_guestconfig(cli_ctx).guest_configuration_hcrp_assignment_report
return cf_guestconfig_cl(cli_ctx).guest_configuration_hcrp_assignment_reports
290 changes: 28 additions & 262 deletions src/guestconfig/azext_guestconfig/generated/_help.py

Large diffs are not rendered by default.

144 changes: 22 additions & 122 deletions src/guestconfig/azext_guestconfig/generated/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,154 +10,54 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from knack.arguments import CLIArgumentType
from azure.cli.core.commands.parameters import (
resource_group_name_type,
get_location_type
)
from azure.cli.core.commands.validators import get_default_location_from_resource_group
from azext_guestconfig.action import (
AddGuestConfigurationConfigurationParameter,
AddGuestConfigurationConfigurationSetting
)
from azure.cli.core.commands.parameters import resource_group_name_type


def load_arguments(self, _):

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

with self.argument_context('guestconfig guest-configuration-assignment show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='The guest configuration '
'assignment name.', id_part='child_name_1')
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')

with self.argument_context('guestconfig guest-configuration-assignment create') as c:
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.')
c.argument('resource_group_name', resource_group_name_type)
c.argument('vm_name', help='The name of the virtual machine.')
c.argument('name', help='Name of the guest configuration assignment.')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
c.argument('guest_configuration_name', help='Name of the guest configuration.')
c.argument('guest_configuration_version', help='Version of the guest configuration.')
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
nargs='+', help='The configuration parameters for the guest configuration.')
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
nargs='+', help='The configuration setting for the guest configuration.')

with self.argument_context('guestconfig guest-configuration-assignment update') as c:
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.', id_part='child_name_1')
c.argument('resource_group_name', resource_group_name_type)
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
c.argument('name', help='Name of the guest configuration assignment.')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
c.argument('guest_configuration_name', help='Name of the guest configuration.')
c.argument('guest_configuration_version', help='Version of the guest configuration.')
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
nargs='+', help='The configuration parameters for the guest configuration.')
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
nargs='+', help='The configuration setting for the guest configuration.')

with self.argument_context('guestconfig guest-configuration-assignment delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='Name of the guest config'
'uration assignment', id_part='child_name_1')
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')

with self.argument_context('guestconfig guest-configuration-assignment wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='The guest configuration '
'assignment name.', id_part='child_name_1')
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
c.argument('guest_configuration_assignment_name', options_list=['--name', '-n',
'--guest-configuration-assignment-name'],
type=str, help='The guest configuration assignment name.', id_part='child_name_1')
c.argument('vm_name', type=str, help='The name of the virtual machine.', id_part='name')

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

with self.argument_context('guestconfig guest-configuration-assignment-report show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
'ld_name_1')
c.argument('report_id', help='The GUID for the guest configuration assignment report.',
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.',
id_part='child_name_1')
c.argument('report_id', type=str, help='The GUID for the guest configuration assignment report.',
id_part='child_name_2')
c.argument('vm_name', help='The name of the virtual machine.', id_part='name')
c.argument('vm_name', type=str, help='The name of the virtual machine.', id_part='name')

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

with self.argument_context('guestconfig guest-configuration-hcrp-assignment show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
'ld_name_1')
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')

with self.argument_context('guestconfig guest-configuration-hcrp-assignment create') as c:
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.')
c.argument('resource_group_name', resource_group_name_type)
c.argument('machine_name', help='The name of the ARC machine.')
c.argument('name', help='Name of the guest configuration assignment.')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
c.argument('guest_configuration_name', help='Name of the guest configuration.')
c.argument('guest_configuration_version', help='Version of the guest configuration.')
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
nargs='+', help='The configuration parameters for the guest configuration.')
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
nargs='+', help='The configuration setting for the guest configuration.')

with self.argument_context('guestconfig guest-configuration-hcrp-assignment update') as c:
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.', id_part='child_name_1')
c.argument('resource_group_name', resource_group_name_type)
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
c.argument('name', help='Name of the guest configuration assignment.')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy')
c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r'
'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.'))
c.argument('guest_configuration_name', help='Name of the guest configuration.')
c.argument('guest_configuration_version', help='Version of the guest configuration.')
c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter,
nargs='+', help='The configuration parameters for the guest configuration.')
c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting,
nargs='+', help='The configuration setting for the guest configuration.')

with self.argument_context('guestconfig guest-configuration-hcrp-assignment delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment', id_part='c'
'hild_name_1')
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')

with self.argument_context('guestconfig guest-configuration-hcrp-assignment wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
'ld_name_1')
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.',
id_part='child_name_1')
c.argument('machine_name', type=str, help='The name of the ARC machine.', id_part='name')

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

with self.argument_context('guestconfig guest-configuration-hcrp-assignment-report show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi'
'ld_name_1')
c.argument('report_id', help='The GUID for the guest configuration assignment report.',
c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.',
id_part='child_name_1')
c.argument('report_id', type=str, help='The GUID for the guest configuration assignment report.',
id_part='child_name_2')
c.argument('machine_name', help='The name of the ARC machine.', id_part='name')
c.argument('machine_name', type=str, help='The name of the ARC machine.', id_part='name')
63 changes: 0 additions & 63 deletions src/guestconfig/azext_guestconfig/generated/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,3 @@
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=protected-access

import argparse
from knack.util import CLIError
from collections import defaultdict


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

def get_action(self, values, option_string): # pylint: disable=no-self-use
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 == 'name':
d['name'] = v[0]
elif kl == 'value':
d['value'] = v[0]
return d


class AddGuestConfigurationConfigurationSetting(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.guest_configuration_configuration_setting = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
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 = {}
d['refresh_frequency_mins'] = 30
d['reboot_if_needed'] = "False"
d['configuration_mode_frequency_mins'] = 15
for k in properties:
kl = k.lower()
v = properties[k]
if kl == 'configuration-mode':
d['configuration_mode'] = v[0]
elif kl == 'allow-module-overwrite':
d['allow_module_overwrite'] = v[0]
elif kl == 'action-after-reboot':
d['action_after_reboot'] = v[0]
elif kl == 'refresh-frequency-mins':
d['refresh_frequency_mins'] = v[0]
elif kl == 'reboot-if-needed':
d['reboot_if_needed'] = v[0]
elif kl == 'configuration-mode-frequency-mins':
d['configuration_mode_frequency_mins'] = v[0]
return d
Loading

0 comments on commit 5491556

Please sign in to comment.