Fork me on GitHub

also i have to say amazonica is quite elegant in itself, since it is the most perfect form of abstraction to the java sdk possible. so it's generally just a complaint about the aws java sdk, all documentation is soo scattered, and debugging protocol errors is a hell. i automatically create SQS queues and SNS topics, and subscribe the queues to certain topics, but after making these subscriptions, messages are just not appearing in the queue. after a bit of debugging, i suddenly find out there is some "principal-id" i have to provide in order for a queue to aubscribe to a queue. ok, fine, i provide my user id. nop. still nothing. no way to debug why my user id wasnt accepted, since the subscription is visible from the console, but still no messages coming in from the topic... ... ok. so lets create such a subscription from the web console, and see how that permission differs from my programmatically created one. ah! principal-id is ! of course, ive seen that before. ok, i use the api, sqs/add-permission, provide as principal id, and..... an error coming back from amazon's api. apparently * is not a valid principal id. after a bit of googling, i find out i have to manually call set-attribute :policy, attach the policy in string form (because fuck it, the json-capable REST server expects the nicely json formatted policy to be provided as a string, so in order not to lose my sanity, i use an intermediate nice object and then use chesire/format-string to convert it to a string). oh yeah, have i ranted yet about the idiotic, overengineered way that whole policy system works?! it feels like they intentionally tried to get rid of all the elegance and simplicity that json brings, and tried to get their java, xml-based thinking coming from XSLT. they should not consider json a programming language, but then why am i providing Statements and stuff in policy definitions. argh. sometimes i wonder why they come up with interfaces like that. is it just the enterprises' pressure to come with an api like that, or is it just how they did it internally and then it just went out in the open..? anyway, it's been a fun week for me interacting with the aws api. :)


i agree that amazonica is implemented very elegantly, with minimal amount of logic, but it's hard to see thru it without knowing the java reflection api. even if it could be modified to produce some stub versions, those stubs wouldn't mimic the original behaviours. here is some explanation how a good stub should look like: