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

Update the aws-s3-bucket component to mirror the AWS sdk #203

Closed
brianneisler opened this issue May 14, 2018 · 1 comment
Closed

Update the aws-s3-bucket component to mirror the AWS sdk #203

brianneisler opened this issue May 14, 2018 · 1 comment
Assignees
Labels
good first issue Good for newcomers kind/enhancement Improvement to something existing stage/accepted This is ready to be worked on

Comments

@brianneisler
Copy link
Contributor

Description

The current implementation of the aws-s3-bucket expects a name input. This does not match the expected bucket property that AWS expects in its API. We are also missing support for many of the additional parameters that the sdk supports.

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#createBucket-property

params (Object)
  ACL — (String) The canned ACL to apply to the bucket. Possible values include:
    "private"
    "public-read"
    "public-read-write"
    "authenticated-read"
  Bucket — (String)
  CreateBucketConfiguration — (map)
  LocationConstraint — (String) Specifies the region where the bucket will be created. If you don't specify a region, the bucket will be created in US Standard. Possible values include:
    "EU"
    "eu-west-1"
    "us-west-1"
    "us-west-2"
    "ap-south-1"
    "ap-southeast-1"
    "ap-southeast-2"
    "ap-northeast-1"
    "sa-east-1"
    "cn-north-1"
    "eu-central-1"
  GrantFullControl — (String) Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.
  GrantRead — (String) Allows grantee to list the objects in the bucket.
  GrantReadACP — (String) Allows grantee to read the bucket ACL.
  GrantWrite — (String) Allows grantee to create, overwrite, and delete any object in the bucket.
  GrantWriteACP — (String) Allows grantee to write the ACL for the applicable bucket.

In addition to supporting the above properties. We should also support blind pass through of the "rest" of the inputs so that we have a fallback when our implementation drifts from the SDK.

const createBucket = async ({ name, ...rest }) => S3.createBucket({ Bucket: name, ...rest }).promise()

Something that we will need to consider here is that all of our inputs use lower camel case where most of AWS uses upper camel case. Perhaps we should also do an auto conversion of lower to upper.

https://github.com/SamVerschueren/uppercamelcase

const createBucket = async ({ name, ...rest }) => {
  const params = reduceObjIndexed(
    (accum, value, key) => assoc(upperCammelCase(key), value, accum), 
    {}, 
    rest
  )
  return S3.createBucket({ Bucket: name, ...params).promise()
}
@brianneisler brianneisler added kind/enhancement Improvement to something existing good first issue Good for newcomers labels May 14, 2018
@brianneisler brianneisler added the stage/accepted This is ready to be worked on label May 14, 2018
@eahefnawy
Copy link
Member

closing this as we've made a complete rewrite of the core and this issue is no longer applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/enhancement Improvement to something existing stage/accepted This is ready to be worked on
Projects
None yet
Development

No branches or pull requests

3 participants