lucacasonato / deno_s3

Amazon S3 for Deno
http://deno.land/x/s3
MIT License
54 stars 14 forks source link

Add getBucketPolicy, putBucketPolicy, deleteBucketPolicy & getBucketPolicyStatus #39

Open c4spar opened 2 years ago

c4spar commented 2 years ago

I will open a PR for this too 😉

c4spar commented 2 years ago

I'm wondering if we should move the getBucketPolicy, putBucketPolicy, deleteBucketPolicy && getBucketPolicyStatus methods to the S3Bucket class and rename them to getPolicy, putPolicy, deletePolicy & getPolicyStatus? Currently i have added them to the S3 class becasue the original aws sdk has these methods also on the S3 class but i think the S3Bucket class would be also a good place.

I would also like to add a getBucket method, than we can easily retrieve/switch bucket instances and call buckets with:

const s3 = new S3({
  accessKeyID: Deno.env.get("AWS_ACCESS_KEY_ID")!,
  secretKey: Deno.env.get("AWS_SECRET_ACCESS_KEY")!,
  region: "us-east-1",
  endpointURL: Deno.env.get("S3_ENDPOINT_URL"),
});

s3.getBucket("my-bucket").putPolicy({...})