def expand(self, argument_name, model_type, group_name=None, patches=None): # TODO: # two privates symbols are imported here. they should be made public or this utility class # should be moved into azure.cli.core from azure.cli.core.commands import _cli_extra_argument_registry from azure.cli.core.commands._introspection import \ (extract_args_from_signature, _option_descriptions) from azure.cli.core.sdk.validators import get_complex_argument_processor if not patches: patches = dict() self.ignore(argument_name) # fetch the documentation for model parameters first. for models, which are the classes # derive from msrest.serialization.Model and used in the SDK API to carry parameters, the # document of their properties are attached to the classes instead of constructors. parameter_docs = _option_descriptions(model_type) expanded_arguments = [] for name, arg in extract_args_from_signature(model_type.__init__): if name in parameter_docs: arg.type.settings['help'] = parameter_docs[name] if group_name: arg.type.settings['arg_group'] = group_name if name in patches: patches[name](arg) _cli_extra_argument_registry[self._commmand][name] = arg expanded_arguments.append(name) self.argument(argument_name, arg_type=ignore_type, validator=get_complex_argument_processor(expanded_arguments, argument_name, model_type))