Extend --generate-cli-skeleton to optionally generate pre-filled templates
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 13
Description
**Is your feature request related to a problem? Please describe.**
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [x] I've gone though the [User Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) and the [API reference](https://docs.aws.amazon.com/cli/latest/reference/)
- [x] I've searched for [previous similar issues](https://github.com/aws/aws-cli/issues) and didn't find any solution
**Describe the bug**
I had followed the documentation for [`aws.ec2.delete-volume`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/delete-volume.html) initially.
Running the following command deletes an EBS volume:
```bash
aws ec2 delete-volume --volume-id vol-049df61146c4d7901
```
Running the following, in prep for generating a yaml/json that can be consumed by `[--cli-input-json | --cli-input-yaml]` didn't do what I had expected:
```bash
# This is the equivelant of running
# aws ec2 delete-volume --generate-cli-skeleton
# because other args are ignored when --generate-cli-skeleton is present
$ aws ec2 delete-volume --volume-id vol-049df61146c4d7901 --generate-cli-skeleton
{
"VolumeId": "",
"DryRun": true
}
$ aws ec2 delete-volume --volume-id vol-049df61146c4d7901 --generate-cli-skeleton yaml-input
VolumeId: '' # [REQUIRED] The ID of the volume.
DryRun: true # Checks whether you have the required permissions for the action, without actually making the request, and provides an error response.
$ aws ec2 delete-volume --volume-id vol-049df61146c4d7901 --generate-cli-skeleton output
# No output
```
It turns out I had misunderstood the functionality of `--generate-cli-skeleton`, and that is will ignore the other args you are providing (unless this is a bug):
> `--generate-cli-skeleton` (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value `input`, prints a sample input JSON that can be used as an argument for `--cli-input-json`. Similarly, if provided `yaml-input` it will print a sample input YAML that can be used with `--cli-input-yaml`. If provided with the value `output`, it validates the command inputs and returns a sample output JSON for that command.
It doesn't create pre-populated templates based on the args used.
**Describe the solution you'd like**
It would be excellent if it worked this way:
```bash
# This is the equivelant of running
# aws ec2 delete-volume --generate-cli-skeleton
# because other args are ignored when --generate-cli-skeleton is present
$ aws ec2 delete-volume --volume-id vol-049df61146c4d7901 --generate-cli-skeleton
{
"VolumeId": "vol-049df61146c4d7901",
"DryRun": true
}
$ aws ec2 delete-volume --volume-id vol-049df61146c4d7901 --generate-cli-skeleton yaml-input
VolumeId: 'vol-049df61146c4d7901' # [REQUIRED] The ID of the volume.
DryRun: true # Checks whether you have the required permissions for the action, without actually making the request, and provides an error response.
```
**Describe alternatives you've considered**
Provide some kind of error output or warning message that states other args have been ignored, or extend the documentation for `--generate-cli-skeleton` to be more clear about this current functionality.
Contributor guide
Assessment
This issue has not been assessed yet.