/
S3Object.scala
28 lines (22 loc) · 982 Bytes
/
S3Object.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package smithy4s.benchmark
import smithy4s.Blob
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.bytes
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct
final case class S3Object(id: String, owner: String, attributes: Attributes, data: Blob)
object S3Object extends ShapeTag.Companion[S3Object] {
val id: ShapeId = ShapeId("smithy4s.benchmark", "S3Object")
val hints: Hints = Hints.empty
// constructor using the original order from the spec
private def make(id: String, owner: String, attributes: Attributes, data: Blob): S3Object = S3Object(id, owner, attributes, data)
implicit val schema: Schema[S3Object] = struct(
string.required[S3Object]("id", _.id),
string.required[S3Object]("owner", _.owner),
Attributes.schema.required[S3Object]("attributes", _.attributes),
bytes.required[S3Object]("data", _.data),
)(make).withId(id).addHints(hints)
}