Skip to content

No clear documentation for creating a aws-cli plugin #1261

@RichardBronosky

Description

@RichardBronosky

I've done code spelunking and found interesting ideas in:

aws-cli/awscli/plugin.py

Lines 25 to 27 in c0d866a

:type plugin_mapping: dict
:param plugin_mapping: A dict of plugin name to import path,
e.g. ``{"plugingName": "package.modulefoo"}``.

This function is require to use the plugin. It calls the functions
required to add all neccessary commands and parameters to the CLI.
This function is necessary to install the plugin using a configuration
file

# This is the name of your command, so if you want to
# create an 'aws mycommand ...' command, the NAME would be
# 'mycommand'

and finally

load_plugins(session.full_config.get('plugins', {}),

which lead me to try:

$ aws configure set plugins '{"mycommand": "awsplugins.mycommand"}' $ cat ~/.aws/config [default] region = us-east-1 output = json plugins = {"mycommand": "awsplugins.mycommand"} $ aws help | grep mycommand $ aws mycommand usage: aws [options] <command> <subcommand> [parameters] aws: error: argument command: Invalid choice, valid choices are: autoscaling | cloudformation cloudfront | cloudhsm cloudsearch | cloudsearchdomain cloudtrail | cloudwatch cognito-identity | cognito-sync datapipeline | directconnect dynamodb | ec2 ecs | elasticache elasticbeanstalk | elastictranscoder elb | emr glacier | iam importexport | kinesis kms | lambda logs | opsworks rds | redshift route53 | route53domains sdb | ses sns | sqs ssm | storagegateway sts | support swf | s3api s3 | configure deploy | configservice help 

Are there any examples of a working aws-cli plugin external to the aws-cli package? Is it supposed to be possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.pr:work-in-progressThis PR is a draft and needs further work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions