-
Notifications
You must be signed in to change notification settings - Fork 648
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
Fixes for list object versions result #2751
Fixes for list object versions result #2751
Conversation
d0fd52a
to
450163a
Compare
450163a
to
5551c7c
Compare
I had another thought regarding the def withVersionId(value: String): ListObjectVersionsResultVersions = copy(versionId = Option(value)) can be changed to def withVersionId(value: String): ListObjectVersionsResultVersions =
if (value.trim.toLowerCase == "null")
copy(versionId = None)
else
copy(versionId = Option(value) Same applies for EDIT: closing of PR was accident, I must have hit some hotkey..... |
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 with some small suggestions
s3/src/main/scala/akka/stream/alpakka/s3/impl/Marshalling.scala
Outdated
Show resolved
Hide resolved
@jochenschneider Thanks for the comments, I have addressed them, what are your thoughts on #2751 (comment) ? |
5551c7c
to
b6f8404
Compare
Not sure I get when a user would call withVersionId() with a null string, isn't all cases when it comes from the S3 API covered? |
I guess if some people are mixing the official S3 SDK with Alpakka (i.e. you get a value from the S3 SDK where Ultimately I think its more of a consistency thing, in essence the Alternately I can just drop the commit if its too confusing. |
Yeah, I guess it can't hurt either, feel free to do as you like (it's not in here now as far as I can see). |
b6f8404
to
75aee17
Compare
Okay I have just rebased the PR with the changes mentioned in #2751 (comment) |
75aee17
to
826950d
Compare
@johanandren The tests have failed but its due to getting rate limited by docker, i.e.
So its unrelated. |
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 but let's kick the ci again tomorrow and see that it goes green
826950d
to
bdac551
Compare
@johanandren I have just added a commit that fixes |
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, thanks!
This PR fixes a few changes that was introduced in my previous PR at #2747. The easiest way to navigate the PR is to look at the commits which are described below.
Make Owner fields optional for ListObjectVersionsResult
This commit is mandatory since it appears that in some circumstances you do not get the
Owner
field in the S3 response. Ideally and originally I wanted to make a test to replicate this but it seems like you need a specific AWS account with a certain set of permissions in order to have the missing fields. i.e. on one AWS account I get this as a responsewhere as with another AWS account I get this as a response
I have a suspicion that this may be due to how AWS permissions are set up on the account which means that I can't really write a test for this (changing/creating actual AWS accounts is out of scope for tests).
Make VersionId optional by detecting null
When you call
S3.listObjectVersions
on a bucket that doesn't have versioning enabled (which is the default) you getversionId=null
in the XML response (see above XML response snippets as well as https://docs.aws.amazon.com/AmazonS3/latest/userguide/AddingObjectstoVersionSuspendedBuckets.html). This commit makes theversionId
field anOption
whereNone
is the case where we getnull
from AWS as a quality of life improvement.Deleting versions with S3.deleteBucketContents is now optional
Upon the realization that
S3.listObjectVersions
completely fails if you are using Minio I deemed it appropriate to make the behavior of deleting all object versions inS3.deleteBucketContents
/S3.deleteObjectsByPrefix
optional with a default of NOT deleting object versions.A test was added to verify this behavior.
This is mainly done as a safety precaution (i.e. the default behavior is now the same at the point in time before #2747 was merged) and also as a means of allowing Minio users to actually use
S3.deleteBucketContents
/S3.deleteObjectsByPrefix
(otherwise this method will always fail because Minio doesn't even seem to support theS3.listObjectVersions
call).