clj-aws-s3
clj-aws-s3 copied to clipboard
Add bucket policy functions
Added get-bucket-policy and update-bucket-policy.
Externally the policy is a clojure data structure. The AWS sdk wants a json structure as a string so the new s3 functions hide this implementation by converting between cli and json.
I wonder if we should prefer Cheshire over data.json. Thoughts?
No problems with Cheshire.
Updated to use.
What keys are allowed in update-bucket-policy? The docstring doesn't say.
That's rather a complex and open question!
Policies are quite complex data structures used by AWS represented in JSON. The BucketPolicy bean simply takes a string: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/BucketPolicy.html
As you can see the AWS SDK isn't very explicit about them. I guess that's because they are beasts. See the docs on policy documents here: http://docs.aws.amazon.com/AmazonS3/latest/dev/AccessPolicyLanguage.html
Policies are so complex most of the time people use the Policy Generator rather than hand craft them: http://awspolicygen.s3.amazonaws.com/policygen.html
They are also subject to change as AWS sees fit.
More than happy to take guidance but I think documenting AWS policies would be thankless. Perhaps just a link to the AWS docs would suffice?
Okay, that's reasonable. A link to the docs should be sufficient.
I have updated with a link to the docs