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

Adds a new --acl option that allows to set the canned ACL to be applied to the object #121

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions internal/flags.go
Expand Up @@ -154,6 +154,13 @@ func NewApp() (app *cli.App) {
Value: "",
},

/// http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
cli.StringFlag{
Name: "acl",
Usage: "The canned ACL to apply to the object (default: off, possible values: private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control)",
Value: "",
},

/////////////////////////
// Tuning
/////////////////////////
Expand Down Expand Up @@ -214,6 +221,7 @@ type FlagStorage struct {
UseSSE bool
UseKMS bool
KMSKeyID string
ACL string

// Tuning
StatCacheTTL time.Duration
Expand Down Expand Up @@ -274,6 +282,7 @@ func PopulateFlags(c *cli.Context) (flags *FlagStorage) {
UseSSE: c.Bool("sse"),
UseKMS: c.IsSet("sse-kms"),
KMSKeyID: c.String("sse-kms"),
ACL: c.String("acl"),

// Debugging,
DebugFuse: c.Bool("debug_fuse"),
Expand Down
8 changes: 8 additions & 0 deletions internal/goofys.go
Expand Up @@ -572,6 +572,10 @@ func (fs *Goofys) copyObjectMultipart(size int64, from string, to string, mpuId
}
}

if fs.flags.ACL != "" {
params.ACL = &fs.flags.ACL
}

resp, err := fs.s3.CreateMultipartUpload(params)
if err != nil {
return mapAwsError(err)
Expand Down Expand Up @@ -653,6 +657,10 @@ func (fs *Goofys) copyObjectMaybeMultipart(size int64, from string, to string) (
}
}

if fs.flags.ACL != "" {
params.ACL = &fs.flags.ACL
}

_, err = fs.s3.CopyObject(params)
if err != nil {
err = mapAwsError(err)
Expand Down
8 changes: 8 additions & 0 deletions internal/handles.go
Expand Up @@ -391,6 +391,10 @@ func (fh *FileHandle) initMPU(fs *Goofys) {
}
}

if fs.flags.ACL != "" {
params.ACL = &fs.flags.ACL
}

resp, err := fs.s3.CreateMultipartUpload(params)

fh.mu.Lock()
Expand Down Expand Up @@ -892,6 +896,10 @@ func (fh *FileHandle) flushSmallFile(fs *Goofys) (err error) {
}
}

if fs.flags.ACL != "" {
params.ACL = &fs.flags.ACL
}

fs.replicators.Take(1, true)
defer fs.replicators.Return(1)

Expand Down