-
Notifications
You must be signed in to change notification settings - Fork 645
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
AWS S3: Custom header injection #1947
Conversation
Hi @vigoo, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement: |
CLA signed |
There are some unused imports in your code and this needs extra parens for Scala 2.13 |
Please add the new methods to the existing |
So I should rather add a |
Ok so I realized that they can be just overloaded methods, I'm pushing the change soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much more regular now, great work.
I wonder if the S3Headers
object should contain a val
instance which to be returned where empty headers are required instead of creating a new every time.
@@ -140,7 +142,8 @@ import akka.util.ByteString | |||
import mat.executionContext | |||
implicit val conf = resolveSettings(attr, mat.system) | |||
|
|||
signAndGetAs[ListBucketResult](HttpRequests.listBucket(bucket, prefix, token)) | |||
// TODO: pass the headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is obsolete now, right?
I removed the obsolete comment and added an |
val empty: S3Headers = S3Headers() | ||
|
||
def apply() = new S3Headers() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest you do it like:
val empty = new S3Headers()
def apply() = empty
def create() = empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer keeping the empty
on the API too as I did or just hide it and use in apply
and create
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thank you, great work! We hope to see you around more. |
Thanks for merging! |
Purpose
This PR adds the possibility to add custom headers to any of the AWS S3 operations.
References
The motivation was discussed in the following issue: #1938
Changes
S3
calledS3WithHeaders
that contains the same set of operations but modified with the capability to pass anS3Headers
value to any of them.Background Context
I assumed (based on the contributor guidelines) that binary compatibility must be maintained, so I created a new API
S3WithHeaders
beside the existing one. If this would not be true, the contents of this new object could be the newS3
instead.