-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add S3 put plus get bucketWithVersioning API #84
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,19 @@ import scala.xml.NodeSeq | |
@InternalApi private[impl] object Marshalling { | ||
import ScalaXmlSupport._ | ||
|
||
implicit val bucketVersioningUnmarshaller: FromEntityUnmarshaller[BucketVersioningResult] = { | ||
nodeSeqUnmarshaller(MediaTypes.`application/xml`, ContentTypes.`application/octet-stream`).map { | ||
case NodeSeq.Empty => throw Unmarshaller.NoContentException | ||
case x => | ||
val status = (x \ "Status").headOption.map(_.text match { | ||
case "Enabled" => BucketVersioningStatus.Enabled | ||
case "Suspended" => BucketVersioningStatus.Suspended | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I am slightly torn on what to do here. As explained previously I have an impression that there could be a chance that a new value gets added to this field (since its
|
||
}) | ||
val MFADelete = (x \ "MfaDelete").headOption.map(_.exists(_.text == "Enabled")) | ||
BucketVersioningResult(status, MFADelete) | ||
} | ||
} | ||
|
||
implicit val multipartUploadUnmarshaller: FromEntityUnmarshaller[MultipartUpload] = { | ||
nodeSeqUnmarshaller(MediaTypes.`application/xml`, ContentTypes.`application/octet-stream`).map { | ||
case NodeSeq.Empty => throw Unmarshaller.NoContentException | ||
|
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.
one minor quibble - scala.xml is a bit unloved, the use here is small but it might be better just to use Java's in-built XML support (JAXP API)
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.
For now I will keep using Scala xml because that is what's used throughout the codebase, can always file an issue about it