Skip to content
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

See the structure of a returned item #8872

Closed
1 of 2 tasks
vincexiv opened this issue Aug 17, 2024 · 2 comments
Closed
1 of 2 tasks

See the structure of a returned item #8872

vincexiv opened this issue Aug 17, 2024 · 2 comments
Assignees
Labels
feature-request A feature should be added or improved.

Comments

@vincexiv
Copy link

Describe the feature

A feature like the flag; --generate-cli-skeleton , that returns a sample output of a command

Use Case

A lot of times I would like to initialize a variable with a value queried from an output of an aws cli command, but I don't immedeately know what to query. This forces me to search online for the structure of the output, do the command twice (once to see the output structure, and the second time to query items I need), or run the command and copy what I need manually. None of these are the convenient way to do it.

Here is an example; assume I want to save the key material value I get from the command aws ec2 create-key-material to a .pem file. Naturally, I would like to know the structure of the return value of this command, so I would pick the item I want to save to a variable

Proposed Solution

A flag to see sample output of a command without running the command (similar to how --generate-key-skeleton does). E.g, let's assume the flag has a name --show-sample-output, we could do it for the command; aws ec2 create-key-pair --key-name example --show-sample-output and get the following as a sample output;

{
    "KeyFingerprint": "d9:b7:a4:7f:58:25:29:ac:b8:c8:cb:5b:fb:66:7b:c6:cb:6e:38:4b",
    "KeyMaterial":"-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgEypaGTvshi93pCcHmQVWSOWEOm55vAsE3GJQ/bPaWKaeoL6E10P
irWgR58aE0xjd3181g+vwHt/4zO2pTnTz9XTfH8bgmW8crJ3fX4GNP/agmwlnTHc
kK3ge6P6//wx1PFlpmbf67TuGPNSrLA7AJjzsjXPMy2Gw1XOpAAdbr/bAgMBAAEC
gYAyczYhXuDMiX9DmYoigS4VTje5KL9DBS6ShCv2685FtrWzJlHB5214U49us+FJ
XxgOvC2/SwEYBTSHHsajRLI8JAtqt6Mq3UwTTH44HWkynUbEVXZrSkq9B5BsSOEb
4TR2lGwv8gVxb9DkVvFMlRJDrbyM/wt1+qqI0Y1Bv5z7sQJBAJKQ3RrDa9TwrMDq
Mtf6MMKGf/1rPqh2GpLZ7zssQ6VzWDsVy1j0EhaZKqnnveKvbUGJu+J8uslq5Qch
uGKpJ9MCQQCF5tCAsjw4j1szkNzEaZgGivNzWquV1y+KW2AEA4jDpvtUzHLp/vVA
UkMdBA7Bw+7BGMu4gvfH/zlwwiuKs0rZAkAq1Dg4TOji1d21lfp7kHnVLlaSaFds
BO8pAJRe90VhQL6ErY65lMEAZ4vHEJg1eMv1fdkwiwBOQXVhyyHFeubPAkEAgl+D
72qbG+7ou8J2UX8GmIg+FbjYjCJilXH2gLH4PZed6qjN0mt920y9L8k9nQfqtXQx
Fsvd+YrVIKbNwlRjsQJAOscoqrFrMsWc8Zo241GFFu5CNPmExMogo0dzmENBASGi
Na/n25cywpC0PAcghcQq2q+x6sJD2gugA+3uomX0zg==
-----END RSA PRIVATE KEY-----",
    "KeyName": "example",
    "KeyPairId": "key-0062e38n6ji2jov32"
}

With the sample output above, I'll know exactly what to query. I'll know I have to add --query 'KeyMaterial' from the result of the command aws ec2 create-key-pair --key-name example, resulting in aws ec2 create-key-pair --key-name 'Example' --query 'KeyMaterial'

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CLI version used

aws-cli/2.15.42

Environment details (OS name and version, etc.)

Python/3.11.8 Linux/5.15.153.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.20 prompt/off

@vincexiv vincexiv added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 17, 2024
@tim-finnigan tim-finnigan self-assigned this Aug 20, 2024
@tim-finnigan
Copy link
Contributor

Thanks for the feature request. I brought this up for discussion with the team, and the consensus was that this request will not be considered at this time. You can use the help command for this use case, for example aws ec2 create-key-pair help, to view the output of that command.

@tim-finnigan tim-finnigan closed this as not planned Won't fix, can't repro, duplicate, stale Aug 20, 2024
@tim-finnigan tim-finnigan removed the needs-triage This issue or PR still needs to be triaged. label Aug 20, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants