-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No clear documentation for creating a aws-cli plugin #1261
Comments
The big caveat is that the plugin API is subject to change which is the main reason it's not documented yet. We do have on our backlog plans to flesh out the APIs and get proper documentation around plugins. But here's the main points if you want to try it out: In the ~/.aws/config file you'll need to add a plugins section that has the name of the package to import:
Then you'll need to make it so that the right hand side, in this case You then need to define an entry point, At this point, you can look at some of the built in customizations to get an idea for how these work. Just about all the code in awscli/customizations uses this interface (though instead of awscli_initialize, they typically use their own function names). For example, the cloudtrail customization has a good example of how to add a new command. The only difference is instead of Feel free to experiment and give us feedback. Just keep in mind there's no backwards compatibility guarantee for the plugin API (yet) and it will likely change in the future. Let me know if you have any other questions. |
Like there was actually a regression in a recent release for the "plugins" section being set via the configure set command (#1263). Once this is fixed, you can also configure plugins via: |
Thanks, @jamesls! That helps a lot. I've run into a challenge that I hope you can help me figure out. I've packaged my work up into https://github.com/RichardBronosky/aws-cli-plugins The good news is that my I'm trying to get my head around https://github.com/boto/botocore/blob/develop/botocore/hooks.py#L297 but it seems like it's going to require a complete understanding of botocore. I think my problem may have something to do with my use of Can you point me in the right direction to get my command registered? |
RichardBronosky/aws-cli-plugins@d45711e It seems that I have some confusion about where "helloworld" and "say-hello" commands and subcommands are separated. A little more Trial & Exception should get me there. I'm seeing a lot of results here https://github.com/aws/aws-cli/search?q=building-command-table.main but, if you can confirm to me that |
Yes, As for the way the events works, the main difference between this system and other publish/subscribe event systems is that the CLI events are hierarchical. It still works with exact event names as well. So for example, if I register for an event, when that specific event is emitted, my handler will be called:
However, I can also just register for
The main reason do this is because event names in the CLI/botocore have names such as Hope that helps let me know if you have any other questions. |
Are there any plans to make the plugin system a public, documented API? It seems like this issue was closed without answering that question. We use a custom IAM role federation service that ties to our corporate services for authentication/authorization. Currently, users have to develop separate tools to acquire and manage credentials which is somewhat awkward. Implementing a common tool for interacting with that middleware as a plugin within awscli would make the experience much better, but we're concerned that the plugin system isn't stable or supported. |
Fix plugin by using main and removing subcommand
@jcmcken check out https://github.com/RichardBronosky/aws-cli-plugins or https://github.com/nitrocode/aws-cli-plugins . If you find a way to add a subcommand without showing the help dialogue, let me know 😄 |
could we have same features (plugin) for AWS SDK, such as python , nodejs, java, etc? For example, with python boto3, seems the codes ignore the part of Should this feature (plugin) to be moved to |
I've done code spelunking and found interesting ideas in:
aws-cli/awscli/plugin.py
Lines 25 to 27 in c0d866a
aws-cli/awscli/customizations/s3/s3.py
Lines 23 to 26 in 5ce60be
aws-cli/awscli/customizations/commands.py
Lines 47 to 49 in 37aac25
and finally
aws-cli/awscli/clidriver.py
Line 55 in c0d866a
which lead me to try:
Are there any examples of a working aws-cli plugin external to the aws-cli package? Is it supposed to be possible?
The text was updated successfully, but these errors were encountered: