Skip to content

feat: allow setting acl on putObject #28

@Zegnat

Description

@Zegnat

Is your feature request related to a problem? Please describe.

Porting some code from @aws-sdk/client-s3 we have a project that uploads both publicly available resources and private resources to a bucket. In our code this is easily managed by providing a pre-defined ACL value directly:

import { PutObjectCommand } from "@aws-sdk/client-s3";
const uploadParams = new PutObjectCommand({
  ACL: "public-read", // ← this part
  Body: [··· Buffer ···],
  Bucket: "my-mixed-bucket",
  ContentType: "text/plain",
  Key: "my-file.txt",
});

Describe the solution you'd like

Just like with the Server-Side Encryption headers, it would be nice to be able to provide an ACL value directly to S3mini#putObject(). Preferably with the same strings supported as in PutObjectCommand.

The official AWS SDK supports strings they call Canned ACLs, predefined permissions. These seem to have some cross-platform support, as we are actually using Ceph ourselves and not S3. There are 6 possible values:

export declare const ObjectCannedACL: {
    readonly authenticated_read: "authenticated-read";
    readonly aws_exec_read: "aws-exec-read";
    readonly bucket_owner_full_control: "bucket-owner-full-control";
    readonly bucket_owner_read: "bucket-owner-read";
    readonly private: "private";
    readonly public_read: "public-read";
    readonly public_read_write: "public-read-write";
};

And these are described in the Amazon S3 documentation.

It looks like the Canned ACL value can be passed directly as an x-amz-acl header.

Describe alternatives you've considered

An alternative solution would be to allow a much more open-ended / generic “headers” argument on the S3mini#putObject-method. But I like how explicit the current class is with what can and cannot be set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions