diff --git a/backend/backend.go b/backend/backend.go index 06560bc1..ff27d976 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -23,7 +23,7 @@ type Backend interface { CreateMultipartUpload(*s3.CreateMultipartUploadInput) (*s3response.InitiateMultipartUploadResponse, s3err.ErrorCode) CompleteMultipartUpload(bucket, object, uploadID string, parts []s3response.Part) (*s3response.CompleteMultipartUploadResponse, s3err.ErrorCode) AbortMultipartUpload(*s3.AbortMultipartUploadInput) s3err.ErrorCode - ListMultipartUploads(*s3.ListMultipartUploadsInput) (*s3response.ListMultipartUploadsResponse, s3err.ErrorCode) + ListMultipartUploads(*s3response.ListMultipartUploads) (*s3response.ListMultipartUploadsResponse, s3err.ErrorCode) ListObjectParts(bucket, object, uploadID string, partNumberMarker int, maxParts int) (*s3response.ListPartsResponse, s3err.ErrorCode) CopyPart(srcBucket, srcObject, DstBucket, uploadID, rangeHeader string, part int) (*s3response.CopyObjectPartResponse, s3err.ErrorCode) PutObjectPart(bucket, object, uploadID string, part int, r io.Reader) (etag string, err s3err.ErrorCode) @@ -37,7 +37,7 @@ type Backend interface { ListObjects(bucket, prefix, marker, delim string, maxkeys int) (*s3response.ListBucketResult, s3err.ErrorCode) ListObjectsV2(bucket, prefix, marker, delim string, maxkeys int) (*s3response.ListBucketResultV2, s3err.ErrorCode) DeleteObject(bucket, object string) s3err.ErrorCode - DeleteObjects(bucket string, objects []string) s3err.ErrorCode + DeleteObjects(bucket string, objects *s3response.DeleteObjectsInput) s3err.ErrorCode IsTaggingSupported() bool GetTags(bucket, object string) (map[string]string, error) @@ -85,7 +85,7 @@ func (BackendUnsupported) CompleteMultipartUpload(bucket, object, uploadID strin func (BackendUnsupported) AbortMultipartUpload(*s3.AbortMultipartUploadInput) s3err.ErrorCode { return s3err.ErrNotImplemented } -func (BackendUnsupported) ListMultipartUploads(*s3.ListMultipartUploadsInput) (*s3response.ListMultipartUploadsResponse, s3err.ErrorCode) { +func (BackendUnsupported) ListMultipartUploads(*s3response.ListMultipartUploads) (*s3response.ListMultipartUploadsResponse, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } func (BackendUnsupported) ListObjectParts(bucket, object, uploadID string, partNumberMarker int, maxParts int) (*s3response.ListPartsResponse, s3err.ErrorCode) { @@ -104,7 +104,7 @@ func (BackendUnsupported) PutObject(buket, object string, r io.Reader) (string, func (BackendUnsupported) DeleteObject(bucket, object string) s3err.ErrorCode { return s3err.ErrNotImplemented } -func (BackendUnsupported) DeleteObjects(bucket string, object []string) s3err.ErrorCode { +func (BackendUnsupported) DeleteObjects(bucket string, objects *s3response.DeleteObjectsInput) s3err.ErrorCode { return s3err.ErrNotImplemented } func (BackendUnsupported) GetObject(bucket, object string, startOffset, length int64, writer io.Writer, etag string) (*s3response.GetObjectResponse, s3err.ErrorCode) { diff --git a/s3api/router.go b/s3api/router.go index 3572f43a..520224f8 100644 --- a/s3api/router.go +++ b/s3api/router.go @@ -3,7 +3,6 @@ package s3api import ( "encoding/xml" "errors" - "fmt" "github.com/gofiber/fiber/v2" "github.com/versity/scoutgw/backend" "github.com/versity/scoutgw/internal" @@ -22,7 +21,7 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { // ListBuckets action app.Get("/", func(ctx *fiber.Ctx) error { res, code := be.ListBuckets() - return responce[internal.Any](ctx, res, code) + return responce[*s3response.ListAllMyBucketsList](ctx, res, code) }) // PutBucket action @@ -42,6 +41,7 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { return responce[*s3response.HeadBucketResponse](ctx, res, code) }) // GetBucketAcl action + // ListMultipartUploads action // ListObjects action // ListObjectsV2 action app.Get("/:bucket", func(ctx *fiber.Ctx) error { @@ -50,6 +50,11 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { return responce[*s3response.GetBucketAclResponse](ctx, res, code) } + if ctx.Request().URI().QueryArgs().Has("uploads") { + res, code := be.ListMultipartUploads(&s3response.ListMultipartUploads{Bucket: ctx.Params("bucket")}) + return responce[*s3response.ListMultipartUploadsResponse](ctx, res, code) + } + if ctx.QueryInt("list-type") == 2 { res, code := be.ListObjectsV2(ctx.Params("bucket"), "", "", "", 1) return responce[*s3response.ListBucketResultV2](ctx, res, code) @@ -58,25 +63,35 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { res, code := be.ListObjects(ctx.Params("bucket"), "", "", "", 1) return responce[*s3response.ListBucketResult](ctx, res, code) }) + + // HeadObject action + app.Head("/:bucket/:key/*", func(ctx *fiber.Ctx) error { + bucket, key, keyEnd := ctx.Params("bucket"), ctx.Params("key"), ctx.Params("*1") + if keyEnd != "" { + key = strings.Join([]string{key, keyEnd}, "/") + } + + res, code := be.HeadObject(bucket, key, "") + return responce[*s3response.HeadObjectResponse](ctx, res, code) + }) // GetObjectAcl action // GetObject action - //todo: will continue HeadObject implementation app.Get("/:bucket/:key/*", func(ctx *fiber.Ctx) error { + bucket, key, keyEnd := ctx.Params("bucket"), ctx.Params("key"), ctx.Params("*1") + if keyEnd != "" { + key = strings.Join([]string{key, keyEnd}, "/") + } + if ctx.Request().URI().QueryArgs().Has("acl") { - res, code := be.GetObjectAcl(ctx.Params("bucket"), ctx.Params("key")) + res, code := be.GetObjectAcl(bucket, key) return responce[*s3response.GetObjectAccessControlPolicyResponse](ctx, res, code) } if attrs := ctx.Get("X-Amz-Object-Attributes"); attrs != "" { - res, code := be.GetObjectAttributes(ctx.Params("bucket"), ctx.Params("key"), strings.Split(ctx.Get("key"), ",")) + res, code := be.GetObjectAttributes(bucket, key, strings.Split(attrs, ",")) return responce[*s3response.GetObjectAttributesResponse](ctx, res, code) } - bucket, key, keyEnd := ctx.Params("bucket"), ctx.Params("key"), ctx.Params("*1") - if keyEnd != "" { - key = strings.Join([]string{key, keyEnd}, "/") - } - bRangeSl := strings.Split(ctx.Get("Range"), "=") if len(bRangeSl) < 2 { return errors.New("wrong api call") @@ -112,24 +127,27 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { }) // DeleteObjects action app.Post("/:bucket", func(ctx *fiber.Ctx) error { - body := ctx.Body() + var dObj s3response.DeleteObjectEntry + if err := xml.Unmarshal(ctx.Body(), &dObj); err != nil { + return errors.New("wrong api call") + } - fmt.Println(string(body)) - //todo: create type for body and pass to function parsed structure - code := be.DeleteObjects(ctx.Params("bucket"), []string{}) + code := be.DeleteObjects(ctx.Params("bucket"), &s3response.DeleteObjectsInput{Delete: dObj}) return responce[internal.Any](ctx, nil, code) }) // CopyObject action - app.Put("/:dstBucket/:dstKey/*", func(ctx *fiber.Ctx) error { + app.Put("/:bucket/:key/*", func(ctx *fiber.Ctx) error { copySource := strings.Split(ctx.Get("X-Amz-Copy-Source"), "/") if len(copySource) < 2 { return errors.New("wrong api call") } + srcBucket, srcObject := copySource[0], copySource[1:] - dstBucket, dstKeyStart, dstKeyEnd := ctx.Params("dstBucket"), ctx.Params("dstKey"), ctx.Params("*1") + dstBucket, dstKeyStart, dstKeyEnd := ctx.Params("bucket"), ctx.Params("key"), ctx.Params("*1") if dstKeyEnd != "" { dstKeyStart = strings.Join([]string{dstKeyStart, dstKeyEnd}, "/") } + res, code := be.CopyObject(srcBucket, strings.Join(srcObject, "/"), dstBucket, dstKeyStart) return responce[*s3response.CopyObjectResponse](ctx, res, code) }) diff --git a/s3api/server.go b/s3api/server.go index 120b4a0a..afe69fbe 100644 --- a/s3api/server.go +++ b/s3api/server.go @@ -1,9 +1,12 @@ package s3api import ( + "encoding/xml" + "fmt" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/logger" "github.com/versity/scoutgw/backend" + "github.com/versity/scoutgw/s3response" ) type S3ApiServer struct { @@ -19,16 +22,16 @@ func New(app *fiber.App, be backend.Backend, port string) (s3ApiServer *S3ApiSer app.Use(logger.New()) s3ApiServer.router.Init(app, be) - //app.All("/*", func(ctx *fiber.Ctx) error { - // - // fmt.Println(ctx.Method()) - // listBucket := new(s3response.ListBucket) - // if b, err := xml.Marshal(listBucket); err != nil { - // return err - // } else { - // return ctx.Send(b) - // } - //}) + app.All("/*", func(ctx *fiber.Ctx) error { + + fmt.Println(ctx.Method()) + listBucket := new(s3response.ListBucket) + if b, err := xml.Marshal(listBucket); err != nil { + return err + } else { + return ctx.Send(b) + } + }) return } diff --git a/s3response/AmazonS3-additions.xsd b/s3response/AmazonS3-additions.xsd index 0132af3b..02cc84fa 100644 --- a/s3response/AmazonS3-additions.xsd +++ b/s3response/AmazonS3-additions.xsd @@ -95,7 +95,6 @@ - @@ -116,7 +115,6 @@ - @@ -135,7 +133,6 @@ - @@ -205,7 +202,6 @@ - @@ -317,7 +313,6 @@ - @@ -336,7 +331,6 @@ - @@ -405,7 +399,6 @@ - @@ -431,7 +424,6 @@ - @@ -481,7 +473,6 @@ - @@ -506,7 +497,6 @@ - @@ -514,7 +504,6 @@ - @@ -539,7 +528,6 @@ - @@ -560,7 +548,6 @@ - @@ -569,6 +556,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -584,7 +597,6 @@ - @@ -592,7 +604,6 @@ - @@ -601,6 +612,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -655,7 +787,6 @@ - @@ -685,7 +816,6 @@ - @@ -725,6 +855,15 @@ + + + + + + + + + @@ -751,10 +890,10 @@ + - @@ -762,7 +901,6 @@ - diff --git a/s3response/README.txt b/s3response/README.txt index 879e8abd..5a515b83 100644 --- a/s3response/README.txt +++ b/s3response/README.txt @@ -4,4 +4,4 @@ see https://blog.aqwari.net/xml-schema-go/ go install aqwari.net/xml/cmd/xsdgen@latest xsdgen -o s3api_xsd_generated.go -pkg s3response AmazonS3.xsd -xsdgen -o s3api_xsd_generated.go -pkg s3response AmazonS3-additions.xsd \ No newline at end of file +xsdgen -o s3api_xsd_generated.go -pkg s3response AmazonS3-additions.xsd diff --git a/s3response/s3api_xsd_generated.go b/s3response/s3api_xsd_generated.go index 4c82d92a..63042991 100644 --- a/s3response/s3api_xsd_generated.go +++ b/s3response/s3api_xsd_generated.go @@ -22,6 +22,385 @@ type AmazonCustomerByEmail struct { EmailAddress string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ EmailAddress"` } +type Anon1 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"` + ContentLength int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentLength"` + AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"` + StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass,omitempty"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon1) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon1 + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon1) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon1 + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon10 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix,omitempty"` + Marker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Marker,omitempty"` + MaxKeys int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxKeys,omitempty"` + Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter,omitempty"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon10) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon10 + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon10) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon10 + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon11 struct { + ListBucketResponse ListBucketResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResponse"` +} + +type Anon12 struct { + ListVersionsResponse ListVersionsResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListVersionsResponse"` +} + +type Anon13 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter"` + EncodingType string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ EncodingType"` + KeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ KeyMarker"` + MaxUploads string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxUploads"` + Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` + UploadIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ UploadIdMarker"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon13) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon13 + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon13) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon13 + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon14 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + KeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ KeyMarker"` + UploadIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ UploadIdMarker"` + NextKeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextKeyMarker"` + Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` + Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter"` + NextUploadIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextUploadIdMarker"` + MaxUploads int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxUploads"` + IsTruncated bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsTruncated"` + Upload UploadEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Upload"` + CommonPrefixes CommonPrefixes `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CommonPrefixes"` + EncodingType string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ EncodingType"` +} + +type Anon15 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + CacheControl string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CacheControl"` + ContentDisposition string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentDisposition"` + ContentEncoding string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentEncoding"` + ContentLanguage string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentLanguage"` + ContentType string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentType"` + Expires time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Expires"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon15) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon15 + var layout struct { + *T + Expires *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Expires"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Expires = (*xsdDateTime)(&layout.T.Expires) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon15) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon15 + var overlay struct { + *T + Expires *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Expires"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Expires = (*xsdDateTime)(&overlay.T.Expires) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon16 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + UploadId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ UploadId"` +} + +type Anon17 struct { + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` +} + +func (t *Anon17) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon17 + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon17) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon17 + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon18 struct { + ListAllMyBucketsResponse ListAllMyBucketsResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResponse"` +} + +type Anon19 struct { + Location string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Location"` + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"` +} + +type Anon2 struct { + PutObjectResponse PutObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PutObjectResponse"` +} + +type Anon20 struct { + SourceBucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ SourceBucket"` + SourceKey string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ SourceKey"` + DestinationBucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DestinationBucket"` + DestinationKey string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DestinationKey"` + MetadataDirective MetadataDirective `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MetadataDirective,omitempty"` + Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"` + AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"` + CopySourceIfModifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfModifiedSince,omitempty"` + CopySourceIfUnmodifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfUnmodifiedSince,omitempty"` + CopySourceIfMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfMatch,omitempty"` + CopySourceIfNoneMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfNoneMatch,omitempty"` + StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass,omitempty"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon20) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon20 + var layout struct { + *T + CopySourceIfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfModifiedSince,omitempty"` + CopySourceIfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfUnmodifiedSince,omitempty"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.CopySourceIfModifiedSince = (*xsdDateTime)(&layout.T.CopySourceIfModifiedSince) + layout.CopySourceIfUnmodifiedSince = (*xsdDateTime)(&layout.T.CopySourceIfUnmodifiedSince) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon20) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon20 + var overlay struct { + *T + CopySourceIfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfModifiedSince,omitempty"` + CopySourceIfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopySourceIfUnmodifiedSince,omitempty"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.CopySourceIfModifiedSince = (*xsdDateTime)(&overlay.T.CopySourceIfModifiedSince) + overlay.CopySourceIfUnmodifiedSince = (*xsdDateTime)(&overlay.T.CopySourceIfUnmodifiedSince) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon21 struct { + CopyObjectResult CopyObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult"` +} + +type Anon3 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"` + Data []byte `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data"` + ContentLength int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentLength"` + AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,omitempty"` + StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass,omitempty"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon3) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon3 + var layout struct { + *T + Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Data = (*xsdBase64Binary)(&layout.T.Data) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon3) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon3 + var overlay struct { + *T + Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Data = (*xsdBase64Binary)(&overlay.T.Data) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon4 struct { + PutObjectInlineResponse PutObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PutObjectInlineResponse"` +} + +type Anon5 struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon5) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon5 + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon5) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon5 + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon6 struct { + DeleteObjectResponse Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteObjectResponse"` +} + +type Anon7 struct { + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *Anon7) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T Anon7 + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *Anon7) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T Anon7 + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type Anon8 struct { + Delete DeleteObjectEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delete"` +} + +type Anon9 struct { + Deleted DeletedEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Deleted"` + Error Error `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Error"` +} + type BucketLoggingStatus struct { LoggingEnabled LoggingSettings `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LoggingEnabled,omitempty"` } @@ -38,6 +417,10 @@ type Checksum struct { ChecksumSHA256 string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumSHA256"` } +type CommonPrefixes struct { + Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` +} + type CopyObject struct { SourceBucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ SourceBucket"` SourceKey string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ SourceKey"` @@ -157,6 +540,52 @@ type CreateBucketResult struct { BucketName string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ BucketName"` } +type CreateMultipartUpload struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + CacheControl string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CacheControl"` + ContentDisposition string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentDisposition"` + ContentEncoding string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentEncoding"` + ContentLanguage string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentLanguage"` + ContentType string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ContentType"` + Expires time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Expires"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *CreateMultipartUpload) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T CreateMultipartUpload + var layout struct { + *T + Expires *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Expires"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Expires = (*xsdDateTime)(&layout.T.Expires) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *CreateMultipartUpload) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T CreateMultipartUpload + var overlay struct { + *T + Expires *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Expires"` + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Expires = (*xsdDateTime)(&overlay.T.Expires) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type CreateMultipartUploadResponse struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + UploadId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ UploadId"` +} + type DeleteBucket struct { Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` @@ -249,10 +678,67 @@ func (t *DeleteObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) erro return d.DecodeElement(&overlay, &start) } +type DeleteObjectEntry struct { + Object ObjectIdentifier `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Object"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + Quiet bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Quiet"` +} + type DeleteObjectResponse struct { DeleteObjectResponse Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteObjectResponse"` } +type DeleteObjects struct { + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *DeleteObjects) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T DeleteObjects + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *DeleteObjects) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T DeleteObjects + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type DeleteObjectsInput struct { + Delete DeleteObjectEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delete"` +} + +type DeleteObjectsResponse struct { + Deleted DeletedEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Deleted"` + Error Error `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Error"` +} + +type DeletedEntry struct { + DeleteMarker bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteMarker"` + DeleteMarkerVersionId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteMarkerVersionId"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + VersionId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ VersionId"` +} + +type Error struct { + Code string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Code"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + Message string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Message"` + VersionId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ VersionId"` +} + type GetBucketAccessControlPolicy struct { Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` @@ -737,6 +1223,11 @@ func (t *HeadObjectResponse) UnmarshalXML(d *xml.Decoder, start xml.StartElement return d.DecodeElement(&overlay, &start) } +type InitiatorEntry struct { + DisplayName string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DisplayName"` + ID string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ID"` +} + type ListAllMyBuckets struct { AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` @@ -883,6 +1374,56 @@ func (t *ListEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { return d.DecodeElement(&overlay, &start) } +type ListMultipartUploads struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter"` + EncodingType string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ EncodingType"` + KeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ KeyMarker"` + MaxUploads string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxUploads"` + Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` + UploadIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ UploadIdMarker"` + AWSAccessKeyId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AWSAccessKeyId,omitempty"` + Timestamp time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` + Credential string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Credential,omitempty"` +} + +func (t *ListMultipartUploads) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T ListMultipartUploads + var layout struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + layout.T = (*T)(t) + layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) + return e.EncodeElement(layout, start) +} +func (t *ListMultipartUploads) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T ListMultipartUploads + var overlay struct { + *T + Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` + } + overlay.T = (*T)(t) + overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) + return d.DecodeElement(&overlay, &start) +} + +type ListMultipartUploadsResponse struct { + Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` + KeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ KeyMarker"` + UploadIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ UploadIdMarker"` + NextKeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextKeyMarker"` + Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` + Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter"` + NextUploadIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextUploadIdMarker"` + MaxUploads int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxUploads"` + IsTruncated bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsTruncated"` + Upload UploadEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Upload"` + CommonPrefixes CommonPrefixes `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CommonPrefixes"` + EncodingType string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ EncodingType"` +} + type ListVersionsResponse struct { ListVersionsResponse ListVersionsResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListVersionsResponse"` } @@ -924,6 +1465,11 @@ type NotificationConfiguration struct { TopicConfiguration []TopicConfiguration `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TopicConfiguration,omitempty"` } +type ObjectIdentifier struct { + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + VersionId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ VersionId"` +} + type ObjectParts struct { IsTruncated bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsTruncated"` MaxParts int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxParts"` @@ -1187,6 +1733,37 @@ type TopicConfiguration struct { Event []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Event"` } +type UploadEntry struct { + ChecksumAlgorithm string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumAlgorithm"` + Initiated time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Initiated"` + Initiator InitiatorEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Initiator"` + Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` + Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner"` + StorageClass string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass"` + UploadId string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ UploadId"` +} + +func (t *UploadEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + type T UploadEntry + var layout struct { + *T + Initiated *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Initiated"` + } + layout.T = (*T)(t) + layout.Initiated = (*xsdDateTime)(&layout.T.Initiated) + return e.EncodeElement(layout, start) +} +func (t *UploadEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type T UploadEntry + var overlay struct { + *T + Initiated *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Initiated"` + } + overlay.T = (*T)(t) + overlay.Initiated = (*xsdDateTime)(&overlay.T.Initiated) + return d.DecodeElement(&overlay, &start) +} + type User struct { } diff --git a/s3response/s3response.go b/s3response/s3response.go index 18d0e63f..00c7b8b4 100644 --- a/s3response/s3response.go +++ b/s3response/s3response.go @@ -33,7 +33,7 @@ type ListPartsResponse struct { Key string UploadID string `xml:"UploadId"` - Initiator Initiator + Initiator CanonicalUser Owner Owner // The class of storage used to store the object. @@ -48,38 +48,6 @@ type ListPartsResponse struct { Parts []Part `xml:"Part"` } -// ListMultipartUploadsResponse - format for list multipart uploads response. -type ListMultipartUploadsResponse struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListMultipartUploadsResult" json:"-"` - - Bucket string - KeyMarker string - UploadIDMarker string `xml:"UploadIdMarker"` - NextKeyMarker string - NextUploadIDMarker string `xml:"NextUploadIdMarker"` - Delimiter string - Prefix string - EncodingType string `xml:"EncodingType,omitempty"` - MaxUploads int - IsTruncated bool - - // List of pending uploads. - Uploads []Upload `xml:"Upload"` - - // Delimed common prefixes. - CommonPrefixes []CommonPrefix -} - -// Upload container for in progress multipart upload -type Upload struct { - Key string - UploadID string `xml:"UploadId"` - Initiator Initiator - Owner Owner - StorageClass string - Initiated string -} - // CommonPrefix container for prefix response in ListObjectsResponse type CommonPrefix struct { Prefix string @@ -167,9 +135,6 @@ type CopyObjectPartResponse struct { ETag string // md5sum of the copied object part. } -// Initiator inherit from Owner struct, fields are same -type Initiator Owner - // Owner - bucket owner/principal type Owner struct { ID string @@ -202,14 +167,3 @@ type DeleteError struct { Key string VersionID string `xml:"VersionId"` } - -// DeleteObjectsResponse container for multiple object deletes. -type DeleteObjectsResponse struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteResult" json:"-"` - - // Collection of all deleted objects - DeletedObjects []DeleteObject `xml:"Deleted,omitempty"` - - // Collection of errors deleting certain objects. - Errors []DeleteError `xml:"Error,omitempty"` -}