def __init__(self, session, service, operation, arg_table, name, event_class): HelpCommand.__init__(self, session, operation, None, arg_table) self.service = service self.param_shorthand = ParamShorthand() self._name = name self._event_class = event_class
def awscli_initialize(event_handlers): param_shorthand = ParamShorthand() event_handlers.register('process-cli-arg', param_shorthand) # The following will get fired for every option we are # documenting. It will attempt to add an example_fn on to # the parameter object if the parameter supports shorthand # syntax. The documentation event handlers will then use # the examplefn to generate the sample shorthand syntax # in the docs. Registering here should ensure that this # handler gets called first but it still feels a bit brittle. event_handlers.register('doc-option-example.*.*.*', param_shorthand.add_example_fn) event_handlers.register('doc-examples.*.*', add_examples) event_handlers.register('building-argument-table.s3api.*', add_streaming_output_arg) event_handlers.register('building-argument-table.ec2.run-instances', ec2_add_count) event_handlers.register('building-argument-table', unify_paging_params) event_handlers.register('building-argument-table.ec2.get-password-data', ec2_add_priv_launch_key) register_secgroup(event_handlers) register_bundleinstance(event_handlers) s3_plugin_initialize(event_handlers) register_runinstances(event_handlers) register_removals(event_handlers) register_preview_commands(event_handlers) register_rds_modify_split(event_handlers)
def awscli_initialize(event_handlers): event_handlers.register('load-cli-arg', uri_param) param_shorthand = ParamShorthand() event_handlers.register('process-cli-arg', param_shorthand) # The s3 error mesage needs to registered before the # generic error handler. register_s3_error_msg(event_handlers) error_handler = ErrorHandler() event_handlers.register('after-call', error_handler, unique_id='awscli-error-handler') # # The following will get fired for every option we are # # documenting. It will attempt to add an example_fn on to # # the parameter object if the parameter supports shorthand # # syntax. The documentation event handlers will then use # # the examplefn to generate the sample shorthand syntax # # in the docs. Registering here should ensure that this # # handler gets called first but it still feels a bit brittle. # event_handlers.register('doc-option-example.*.*.*', # param_shorthand.add_example_fn) event_handlers.register('doc-examples.*.*', add_examples) register_cli_input_json(event_handlers) event_handlers.register('building-argument-table.*', add_streaming_output_arg) event_handlers.register('building-argument-table.ec2.run-instances', ec2_add_count) event_handlers.register('building-argument-table.ec2.get-password-data', ec2_add_priv_launch_key) register_parse_global_args(event_handlers) register_pagination(event_handlers) register_secgroup(event_handlers) register_bundleinstance(event_handlers) s3_plugin_initialize(event_handlers) register_runinstances(event_handlers) register_removals(event_handlers) register_preview_commands(event_handlers) register_rds_modify_split(event_handlers) register_put_metric_data(event_handlers) register_ses_send_email(event_handlers) IAMVMFAWrapper(event_handlers) register_arg_renames(event_handlers) register_dryrun_docs(event_handlers) register_configure_cmd(event_handlers) cloudtrail_init(event_handlers) register_bool_params(event_handlers) register_protocol_args(event_handlers) datapipeline.register_customizations(event_handlers) cloudsearch_init(event_handlers) emr_initialize(event_handlers) register_cloudsearchdomain(event_handlers) register_s3_endpoint(event_handlers) register_generate_cli_skeleton(event_handlers) register_assume_role_provider(event_handlers) register_add_waiters(event_handlers) codedeploy_init(event_handlers) register_subscribe(event_handlers) register_get_status(event_handlers) register_rename_config(event_handlers) register_scalar_parser(event_handlers) opsworks_init(event_handlers)
def awscli_initialize(event_handlers): event_handlers.register('load-cli-arg', uri_param) param_shorthand = ParamShorthand() event_handlers.register('process-cli-arg', param_shorthand) error_handler = ErrorHandler() event_handlers.register('after-call.*.*', error_handler) # The following will get fired for every option we are # documenting. It will attempt to add an example_fn on to # the parameter object if the parameter supports shorthand # syntax. The documentation event handlers will then use # the examplefn to generate the sample shorthand syntax # in the docs. Registering here should ensure that this # handler gets called first but it still feels a bit brittle. event_handlers.register('doc-option-example.*.*.*', param_shorthand.add_example_fn) event_handlers.register('doc-examples.*.*', add_examples) event_handlers.register('building-argument-table.s3api.*', add_streaming_output_arg) event_handlers.register('building-argument-table.ec2.run-instances', ec2_add_count) event_handlers.register('building-argument-table.ec2.get-password-data', ec2_add_priv_launch_key) register_parse_global_args(event_handlers) register_pagination(event_handlers) register_secgroup(event_handlers) register_bundleinstance(event_handlers) s3_plugin_initialize(event_handlers) register_runinstances(event_handlers) register_removals(event_handlers) register_preview_commands(event_handlers) register_rds_modify_split(event_handlers) register_put_metric_data(event_handlers) register_ses_send_email(event_handlers) IAMVMFAWrapper(event_handlers) register_arg_renames(event_handlers) register_dryrun_docs(event_handlers) register_resource_id(event_handlers) register_configure_cmd(event_handlers) cloudtrail_init(event_handlers) register_bool_params(event_handlers) register_protocol_args(event_handlers) datapipeline.register_customizations(event_handlers) cloudsearch_init(event_handlers)
class TestDocGen(BaseArgProcessTest): # These aren't very extensive doc tests, as we want to stay somewhat # flexible and allow the docs to slightly change without breaking these # tests. def setUp(self): super(TestDocGen, self).setUp() self.simplify = ParamShorthand() def test_gen_map_type_docs(self): p = self.get_param_object('sqs.SetQueueAttributes.Attributes') op_doc = OperationDocument(self.session, p.operation) self.simplify.add_docs(op_doc, p) fp = six.StringIO() op_doc.render(fp=fp) rendered = fp.getvalue() # Key parts include: # Title that says it's the shorthand syntax. self.assertIn('Shorthand Syntax', rendered) # sample syntax self.assertIn('key_name=string', rendered) # valid key names self.assertIn('VisibilityTimeout', rendered) def test_gen_list_scalar_docs(self): p = self.get_param_object( 'elb.RegisterInstancesWithLoadBalancer.Instances') op_doc = OperationDocument(self.session, p.operation) self.simplify.add_docs(op_doc, p) fp = six.StringIO() op_doc.render(fp=fp) rendered = fp.getvalue() # Key parts include: # Title that says it's the shorthand syntax. self.assertIn('Shorthand Syntax', rendered) # sample syntax self.assertIn('--instances instance_id1', rendered) def test_gen_list_structure_of_scalars_docs(self): p = self.get_param_object('elb.CreateLoadBalancer.Listeners') op_doc = OperationDocument(self.session, p.operation) self.simplify.add_docs(op_doc, p) fp = six.StringIO() op_doc.render(fp=fp) rendered = fp.getvalue() self.assertIn('Shorthand Syntax', rendered) self.assertIn('--listeners', rendered) self.assertIn('protocol=string', rendered)
def setUp(self): super(TestUnpackJSONParams, self).setUp() self.simplify = ParamShorthand()
def setUp(self): super(TestDocGen, self).setUp() self.simplify = ParamShorthand()
def setUp(self): super(TestDocGen, self).setUp() self.simplify = ParamShorthand() self.shorthand_documenter = ParamShorthandDocGen()
def setUp(self): super(TestParamShorthandCustomArguments, self).setUp() self.simplify = ParamShorthand()
def awscli_initialize(event_handlers): param_shorthand = ParamShorthand() event_handlers.register('process-cli-arg', param_shorthand) event_handlers.register('add-syntax-example', param_shorthand.add_docs)
def __init__(self, session, service, operation, arg_table): HelpCommand.__init__(self, session, operation, None, arg_table) self.service = service self.param_shorthand = ParamShorthand()