From 346a05b49a8087dd88f76a7a09c7dd89d9c14cfc Mon Sep 17 00:00:00 2001 From: jonaustin09 Date: Wed, 17 May 2023 00:46:21 +0500 Subject: [PATCH 1/5] feat: removed s3 xsd schema --- s3response/AmazonS3-additions.xsd | 989 --------------- s3response/AmazonS3.xsd | 692 ----------- s3response/README.txt | 7 - s3response/s3api_xsd_generated.go | 1859 ----------------------------- s3response/s3response.go | 169 --- 5 files changed, 3716 deletions(-) delete mode 100644 s3response/AmazonS3-additions.xsd delete mode 100644 s3response/AmazonS3.xsd delete mode 100644 s3response/README.txt delete mode 100644 s3response/s3api_xsd_generated.go delete mode 100644 s3response/s3response.go diff --git a/s3response/AmazonS3-additions.xsd b/s3response/AmazonS3-additions.xsd deleted file mode 100644 index 02cc84fa..00000000 --- a/s3response/AmazonS3-additions.xsd +++ /dev/null @@ -1,989 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/s3response/AmazonS3.xsd b/s3response/AmazonS3.xsd deleted file mode 100644 index 8016a6a8..00000000 --- a/s3response/AmazonS3.xsd +++ /dev/null @@ -1,692 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/s3response/README.txt b/s3response/README.txt deleted file mode 100644 index 5a515b83..00000000 --- a/s3response/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -https://doc.s3.amazonaws.com/2006-03-01/AmazonS3.xsd - -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 diff --git a/s3response/s3api_xsd_generated.go b/s3response/s3api_xsd_generated.go deleted file mode 100644 index 63042991..00000000 --- a/s3response/s3api_xsd_generated.go +++ /dev/null @@ -1,1859 +0,0 @@ -// Code generated by xsdgen. DO NOT EDIT. - -package s3response - -import ( - "bytes" - "encoding/base64" - "encoding/xml" - "time" -) - -type AccessControlList struct { - Grant []Grant `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Grant,omitempty"` -} - -type AccessControlPolicy struct { - Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner"` - AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList"` -} - -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"` -} - -type CanonicalUser struct { - ID string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ID"` - DisplayName string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DisplayName,omitempty"` -} - -type Checksum struct { - ChecksumCRC32 string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumCRC32"` - ChecksumCRC32C string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumCRC32C"` - ChecksumSHA1 string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumSHA1"` - 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"` - 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 *CopyObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T CopyObject - 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 *CopyObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T CopyObject - 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 CopyObjectResponse struct { - CopyObjectResult CopyObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult"` -} - -type CopyObjectResult struct { - LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"` -} - -func (t *CopyObjectResult) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T CopyObjectResult - var layout struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - layout.T = (*T)(t) - layout.LastModified = (*xsdDateTime)(&layout.T.LastModified) - return e.EncodeElement(layout, start) -} -func (t *CopyObjectResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T CopyObjectResult - var overlay struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - overlay.T = (*T)(t) - overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified) - return d.DecodeElement(&overlay, &start) -} - -type CreateBucket struct { - Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` - AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,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"` -} - -func (t *CreateBucket) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T CreateBucket - 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 *CreateBucket) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T CreateBucket - 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 CreateBucketConfiguration struct { - LocationConstraint string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint"` -} - -type CreateBucketResponse struct { - CreateBucketReturn CreateBucketResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CreateBucketReturn"` -} - -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"` - 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 *DeleteBucket) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T DeleteBucket - 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 *DeleteBucket) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T DeleteBucket - 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 DeleteBucketResponse struct { - DeleteBucketResponse Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteBucketResponse"` -} - -type DeleteMarkerEntry 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"` - IsLatest bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsLatest"` - LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner,omitempty"` -} - -func (t *DeleteMarkerEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T DeleteMarkerEntry - var layout struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - layout.T = (*T)(t) - layout.LastModified = (*xsdDateTime)(&layout.T.LastModified) - return e.EncodeElement(layout, start) -} -func (t *DeleteMarkerEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T DeleteMarkerEntry - var overlay struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - overlay.T = (*T)(t) - overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified) - return d.DecodeElement(&overlay, &start) -} - -type DeleteObject 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 *DeleteObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T DeleteObject - 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 *DeleteObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T DeleteObject - 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 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"` - 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 *GetBucketAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetBucketAccessControlPolicy - 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 *GetBucketAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetBucketAccessControlPolicy - 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 GetBucketAccessControlPolicyResponse struct { - GetBucketAccessControlPolicyResponse AccessControlPolicy `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetBucketAccessControlPolicyResponse"` -} - -type GetBucketAcl 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"` - 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 *GetBucketAcl) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetBucketAcl - 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 *GetBucketAcl) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetBucketAcl - 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 GetBucketAclResponse struct { - CanonicalUser CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CanonicalUser"` - AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList"` - 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 *GetBucketAclResponse) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetBucketAclResponse - 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 *GetBucketAclResponse) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetBucketAclResponse - 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 GetBucketLoggingStatus 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"` - 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 *GetBucketLoggingStatus) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetBucketLoggingStatus - 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 *GetBucketLoggingStatus) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetBucketLoggingStatus - 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 GetBucketLoggingStatusResponse struct { - GetBucketLoggingStatusResponse BucketLoggingStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetBucketLoggingStatusResponse"` -} - -type GetObject 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"` - GetMetadata bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetMetadata"` - GetData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetData"` - InlineData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InlineData"` - 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 *GetObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetObject - 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 *GetObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetObject - 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 GetObjectAccessControlPolicy 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 *GetObjectAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetObjectAccessControlPolicy - 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 *GetObjectAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetObjectAccessControlPolicy - 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 GetObjectAccessControlPolicyResponse struct { - GetObjectAccessControlPolicyResponse AccessControlPolicy `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetObjectAccessControlPolicyResponse"` -} - -type GetObjectAcl 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 *GetObjectAcl) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetObjectAcl - 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 *GetObjectAcl) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetObjectAcl - 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 GetObjectAclResponse struct { - Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner"` - Grants AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Grants"` - RequestCharged string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ RequestCharged"` -} - -type GetObjectAttributes 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"` - Attributes string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Attributes"` - 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 *GetObjectAttributes) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetObjectAttributes - 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 *GetObjectAttributes) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetObjectAttributes - 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 GetObjectAttributesResponse struct { - Etag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Etag"` - Checksum Checksum `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Checksum"` - RequestCharged string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ RequestCharged"` - ObjectParts ObjectParts `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ObjectParts"` - StorageClass string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass"` - ObjectSize int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ObjectSize"` -} - -type GetObjectExtended 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"` - GetMetadata bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetMetadata"` - GetData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetData"` - InlineData bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InlineData"` - ByteRangeStart int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ByteRangeStart,omitempty"` - ByteRangeEnd int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ByteRangeEnd,omitempty"` - IfModifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfModifiedSince,omitempty"` - IfUnmodifiedSince time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfUnmodifiedSince,omitempty"` - IfMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfMatch,omitempty"` - IfNoneMatch []string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfNoneMatch,omitempty"` - ReturnCompleteObjectOnConditionFailure bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ReturnCompleteObjectOnConditionFailure,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 *GetObjectExtended) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetObjectExtended - var layout struct { - *T - IfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfModifiedSince,omitempty"` - IfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfUnmodifiedSince,omitempty"` - Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` - } - layout.T = (*T)(t) - layout.IfModifiedSince = (*xsdDateTime)(&layout.T.IfModifiedSince) - layout.IfUnmodifiedSince = (*xsdDateTime)(&layout.T.IfUnmodifiedSince) - layout.Timestamp = (*xsdDateTime)(&layout.T.Timestamp) - return e.EncodeElement(layout, start) -} -func (t *GetObjectExtended) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetObjectExtended - var overlay struct { - *T - IfModifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfModifiedSince,omitempty"` - IfUnmodifiedSince *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IfUnmodifiedSince,omitempty"` - Timestamp *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Timestamp,omitempty"` - } - overlay.T = (*T)(t) - overlay.IfModifiedSince = (*xsdDateTime)(&overlay.T.IfModifiedSince) - overlay.IfUnmodifiedSince = (*xsdDateTime)(&overlay.T.IfUnmodifiedSince) - overlay.Timestamp = (*xsdDateTime)(&overlay.T.Timestamp) - return d.DecodeElement(&overlay, &start) -} - -type GetObjectExtendedResponse struct { - GetObjectResponse GetObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetObjectResponse"` -} - -type GetObjectResponse struct { - GetObjectResponse GetObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ GetObjectResponse"` -} - -type GetObjectResult struct { - Status Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Status"` - 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,omitempty"` - LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"` -} - -func (t *GetObjectResult) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T GetObjectResult - var layout struct { - *T - Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data,omitempty"` - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - layout.T = (*T)(t) - layout.Data = (*xsdBase64Binary)(&layout.T.Data) - layout.LastModified = (*xsdDateTime)(&layout.T.LastModified) - return e.EncodeElement(layout, start) -} -func (t *GetObjectResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T GetObjectResult - var overlay struct { - *T - Data *xsdBase64Binary `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Data,omitempty"` - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - overlay.T = (*T)(t) - overlay.Data = (*xsdBase64Binary)(&overlay.T.Data) - overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified) - return d.DecodeElement(&overlay, &start) -} - -type Grant struct { - Grantee Grantee `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Grantee"` - Permission Permission `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Permission"` -} - -type Grantee struct { -} - -type Group struct { - URI string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ URI"` -} - -type HeadBucket 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"` - 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 *HeadBucket) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T HeadBucket - 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 *HeadBucket) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T HeadBucket - 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 HeadBucketResponse 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 *HeadBucketResponse) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T HeadBucketResponse - 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 *HeadBucketResponse) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T HeadBucketResponse - 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 HeadObject 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 *HeadObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T HeadObject - 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 *HeadObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T HeadObject - 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 HeadObjectResponse 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 *HeadObjectResponse) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T HeadObjectResponse - 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 *HeadObjectResponse) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T HeadObjectResponse - 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 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"` - Signature string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Signature,omitempty"` -} - -func (t *ListAllMyBuckets) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T ListAllMyBuckets - 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 *ListAllMyBuckets) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T ListAllMyBuckets - 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 ListAllMyBucketsEntry struct { - Name string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Name"` - CreationDate time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CreationDate"` -} - -func (t *ListAllMyBucketsEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T ListAllMyBucketsEntry - var layout struct { - *T - CreationDate *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CreationDate"` - } - layout.T = (*T)(t) - layout.CreationDate = (*xsdDateTime)(&layout.T.CreationDate) - return e.EncodeElement(layout, start) -} -func (t *ListAllMyBucketsEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T ListAllMyBucketsEntry - var overlay struct { - *T - CreationDate *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CreationDate"` - } - overlay.T = (*T)(t) - overlay.CreationDate = (*xsdDateTime)(&overlay.T.CreationDate) - return d.DecodeElement(&overlay, &start) -} - -type ListAllMyBucketsList struct { - Bucket []ListAllMyBucketsEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket,omitempty"` -} - -type ListAllMyBucketsResponse struct { - ListAllMyBucketsResponse ListAllMyBucketsResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResponse"` -} - -type ListAllMyBucketsResult struct { - Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner"` - Buckets ListAllMyBucketsList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Buckets"` -} - -type ListBucket 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 *ListBucket) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T ListBucket - 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 *ListBucket) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T ListBucket - 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 ListBucketResponse struct { - ListBucketResponse ListBucketResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResponse"` -} - -type ListBucketResult struct { - Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"` - Name string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Name"` - Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` - Marker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Marker"` - NextMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextMarker,omitempty"` - MaxKeys int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxKeys"` - Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter,omitempty"` - IsTruncated bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsTruncated"` - Contents []ListEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Contents,omitempty"` - CommonPrefixes []PrefixEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CommonPrefixes,omitempty"` -} - -type ListEntry struct { - Key string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Key"` - LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"` - Size int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Size"` - Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner,omitempty"` - StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass"` -} - -func (t *ListEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T ListEntry - var layout struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - layout.T = (*T)(t) - layout.LastModified = (*xsdDateTime)(&layout.T.LastModified) - return e.EncodeElement(layout, start) -} -func (t *ListEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T ListEntry - var overlay struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - overlay.T = (*T)(t) - overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified) - 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"` -} - -type ListVersionsResult struct { - Metadata []MetadataEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Metadata,omitempty"` - Name string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Name"` - Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` - KeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ KeyMarker"` - VersionIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ VersionIdMarker"` - NextKeyMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextKeyMarker,omitempty"` - NextVersionIdMarker string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextVersionIdMarker,omitempty"` - MaxKeys int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MaxKeys"` - Delimiter string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Delimiter,omitempty"` - IsTruncated bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsTruncated"` - Version VersionEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Version,omitempty"` - DeleteMarker DeleteMarkerEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteMarker,omitempty"` - CommonPrefixes []PrefixEntry `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CommonPrefixes,omitempty"` -} - -type LoggingSettings struct { - TargetBucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TargetBucket"` - TargetPrefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TargetPrefix"` - TargetGrants AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ TargetGrants,omitempty"` -} - -// May be one of COPY, REPLACE -type MetadataDirective string - -type MetadataEntry struct { - Name string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Name"` - Value string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Value"` -} - -// May be one of Enabled, Disabled -type MfaDeleteStatus string - -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"` - NextPartNumberMarker int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NextPartNumberMarker"` - PartNumberMarker int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PartNumberMarker"` - Part Part `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Part"` - PartsCount int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PartsCount"` -} - -type Part struct { - ChecksumCRC32 string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumCRC32"` - ChecksumCRC32C string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumCRC32C"` - ChecksumSHA1 string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumSHA1"` - ChecksumSHA256 string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ChecksumSHA256"` - PartNumber int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PartNumber"` - Size int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Size"` -} - -// May be one of BucketOwner, Requester -type Payer string - -// May be one of READ, WRITE, READ_ACP, WRITE_ACP, FULL_CONTROL -type Permission string - -type PostResponse 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 PrefixEntry struct { - Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` -} - -type PutObject 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 *PutObject) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T PutObject - 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 *PutObject) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T PutObject - 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 PutObjectInline 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 *PutObjectInline) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T PutObjectInline - 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 *PutObjectInline) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T PutObjectInline - 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 PutObjectInlineResponse struct { - PutObjectInlineResponse PutObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PutObjectInlineResponse"` -} - -type PutObjectResponse struct { - PutObjectResponse PutObjectResult `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PutObjectResponse"` -} - -type PutObjectResult struct { - ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"` - LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` -} - -func (t *PutObjectResult) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T PutObjectResult - var layout struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - layout.T = (*T)(t) - layout.LastModified = (*xsdDateTime)(&layout.T.LastModified) - return e.EncodeElement(layout, start) -} -func (t *PutObjectResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T PutObjectResult - var overlay struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - overlay.T = (*T)(t) - overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified) - return d.DecodeElement(&overlay, &start) -} - -type RequestPaymentConfiguration struct { - Payer Payer `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Payer"` -} - -type Result struct { - Status Status `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Status"` -} - -type SetBucketAccessControlPolicy struct { - Bucket string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Bucket"` - AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList,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 *SetBucketAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T SetBucketAccessControlPolicy - 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 *SetBucketAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T SetBucketAccessControlPolicy - 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 SetBucketAccessControlPolicyResponse struct { -} - -type SetBucketLoggingStatus 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"` - 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"` - BucketLoggingStatus BucketLoggingStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ BucketLoggingStatus"` -} - -func (t *SetBucketLoggingStatus) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T SetBucketLoggingStatus - 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 *SetBucketLoggingStatus) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T SetBucketLoggingStatus - 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 SetBucketLoggingStatusResponse struct { -} - -type SetObjectAccessControlPolicy 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"` - AccessControlList AccessControlList `xml:"http://s3.amazonaws.com/doc/2006-03-01/ AccessControlList"` - 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 *SetObjectAccessControlPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T SetObjectAccessControlPolicy - 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 *SetObjectAccessControlPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T SetObjectAccessControlPolicy - 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 SetObjectAccessControlPolicyResponse struct { -} - -type Status struct { - Code int `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Code"` - Description string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Description"` -} - -// May be one of STANDARD, REDUCED_REDUNDANCY, GLACIER, UNKNOWN -type StorageClass string - -type TopicConfiguration struct { - Topic string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Topic"` - 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 { -} - -type VersionEntry 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"` - IsLatest bool `xml:"http://s3.amazonaws.com/doc/2006-03-01/ IsLatest"` - LastModified time.Time `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - ETag string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ETag"` - Size int64 `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Size"` - Owner CanonicalUser `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Owner,omitempty"` - StorageClass StorageClass `xml:"http://s3.amazonaws.com/doc/2006-03-01/ StorageClass"` -} - -func (t *VersionEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - type T VersionEntry - var layout struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - layout.T = (*T)(t) - layout.LastModified = (*xsdDateTime)(&layout.T.LastModified) - return e.EncodeElement(layout, start) -} -func (t *VersionEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - type T VersionEntry - var overlay struct { - *T - LastModified *xsdDateTime `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LastModified"` - } - overlay.T = (*T)(t) - overlay.LastModified = (*xsdDateTime)(&overlay.T.LastModified) - return d.DecodeElement(&overlay, &start) -} - -type VersioningConfiguration struct { - Status VersioningStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Status,omitempty"` - MfaDelete MfaDeleteStatus `xml:"http://s3.amazonaws.com/doc/2006-03-01/ MfaDelete,omitempty"` -} - -// May be one of Enabled, Suspended -type VersioningStatus string - -type xsdBase64Binary []byte - -func (b *xsdBase64Binary) UnmarshalText(text []byte) (err error) { - *b, err = base64.StdEncoding.DecodeString(string(text)) - return -} -func (b xsdBase64Binary) MarshalText() ([]byte, error) { - var buf bytes.Buffer - enc := base64.NewEncoder(base64.StdEncoding, &buf) - enc.Write([]byte(b)) - enc.Close() - return buf.Bytes(), nil -} - -type xsdDateTime time.Time - -func (t *xsdDateTime) UnmarshalText(text []byte) error { - return _unmarshalTime(text, (*time.Time)(t), "2006-01-02T15:04:05.999999999") -} -func (t xsdDateTime) MarshalText() ([]byte, error) { - return _marshalTime((time.Time)(t), "2006-01-02T15:04:05.999999999") -} -func (t xsdDateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - if (time.Time)(t).IsZero() { - return nil - } - m, err := t.MarshalText() - if err != nil { - return err - } - return e.EncodeElement(m, start) -} -func (t xsdDateTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { - if (time.Time)(t).IsZero() { - return xml.Attr{}, nil - } - m, err := t.MarshalText() - return xml.Attr{Name: name, Value: string(m)}, err -} -func _unmarshalTime(text []byte, t *time.Time, format string) (err error) { - s := string(bytes.TrimSpace(text)) - *t, err = time.Parse(format, s) - if _, ok := err.(*time.ParseError); ok { - *t, err = time.Parse(format+"Z07:00", s) - } - return err -} -func _marshalTime(t time.Time, format string) ([]byte, error) { - return []byte(t.Format(format + "Z07:00")), nil -} diff --git a/s3response/s3response.go b/s3response/s3response.go deleted file mode 100644 index 00c7b8b4..00000000 --- a/s3response/s3response.go +++ /dev/null @@ -1,169 +0,0 @@ -package s3response - -import ( - "encoding/xml" -) - -type ListBucketResultV2 struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult"` - Name string `xml:"Name"` - Prefix string `xml:"Prefix"` - MaxKeys int `xml:"MaxKeys"` - Delimiter string `xml:"Delimiter,omitempty"` - IsTruncated bool `xml:"IsTruncated"` - Contents []ListEntry `xml:"Contents,omitempty"` - CommonPrefixes []PrefixEntry `xml:"CommonPrefixes,omitempty"` - ContinuationToken string `xml:"ContinuationToken,omitempty"` - NextContinuationToken string `xml:"NextContinuationToken,omitempty"` - KeyCount int `xml:"KeyCount"` - StartAfter string `xml:"StartAfter,omitempty"` -} - -// LocationResponse - format for location response. -type LocationResponse struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint" json:"-"` - Location string `xml:",chardata"` -} - -// ListPartsResponse - format for list parts response. -type ListPartsResponse struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListPartsResult" json:"-"` - - Bucket string - Key string - UploadID string `xml:"UploadId"` - - Initiator CanonicalUser - Owner Owner - - // The class of storage used to store the object. - StorageClass string - - PartNumberMarker int - NextPartNumberMarker int - MaxParts int - IsTruncated bool - - // List of parts. - Parts []Part `xml:"Part"` -} - -// CommonPrefix container for prefix response in ListObjectsResponse -type CommonPrefix struct { - Prefix string -} - -// Bucket container for bucket metadata -type Bucket struct { - Name string - CreationDate string // time string of format "2006-01-02T15:04:05.000Z" -} - -// ObjectVersion container for object version metadata -type ObjectVersion struct { - Object - IsLatest bool - VersionID string `xml:"VersionId"` - - isDeleteMarker bool -} - -// MarshalXML - marshal ObjectVersion -func (o ObjectVersion) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - if o.isDeleteMarker { - start.Name.Local = "DeleteMarker" - } else { - start.Name.Local = "Version" - } - - type objectVersionWrapper ObjectVersion - return e.EncodeElement(objectVersionWrapper(o), start) -} - -// StringMap is a map[string]string. -type StringMap map[string]string - -// MarshalXML - StringMap marshals into XML. -func (s StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - - tokens := []xml.Token{start} - - for key, value := range s { - t := xml.StartElement{} - t.Name = xml.Name{ - Space: "", - Local: key, - } - tokens = append(tokens, t, xml.CharData(value), xml.EndElement{Name: t.Name}) - } - - tokens = append(tokens, xml.EndElement{ - Name: start.Name, - }) - - for _, t := range tokens { - if err := e.EncodeToken(t); err != nil { - return err - } - } - - // flush to ensure tokens are written - return e.Flush() -} - -// Object container for object metadata -type Object struct { - Key string - LastModified string // time string of format "2006-01-02T15:04:05.000Z" - ETag string - Size int64 - - // Owner of the object. - Owner Owner - - // The class of storage used to store the object. - StorageClass string - - // UserMetadata user-defined metadata - UserMetadata StringMap `xml:"UserMetadata,omitempty"` -} - -// CopyObjectPartResponse container returns ETag and LastModified of the successfully copied object -type CopyObjectPartResponse struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyPartResult" json:"-"` - LastModified string // time string of format "2006-01-02T15:04:05.000Z" - ETag string // md5sum of the copied object part. -} - -// Owner - bucket owner/principal -type Owner struct { - ID string - DisplayName string -} - -// InitiateMultipartUploadResponse container for InitiateMultiPartUpload response, provides uploadID to start MultiPart upload -type InitiateMultipartUploadResponse struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InitiateMultipartUploadResult" json:"-"` - - Bucket string - Key string - UploadID string `xml:"UploadId"` -} - -// CompleteMultipartUploadResponse container for completed multipart upload response -type CompleteMultipartUploadResponse struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CompleteMultipartUploadResult" json:"-"` - - Location string - Bucket string - Key string - ETag string -} - -// DeleteError structure. -type DeleteError struct { - Code string - Message string - Key string - VersionID string `xml:"VersionId"` -} From bbba9413fffd45b751c80a5b25875d06125c16ec Mon Sep 17 00:00:00 2001 From: jonaustin09 Date: Wed, 17 May 2023 00:47:03 +0500 Subject: [PATCH 2/5] feat: moved to golang s3 v2 sdk --- backend/backend.go | 75 +++++++++++++++++++++++----------------------- s3api/router.go | 57 ++++++++++++++++++----------------- s3api/server.go | 4 +-- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/backend/backend.go b/backend/backend.go index ff27d976..94f11aba 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -2,11 +2,11 @@ package backend import ( "fmt" + "github.com/aws/aws-sdk-go-v2/service/s3/types" "io" - "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/versity/scoutgw/s3err" - "github.com/versity/scoutgw/s3response" ) type Backend interface { @@ -14,30 +14,30 @@ type Backend interface { GetIAMConfig() ([]byte, error) Shutdown() - ListBuckets() (*s3response.ListAllMyBucketsList, s3err.ErrorCode) - HeadBucket(bucket string) (*s3response.HeadBucketResponse, s3err.ErrorCode) - GetBucketAcl(bucket string) (*s3response.GetBucketAclResponse, s3err.ErrorCode) + ListBuckets() (*s3.ListBucketsOutput, s3err.ErrorCode) + HeadBucket(bucket string) (*s3.HeadBucketOutput, s3err.ErrorCode) + GetBucketAcl(bucket string) (*s3.GetBucketAclOutput, s3err.ErrorCode) PutBucket(bucket string) s3err.ErrorCode DeleteBucket(bucket string) s3err.ErrorCode - CreateMultipartUpload(*s3.CreateMultipartUploadInput) (*s3response.InitiateMultipartUploadResponse, s3err.ErrorCode) - CompleteMultipartUpload(bucket, object, uploadID string, parts []s3response.Part) (*s3response.CompleteMultipartUploadResponse, s3err.ErrorCode) + CreateMultipartUpload(*s3.CreateMultipartUploadInput) (*s3.CreateMultipartUploadOutput, s3err.ErrorCode) + CompleteMultipartUpload(bucket, object, uploadID string, parts []types.Part) (*s3.CompleteMultipartUploadOutput, s3err.ErrorCode) AbortMultipartUpload(*s3.AbortMultipartUploadInput) 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) + ListMultipartUploads(output *s3.ListMultipartUploadsInput) (*s3.ListMultipartUploadsOutput, s3err.ErrorCode) + ListObjectParts(bucket, object, uploadID string, partNumberMarker int, maxParts int) (*s3.ListPartsOutput, s3err.ErrorCode) + CopyPart(srcBucket, srcObject, DstBucket, uploadID, rangeHeader string, part int) (*types.CopyPartResult, s3err.ErrorCode) PutObjectPart(bucket, object, uploadID string, part int, r io.Reader) (etag string, err s3err.ErrorCode) PutObject(bucket, object string, r io.Reader) (string, s3err.ErrorCode) - HeadObject(bucket, object string, etag string) (*s3response.HeadObjectResponse, s3err.ErrorCode) - GetObject(bucket, object string, startOffset, length int64, writer io.Writer, etag string) (*s3response.GetObjectResponse, s3err.ErrorCode) - GetObjectAcl(bucket, object string) (*s3response.GetObjectAccessControlPolicyResponse, s3err.ErrorCode) - GetObjectAttributes(bucket, object string, attributes []string) (*s3response.GetObjectAttributesResponse, s3err.ErrorCode) - CopyObject(srcBucket, srcObject, DstBucket, dstObject string) (*s3response.CopyObjectResponse, s3err.ErrorCode) - ListObjects(bucket, prefix, marker, delim string, maxkeys int) (*s3response.ListBucketResult, s3err.ErrorCode) - ListObjectsV2(bucket, prefix, marker, delim string, maxkeys int) (*s3response.ListBucketResultV2, s3err.ErrorCode) + HeadObject(bucket, object string, etag string) (*s3.HeadObjectOutput, s3err.ErrorCode) + GetObject(bucket, object string, startOffset, length int64, writer io.Writer, etag string) (*s3.GetObjectOutput, s3err.ErrorCode) + GetObjectAcl(bucket, object string) (*s3.GetObjectAclOutput, s3err.ErrorCode) + GetObjectAttributes(bucket, object string, attributes []string) (*s3.GetObjectAttributesOutput, s3err.ErrorCode) + CopyObject(srcBucket, srcObject, DstBucket, dstObject string) (*s3.CopyObjectOutput, s3err.ErrorCode) + ListObjects(bucket, prefix, marker, delim string, maxkeys int) (*s3.ListBucketsOutput, s3err.ErrorCode) + ListObjectsV2(bucket, prefix, marker, delim string, maxkeys int) (*s3.ListBucketsOutput, s3err.ErrorCode) DeleteObject(bucket, object string) s3err.ErrorCode - DeleteObjects(bucket string, objects *s3response.DeleteObjectsInput) s3err.ErrorCode + DeleteObjects(bucket string, objects *s3.DeleteObjectsInput) s3err.ErrorCode IsTaggingSupported() bool GetTags(bucket, object string) (map[string]string, error) @@ -59,14 +59,13 @@ func (BackendUnsupported) Shutdown() {} func (BackendUnsupported) String() string { return "Unsupported" } - -func (BackendUnsupported) ListBuckets() (*s3response.ListAllMyBucketsList, s3err.ErrorCode) { +func (BackendUnsupported) ListBuckets() (*s3.ListBucketsOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) GetBucketAcl(bucket string) (*s3response.GetBucketAclResponse, s3err.ErrorCode) { +func (BackendUnsupported) GetBucketAcl(bucket string) (*s3.GetBucketAclOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) HeadBucket(bucket string) (*s3response.HeadBucketResponse, s3err.ErrorCode) { +func (BackendUnsupported) HeadBucket(bucket string) (*s3.HeadBucketOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } func (BackendUnsupported) PutBucket(bucket string) s3err.ErrorCode { @@ -76,56 +75,56 @@ func (BackendUnsupported) DeleteBucket(bucket string) s3err.ErrorCode { return s3err.ErrNotImplemented } -func (BackendUnsupported) CreateMultipartUpload(*s3.CreateMultipartUploadInput) (*s3response.InitiateMultipartUploadResponse, s3err.ErrorCode) { +func (BackendUnsupported) CreateMultipartUpload(input *s3.CreateMultipartUploadInput) (*s3.CreateMultipartUploadOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) CompleteMultipartUpload(bucket, object, uploadID string, parts []s3response.Part) (*s3response.CompleteMultipartUploadResponse, s3err.ErrorCode) { +func (BackendUnsupported) CompleteMultipartUpload(bucket, object, uploadID string, parts []types.Part) (*s3.CompleteMultipartUploadOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) AbortMultipartUpload(*s3.AbortMultipartUploadInput) s3err.ErrorCode { +func (BackendUnsupported) AbortMultipartUpload(input *s3.AbortMultipartUploadInput) s3err.ErrorCode { return s3err.ErrNotImplemented } -func (BackendUnsupported) ListMultipartUploads(*s3response.ListMultipartUploads) (*s3response.ListMultipartUploadsResponse, s3err.ErrorCode) { +func (BackendUnsupported) ListMultipartUploads(output *s3.ListMultipartUploadsInput) (*s3.ListMultipartUploadsOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) ListObjectParts(bucket, object, uploadID string, partNumberMarker int, maxParts int) (*s3response.ListPartsResponse, s3err.ErrorCode) { +func (BackendUnsupported) ListObjectParts(bucket, object, uploadID string, partNumberMarker int, maxParts int) (*s3.ListPartsOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) CopyPart(srcBucket, srcObject, DstBucket, uploadID, rangeHeader string, part int) (*s3response.CopyObjectPartResponse, s3err.ErrorCode) { +func (BackendUnsupported) CopyPart(srcBucket, srcObject, DstBucket, uploadID, rangeHeader string, part int) (*types.CopyPartResult, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) PutObjectPart(buket, object, uploadID string, part int, r io.Reader) (string, s3err.ErrorCode) { +func (BackendUnsupported) PutObjectPart(bucket, object, uploadID string, part int, r io.Reader) (etag string, err s3err.ErrorCode) { return "", s3err.ErrNotImplemented } -func (BackendUnsupported) PutObject(buket, object string, r io.Reader) (string, s3err.ErrorCode) { +func (BackendUnsupported) PutObject(bucket, object string, r io.Reader) (string, s3err.ErrorCode) { return "", s3err.ErrNotImplemented } func (BackendUnsupported) DeleteObject(bucket, object string) s3err.ErrorCode { return s3err.ErrNotImplemented } -func (BackendUnsupported) DeleteObjects(bucket string, objects *s3response.DeleteObjectsInput) s3err.ErrorCode { +func (BackendUnsupported) DeleteObjects(bucket string, objects *s3.DeleteObjectsInput) s3err.ErrorCode { return s3err.ErrNotImplemented } -func (BackendUnsupported) GetObject(bucket, object string, startOffset, length int64, writer io.Writer, etag string) (*s3response.GetObjectResponse, s3err.ErrorCode) { +func (BackendUnsupported) GetObject(bucket, object string, startOffset, length int64, writer io.Writer, etag string) (*s3.GetObjectOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) HeadObject(bucket, object string, etag string) (*s3response.HeadObjectResponse, s3err.ErrorCode) { +func (BackendUnsupported) HeadObject(bucket, object string, etag string) (*s3.HeadObjectOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) GetObjectAcl(bucket, object string) (*s3response.GetObjectAccessControlPolicyResponse, s3err.ErrorCode) { +func (BackendUnsupported) GetObjectAcl(bucket, object string) (*s3.GetObjectAclOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) GetObjectAttributes(bucket, object string, attributes []string) (*s3response.GetObjectAttributesResponse, s3err.ErrorCode) { +func (BackendUnsupported) GetObjectAttributes(bucket, object string, attributes []string) (*s3.GetObjectAttributesOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) CopyObject(srcBucket, srcObject, DstBucket, dstObject string) (*s3response.CopyObjectResponse, s3err.ErrorCode) { +func (BackendUnsupported) CopyObject(srcBucket, srcObject, DstBucket, dstObject string) (*s3.CopyObjectOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) ListObjects(bucket, prefix, marker, delim string, maxkeys int) (*s3response.ListBucketResult, s3err.ErrorCode) { +func (BackendUnsupported) ListObjects(bucket, prefix, marker, delim string, maxkeys int) (*s3.ListBucketsOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } -func (BackendUnsupported) ListObjectsV2(bucket, prefix, marker, delim string, maxkeys int) (*s3response.ListBucketResultV2, s3err.ErrorCode) { +func (BackendUnsupported) ListObjectsV2(bucket, prefix, marker, delim string, maxkeys int) (*s3.ListBucketsOutput, s3err.ErrorCode) { return nil, s3err.ErrNotImplemented } diff --git a/s3api/router.go b/s3api/router.go index 730879e2..8a6e3de8 100644 --- a/s3api/router.go +++ b/s3api/router.go @@ -3,15 +3,16 @@ package s3api import ( "encoding/xml" "errors" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/aws/aws-sdk-go-v2/service/s3/types" "strconv" "strings" - "github.com/aws/aws-sdk-go/service/s3" "github.com/gofiber/fiber/v2" "github.com/versity/scoutgw/backend" "github.com/versity/scoutgw/internal" "github.com/versity/scoutgw/s3err" - "github.com/versity/scoutgw/s3response" ) type S3ApiRouter struct { @@ -23,7 +24,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[*s3response.ListAllMyBucketsList](ctx, res, code) + return responce[*s3.ListBucketsOutput](ctx, res, code) }) // PutBucket action @@ -40,7 +41,7 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { // HeadBucket app.Head("/:bucket", func(ctx *fiber.Ctx) error { res, code := be.HeadBucket(ctx.Params("bucket")) - return responce[*s3response.HeadBucketResponse](ctx, res, code) + return responce[*s3.HeadBucketOutput](ctx, res, code) }) // GetBucketAcl action // ListMultipartUploads action @@ -49,21 +50,21 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { app.Get("/:bucket", func(ctx *fiber.Ctx) error { if ctx.Request().URI().QueryArgs().Has("acl") { res, code := be.GetBucketAcl(ctx.Params("bucket")) - return responce[*s3response.GetBucketAclResponse](ctx, res, code) + return responce[*s3.GetBucketAclOutput](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) + res, code := be.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: aws.String(ctx.Params("bucket"))}) + return responce[*s3.ListMultipartUploadsOutput](ctx, res, code) } if ctx.QueryInt("list-type") == 2 { res, code := be.ListObjectsV2(ctx.Params("bucket"), "", "", "", 1) - return responce[*s3response.ListBucketResultV2](ctx, res, code) + return responce[*s3.ListBucketsOutput](ctx, res, code) } res, code := be.ListObjects(ctx.Params("bucket"), "", "", "", 1) - return responce[*s3response.ListBucketResult](ctx, res, code) + return responce[*s3.ListBucketsOutput](ctx, res, code) }) // HeadObject action @@ -74,7 +75,7 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { } res, code := be.HeadObject(bucket, key, "") - return responce[*s3response.HeadObjectResponse](ctx, res, code) + return responce[*s3.HeadObjectOutput](ctx, res, code) }) // GetObjectAcl action // GetObject action @@ -97,17 +98,17 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { } res, code := be.ListObjectParts(bucket, "", uploadId, partNumberMarker, maxParts) - return responce[*s3response.ListPartsResponse](ctx, res, code) + return responce[*s3.ListPartsOutput](ctx, res, code) } if ctx.Request().URI().QueryArgs().Has("acl") { res, code := be.GetObjectAcl(bucket, key) - return responce[*s3response.GetObjectAccessControlPolicyResponse](ctx, res, code) + return responce[*s3.GetObjectAclOutput](ctx, res, code) } if attrs := ctx.Get("X-Amz-Object-Attributes"); attrs != "" { res, code := be.GetObjectAttributes(bucket, key, strings.Split(attrs, ",")) - return responce[*s3response.GetObjectAttributesResponse](ctx, res, code) + return responce[*s3.GetObjectAttributesOutput](ctx, res, code) } bRangeSl := strings.Split(ctx.Get("Range"), "=") @@ -131,7 +132,7 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { } res, code := be.GetObject(bucket, key, int64(startOffset), int64(length), ctx.Response().BodyWriter(), "") - return responce[*s3response.GetObjectResponse](ctx, res, code) + return responce[*s3.GetObjectOutput](ctx, res, code) }) // DeleteObject action // AbortMultipartUpload action @@ -146,11 +147,11 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { expectedBucketOwner, requestPayer := ctx.Get("X-Amz-Expected-Bucket-Owner"), ctx.Get("X-Amz-Request-Payer") code := be.AbortMultipartUpload(&s3.AbortMultipartUploadInput{ - UploadId: &uploadId, - Bucket: &bucket, - Key: &key, - ExpectedBucketOwner: &expectedBucketOwner, - RequestPayer: &requestPayer, + UploadId: &uploadId, + Bucket: &bucket, + Key: &key, + ExpectedBucketOwner: &expectedBucketOwner, + RequestPayer: types.RequestPayer(requestPayer), }) return responce[internal.Any](ctx, nil, code) } @@ -160,35 +161,35 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { }) // DeleteObjects action app.Post("/:bucket", func(ctx *fiber.Ctx) error { - var dObj s3response.DeleteObjectEntry + var dObj types.Delete if err := xml.Unmarshal(ctx.Body(), &dObj); err != nil { return errors.New("wrong api call") } - code := be.DeleteObjects(ctx.Params("bucket"), &s3response.DeleteObjectsInput{Delete: dObj}) + code := be.DeleteObjects(ctx.Params("bucket"), &s3.DeleteObjectsInput{Delete: &dObj}) return responce[internal.Any](ctx, nil, code) }) // CompleteMultipartUpload action // CreateMultipartUpload app.Post("/:bucket/:key/*", func(ctx *fiber.Ctx) error { bucket, key, keyEnd, uploadId := ctx.Params("bucket"), ctx.Params("key"), ctx.Params("*1"), ctx.Query("uploadId") - + if keyEnd != "" { key = strings.Join([]string{key, keyEnd}, "/") } if uploadId != "" { - var parts []s3response.Part + var parts []types.Part if err := xml.Unmarshal(ctx.Body(), &parts); err != nil { return errors.New("wrong api call") } - - res, code := be.CompleteMultipartUpload(bucket, "", uploadId, parts) - return responce[*s3response.CompleteMultipartUploadResponse](ctx, res, code) + + res, code := be.CompleteMultipartUpload(bucket, "", uploadId, parts) + return responce[*s3.CompleteMultipartUploadOutput](ctx, res, code) } res, code := be.CreateMultipartUpload(&s3.CreateMultipartUploadInput{Bucket: &bucket, Key: &key}) - return responce[*s3response.InitiateMultipartUploadResponse](ctx, res, code) + return responce[*s3.CreateMultipartUploadOutput](ctx, res, code) }) // CopyObject action app.Put("/:bucket/:key/*", func(ctx *fiber.Ctx) error { @@ -204,7 +205,7 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend) { } res, code := be.CopyObject(srcBucket, strings.Join(srcObject, "/"), dstBucket, dstKeyStart) - return responce[*s3response.CopyObjectResponse](ctx, res, code) + return responce[*s3.CopyObjectOutput](ctx, res, code) }) } diff --git a/s3api/server.go b/s3api/server.go index afe69fbe..70ab5901 100644 --- a/s3api/server.go +++ b/s3api/server.go @@ -3,10 +3,10 @@ package s3api import ( "encoding/xml" "fmt" + "github.com/aws/aws-sdk-go-v2/service/s3" "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 { @@ -25,7 +25,7 @@ func New(app *fiber.App, be backend.Backend, port string) (s3ApiServer *S3ApiSer app.All("/*", func(ctx *fiber.Ctx) error { fmt.Println(ctx.Method()) - listBucket := new(s3response.ListBucket) + listBucket := new(s3.ListBucketsInput) if b, err := xml.Marshal(listBucket); err != nil { return err } else { From a4b2d97673c1c9379a7fadfe50720298ee51a6a9 Mon Sep 17 00:00:00 2001 From: jonaustin09 Date: Wed, 17 May 2023 00:48:05 +0500 Subject: [PATCH 3/5] go mod --- go.mod | 17 ++++++++++++++--- go.sum | 38 ++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index f21e7fcd..5cb2570f 100644 --- a/go.mod +++ b/go.mod @@ -2,13 +2,24 @@ module github.com/versity/scoutgw go 1.20 -require github.com/aws/aws-sdk-go v1.44.258 +require ( + github.com/aws/aws-sdk-go-v2 v1.18.0 + github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1 + github.com/gofiber/fiber/v2 v2.45.0 +) require ( github.com/andybalholm/brotli v1.0.5 // indirect - github.com/gofiber/fiber/v2 v2.45.0 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2 // indirect + github.com/aws/smithy-go v1.13.5 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.16.3 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.18 // indirect diff --git a/go.sum b/go.sum index b22b39f3..ad04738f 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,35 @@ github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/aws/aws-sdk-go v1.44.258 h1:JVk1lgpsTnb1kvUw3eGhPLcTpEBp6HeSf1fxcYDs2Ho= -github.com/aws/aws-sdk-go v1.44.258/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY= +github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 h1:kG5eQilShqmJbv11XL1VpyDbaEJzWxd4zRiCG30GSn4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33/go.mod h1:7i0PF1ME/2eUPFcjkVIwq+DOygHEoK92t5cDqNgYbIw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 h1:vFQlirhuM8lLlpI7imKOMsjdQLuN9CPi+k44F/OFVsk= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27/go.mod h1:UrHnn3QV/d0pBZ6QBAEQcqFLf8FAzLmoUfPVIueOvoM= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25 h1:AzwRi5OKKwo4QNqPf7TjeO+tK8AyOK3GVSwmRPo7/Cs= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.25/go.mod h1:SUbB4wcbSEyCvqBxv/O/IBf93RbEze7U7OnoTlpPB+g= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 h1:y2+VQzC6Zh2ojtV2LoC0MNwHWc6qXv/j2vrQtlftkdA= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28 h1:vGWm5vTpMr39tEZfQeDiDAMgk+5qsnvRny3FjLpnH5w= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.28/go.mod h1:spfrICMD6wCAhjhzHuy6DOZZ+LAIY10UxhUmLzpJTTs= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 h1:0iKliEXAcCa2qVtRs7Ot5hItA2MsufrphbRFlz1Owxo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27/go.mod h1:EOwBD4J4S5qYszS5/3DpkejfuK+Z5/1uzICfPaZLtqw= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2 h1:NbWkRxEEIRSCqxhsHQuMiTH7yo+JZW1gp8v3elSVMTQ= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.2/go.mod h1:4tfW5l4IAB32VWCDEBxCRtR9T4BWy4I4kr1spr8NgZM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1 h1:O+9nAy9Bb6bJFTpeNFtd9UfHbgxO1o4ZDAM9rQp5NsY= +github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1/go.mod h1:J9kLNzEiHSeGMyN7238EjJmBpCniVzFda75Gxl/NqB8= +github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= +github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gofiber/fiber/v2 v2.45.0 h1:p4RpkJT9GAW6parBSbcNFH2ApnAuW3OzaQzbOCoDu+s= github.com/gofiber/fiber/v2 v2.45.0/go.mod h1:DNl0/c37WLe0g92U6lx1VMQuxGUQY5V7EIaVoEsUffc= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= @@ -24,8 +43,6 @@ github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -58,8 +75,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -73,20 +88,16 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -97,5 +108,4 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 417e84ea7b0e4077a6771b3a0bc4e2826c279275 Mon Sep 17 00:00:00 2001 From: jonaustin09 Date: Thu, 18 May 2023 00:39:17 +0500 Subject: [PATCH 4/5] feat: moved to golang s3 v2 sdk --- backend/backend.go | 4 +-- s3api/controllers/base.go | 51 ++++++++++++++++++++------------------- s3api/router.go | 11 --------- 3 files changed, 28 insertions(+), 38 deletions(-) diff --git a/backend/backend.go b/backend/backend.go index a61439dc..b5f320a8 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -40,7 +40,7 @@ type Backend interface { DeleteObjects(bucket string, objects *s3.DeleteObjectsInput) s3err.ErrorCode PutBucketAcl(*s3.PutBucketAclInput) s3err.ErrorCode PutObjectAcl(*s3.PutObjectAclInput) s3err.ErrorCode - RestoreObject(bucket, object string, restoreRequest *s3.RestoreRequest) s3err.ErrorCode + RestoreObject(bucket, object string, restoreRequest *s3.RestoreObjectInput) s3err.ErrorCode UploadPart(bucket, object, uploadId string, Body io.ReadSeeker) (*s3.UploadPartOutput, s3err.ErrorCode) UploadPartCopy(*s3.UploadPartCopyInput) (*s3.UploadPartCopyOutput, s3err.ErrorCode) @@ -73,7 +73,7 @@ func (BackendUnsupported) PutBucketAcl(*s3.PutBucketAclInput) s3err.ErrorCode { func (BackendUnsupported) PutObjectAcl(*s3.PutObjectAclInput) s3err.ErrorCode { return s3err.ErrNotImplemented } -func (BackendUnsupported) RestoreObject(bucket, object string, restoreRequest *s3.RestoreRequest) s3err.ErrorCode { +func (BackendUnsupported) RestoreObject(bucket, object string, restoreRequest *s3.RestoreObjectInput) s3err.ErrorCode { return s3err.ErrNotImplemented } func (BackendUnsupported) UploadPartCopy(*s3.UploadPartCopyInput) (*s3.UploadPartCopyOutput, s3err.ErrorCode) { diff --git a/s3api/controllers/base.go b/s3api/controllers/base.go index db9f8a82..264f6632 100644 --- a/s3api/controllers/base.go +++ b/s3api/controllers/base.go @@ -9,12 +9,13 @@ import ( "strings" "time" - "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/gofiber/fiber/v2" "github.com/versity/scoutgw/backend" "github.com/versity/scoutgw/internal" "github.com/versity/scoutgw/s3err" - "github.com/versity/scoutgw/s3response" ) type S3ApiController struct { @@ -27,7 +28,7 @@ func New(be backend.Backend) S3ApiController { func (c S3ApiController) ListBuckets(ctx *fiber.Ctx) error { res, code := c.be.ListBuckets() - return responce[*s3response.ListAllMyBucketsList](ctx, res, code) + return responce[*s3.ListBucketsOutput](ctx, res, code) } func (c S3ApiController) GetActions(ctx *fiber.Ctx) error { @@ -48,17 +49,17 @@ func (c S3ApiController) GetActions(ctx *fiber.Ctx) error { } res, code := c.be.ListObjectParts(bucket, "", uploadId, partNumberMarker, maxParts) - return responce[*s3response.ListPartsResponse](ctx, res, code) + return responce[*s3.ListPartsOutput](ctx, res, code) } if ctx.Request().URI().QueryArgs().Has("acl") { res, code := c.be.GetObjectAcl(bucket, key) - return responce[*s3response.GetObjectAccessControlPolicyResponse](ctx, res, code) + return responce[*s3.GetObjectAclOutput](ctx, res, code) } if attrs := ctx.Get("X-Amz-Object-Attributes"); attrs != "" { res, code := c.be.GetObjectAttributes(bucket, key, strings.Split(attrs, ",")) - return responce[*s3response.GetObjectAttributesResponse](ctx, res, code) + return responce[*s3.GetObjectAttributesOutput](ctx, res, code) } bRangeSl := strings.Split(ctx.Get("Range"), "=") @@ -82,27 +83,27 @@ func (c S3ApiController) GetActions(ctx *fiber.Ctx) error { } res, code := c.be.GetObject(bucket, key, int64(startOffset), int64(length), ctx.Response().BodyWriter(), "") - return responce[*s3response.GetObjectResponse](ctx, res, code) + return responce[*s3.GetObjectOutput](ctx, res, code) } func (c S3ApiController) ListActions(ctx *fiber.Ctx) error { if ctx.Request().URI().QueryArgs().Has("acl") { res, code := c.be.GetBucketAcl(ctx.Params("bucket")) - return responce[*s3response.GetBucketAclResponse](ctx, res, code) + return responce[*s3.GetBucketAclOutput](ctx, res, code) } if ctx.Request().URI().QueryArgs().Has("uploads") { - res, code := c.be.ListMultipartUploads(&s3response.ListMultipartUploads{Bucket: ctx.Params("bucket")}) - return responce[*s3response.ListMultipartUploadsResponse](ctx, res, code) + res, code := c.be.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: aws.String(ctx.Params("bucket"))}) + return responce[*s3.ListMultipartUploadsOutput](ctx, res, code) } if ctx.QueryInt("list-type") == 2 { res, code := c.be.ListObjectsV2(ctx.Params("bucket"), "", "", "", 1) - return responce[*s3response.ListBucketResultV2](ctx, res, code) + return responce[*s3.ListBucketsOutput](ctx, res, code) } res, code := c.be.ListObjects(ctx.Params("bucket"), "", "", "", 1) - return responce[*s3response.ListBucketResult](ctx, res, code) + return responce[*s3.ListBucketsOutput](ctx, res, code) } func (c S3ApiController) PutBucketActions(ctx *fiber.Ctx) error { @@ -123,7 +124,7 @@ func (c S3ApiController) PutBucketActions(ctx *fiber.Ctx) error { } code := c.be.PutBucketAcl(&s3.PutBucketAclInput{ Bucket: &bucket, - ACL: &acl, + ACL: types.BucketCannedACL(acl), GrantFullControl: &grantFullControl, GrantRead: &grantRead, GrantReadACP: &grantReadACP, @@ -183,7 +184,7 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error { res, code := c.be.UploadPartCopy(&s3.UploadPartCopyInput{ Bucket: &dstBucket, Key: &dstKeyStart, - PartNumber: &partNumber, + PartNumber: int32(partNumber), UploadId: &uploadId, CopySource: ©Source, CopySourceIfMatch: ©SrcIfMatch, @@ -209,7 +210,7 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error { code := c.be.PutObjectAcl(&s3.PutObjectAclInput{ Bucket: &dstBucket, Key: &dstKeyStart, - ACL: &acl, + ACL: types.ObjectCannedACL(acl), GrantFullControl: &grantFullControl, GrantRead: &grantRead, GrantReadACP: &grantReadACP, @@ -224,7 +225,7 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error { srcBucket, srcObject := copySourceSplit[0], copySourceSplit[1:] res, code := c.be.CopyObject(srcBucket, strings.Join(srcObject, "/"), dstBucket, dstKeyStart) - return responce[*s3response.CopyObjectResponse](ctx, res, code) + return responce[*s3.CopyObjectOutput](ctx, res, code) } res, code := c.be.PutObject(dstBucket, dstKeyStart, bytes.NewReader(ctx.Request().Body())) @@ -237,12 +238,12 @@ func (c S3ApiController) DeleteBucket(ctx *fiber.Ctx) error { } func (c S3ApiController) DeleteObjects(ctx *fiber.Ctx) error { - var dObj s3response.DeleteObjectEntry + var dObj types.Delete if err := xml.Unmarshal(ctx.Body(), &dObj); err != nil { return errors.New("wrong api call") } - code := c.be.DeleteObjects(ctx.Params("bucket"), &s3response.DeleteObjectsInput{Delete: dObj}) + code := c.be.DeleteObjects(ctx.Params("bucket"), &s3.DeleteObjectsInput{Delete: &dObj}) return responce[internal.Any](ctx, nil, code) } @@ -261,7 +262,7 @@ func (c S3ApiController) DeleteActions(ctx *fiber.Ctx) error { Bucket: &bucket, Key: &key, ExpectedBucketOwner: &expectedBucketOwner, - RequestPayer: &requestPayer, + RequestPayer: types.RequestPayer(requestPayer), }) return responce[internal.Any](ctx, nil, code) } @@ -272,7 +273,7 @@ func (c S3ApiController) DeleteActions(ctx *fiber.Ctx) error { func (c S3ApiController) HeadBucket(ctx *fiber.Ctx) error { res, code := c.be.HeadBucket(ctx.Params("bucket")) - return responce[*s3response.HeadBucketResponse](ctx, res, code) + return responce[*s3.HeadBucketOutput](ctx, res, code) } func (c S3ApiController) HeadObject(ctx *fiber.Ctx) error { @@ -282,12 +283,12 @@ func (c S3ApiController) HeadObject(ctx *fiber.Ctx) error { } res, code := c.be.HeadObject(bucket, key, "") - return responce[*s3response.HeadObjectResponse](ctx, res, code) + return responce[*s3.HeadObjectOutput](ctx, res, code) } func (c S3ApiController) CreateActions(ctx *fiber.Ctx) error { bucket, key, keyEnd, uploadId := ctx.Params("bucket"), ctx.Params("key"), ctx.Params("*1"), ctx.Query("uploadId") - var restoreRequest s3.RestoreRequest + var restoreRequest s3.RestoreObjectInput if keyEnd != "" { key = strings.Join([]string{key, keyEnd}, "/") @@ -299,17 +300,17 @@ func (c S3ApiController) CreateActions(ctx *fiber.Ctx) error { } if uploadId != "" { - var parts []s3response.Part + var parts []types.Part if err := xml.Unmarshal(ctx.Body(), &parts); err != nil { return errors.New("wrong api call") } res, code := c.be.CompleteMultipartUpload(bucket, "", uploadId, parts) - return responce[*s3response.CompleteMultipartUploadResponse](ctx, res, code) + return responce[*s3.CompleteMultipartUploadOutput](ctx, res, code) } res, code := c.be.CreateMultipartUpload(&s3.CreateMultipartUploadInput{Bucket: &bucket, Key: &key}) - return responce[*s3response.InitiateMultipartUploadResponse](ctx, res, code) + return responce[*s3.CreateMultipartUploadOutput](ctx, res, code) } func responce[R comparable](ctx *fiber.Ctx, resp R, code s3err.ErrorCode) error { diff --git a/s3api/router.go b/s3api/router.go index a919d85b..a9ac81a0 100644 --- a/s3api/router.go +++ b/s3api/router.go @@ -1,20 +1,9 @@ package s3api import ( - "encoding/xml" - "errors" - - "strconv" - "strings" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/gofiber/fiber/v2" "github.com/versity/scoutgw/backend" - "github.com/versity/scoutgw/internal" "github.com/versity/scoutgw/s3api/controllers" - "github.com/versity/scoutgw/s3err" ) type S3ApiRouter struct{} From af93150911bca0ea1657232ab9c36bb3c9204668 Mon Sep 17 00:00:00 2001 From: jonaustin09 Date: Thu, 18 May 2023 01:00:21 +0500 Subject: [PATCH 5/5] fix: removed extra api call --- s3api/server.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/s3api/server.go b/s3api/server.go index 70ab5901..7ded07c5 100644 --- a/s3api/server.go +++ b/s3api/server.go @@ -1,9 +1,6 @@ package s3api import ( - "encoding/xml" - "fmt" - "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/logger" "github.com/versity/scoutgw/backend" @@ -20,18 +17,7 @@ func New(app *fiber.App, be backend.Backend, port string) (s3ApiServer *S3ApiSer s3ApiServer = &S3ApiServer{app, be, new(S3ApiRouter), port} app.Use(logger.New()) - s3ApiServer.router.Init(app, be) - app.All("/*", func(ctx *fiber.Ctx) error { - - fmt.Println(ctx.Method()) - listBucket := new(s3.ListBucketsInput) - if b, err := xml.Marshal(listBucket); err != nil { - return err - } else { - return ctx.Send(b) - } - }) return }