Open Prajithp opened 6 years ago
Hi,
AWS services don't always return JSON. A lot of them (like EC2) return XML, which is then battled into the objects that get returned (getting the XML to turn into the final objects is not direct (there is some transformation going on).
In branch release/0.37 (not on CPAN yet) a big refactor has been done that makes this easier. You can create a service object with a response_to_object object that turns the response into whatever you want.
I'd like to know a bit more about your use case. Why do you need JSON? Wouldn't a Hashref be better for later processing? Why are the objects returned not desirable for your use case?
Hi, I was porting a few of our devops platform scripts to Perl from Python and Ruby. These scripts are heavily depends on waiter class and in Paws core, I could not find the same.
In botocore there is a json definition file for accomplishing this task, but it requires both jmespath and response as in JSON format.
Closing this as I managed to fix this by converting blessed object into HashRef and then used Jmespath. Btw, Thanks for the excellent Module.
Wow! That's neat. Can you share some code of how you've done this? Implementing waiters is on the Paws TODO list, and I'd love to see your approach, or use some of your code if possible.
Sure, here goes the gist. I don't think, this is the right approach to implement waiters. Also, I have only tested this with a few ec2 waiters and it works fine for me. Please check the code and let me know.
Wow @Prajithp! Thanks! 😍
You are welcome :) Please let me know if this can be improved or you have any other idea to implement waiters.
Is there a way to get result as json format instead of object when calling services like ec2 or etc?