@ -40,20 +40,9 @@ type LocationResponse struct {
type ListObjectsResponse struct {
type ListObjectsResponse struct {
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-" `
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-" `
CommonPrefixes [ ] CommonPrefix
Name string
Contents [ ] Object
Prefix string
Marker string
Delimiter string
// Encoding type used to encode object keys in the response.
EncodingType string
// A flag that indicates whether or not ListObjects returned all of the results
// that satisfied the search criteria.
IsTruncated bool
Marker string
MaxKeys int
Name string
// When response is truncated (the IsTruncated element value in the response
// When response is truncated (the IsTruncated element value in the response
// is true), you can use the key name in this field as marker in the subsequent
// is true), you can use the key name in this field as marker in the subsequent
@ -62,29 +51,28 @@ type ListObjectsResponse struct {
// specified. If response does not include the NextMaker and it is truncated,
// specified. If response does not include the NextMaker and it is truncated,
// you can use the value of the last Key in the response as the marker in the
// you can use the value of the last Key in the response as the marker in the
// subsequent request to get the next set of object keys.
// subsequent request to get the next set of object keys.
NextMarker string
NextMarker string ` xml:"NextMarker,omitempty" `
Prefix string
}
// ListObjectsV2Response - format for list objects response.
MaxKeys int
type ListObjectsV2Response struct {
Delimiter string
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-" `
// A flag that indicates whether or not ListObjects returned all of the results
// that satisfied the search criteria.
IsTruncated bool
CommonPrefixes [ ] CommonPrefix
Contents [ ] Object
Contents [ ] Object
CommonPrefixes [ ] CommonPrefix
Delimiter string
// Encoding type used to encode object keys in the response.
// Encoding type used to encode object keys in the response.
EncodingType string
EncodingType string ` xml:"EncodingType,omitempty" `
}
// A flag that indicates whether or not ListObjects returned all of the results
// ListObjectsV2Response - format for list objects response.
// that satisfied the search criteria.
type ListObjectsV2Response struct {
IsTruncated bool
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-" `
StartAfter string
MaxKeys int
Name string
Name string
Prefix string
StartAfter string ` xml:"StartAfter,omitempty" `
// When response is truncated (the IsTruncated element value in the response
// When response is truncated (the IsTruncated element value in the response
// is true), you can use the key name in this field as marker in the subsequent
// is true), you can use the key name in this field as marker in the subsequent
// request to get next set of objects. Server lists objects in alphabetical
// request to get next set of objects. Server lists objects in alphabetical
@ -92,16 +80,28 @@ type ListObjectsV2Response struct {
// specified. If response does not include the NextMaker and it is truncated,
// specified. If response does not include the NextMaker and it is truncated,
// you can use the value of the last Key in the response as the marker in the
// you can use the value of the last Key in the response as the marker in the
// subsequent request to get the next set of object keys.
// subsequent request to get the next set of object keys.
ContinuationToken string
ContinuationToken string ` xml:"ContinuationToken,omitempty" `
NextContinuationToken string
NextContinuationToken string ` xml:"NextContinuationToken,omitempty" `
Prefix string
KeyCount int
MaxKeys int
Delimiter string
// A flag that indicates whether or not ListObjects returned all of the results
// that satisfied the search criteria.
IsTruncated bool
Contents [ ] Object
CommonPrefixes [ ] CommonPrefix
// Encoding type used to encode object keys in the response.
EncodingType string ` xml:"EncodingType,omitempty" `
}
}
// Part container for part metadata.
// Part container for part metadata.
type Part struct {
type Part struct {
PartNumber int
PartNumber int
ETag string
LastModified string
LastModified string
ETag string
Size int64
Size int64
}
}
@ -137,23 +137,29 @@ type ListMultipartUploadsResponse struct {
UploadIDMarker string ` xml:"UploadIdMarker" `
UploadIDMarker string ` xml:"UploadIdMarker" `
NextKeyMarker string
NextKeyMarker string
NextUploadIDMarker string ` xml:"NextUploadIdMarker" `
NextUploadIDMarker string ` xml:"NextUploadIdMarker" `
EncodingType string
Delimiter string
Prefix string
EncodingType string ` xml:"EncodingType,omitempty" `
MaxUploads int
MaxUploads int
IsTruncated bool
IsTruncated bool
Uploads [ ] Upload ` xml:"Upload" `
Prefix string
// List of pending uploads.
Delimiter string
Uploads [ ] Upload ` xml:"Upload" `
CommonPrefixes [ ] CommonPrefix
// Delimed common prefixes.
CommonPrefixes [ ] CommonPrefix
}
}
// ListBucketsResponse - format for list buckets response
// ListBucketsResponse - format for list buckets response
type ListBucketsResponse struct {
type ListBucketsResponse struct {
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult" json:"-" `
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult" json:"-" `
Owner Owner
// Container for one or more buckets.
// Container for one or more buckets.
Buckets struct {
Buckets struct {
Buckets [ ] Bucket ` xml:"Bucket" `
Buckets [ ] Bucket ` xml:"Bucket" `
} // Buckets are nested
} // Buckets are nested
Owner Owner
}
}
// Upload container for in progress multipart upload
// Upload container for in progress multipart upload
@ -179,23 +185,23 @@ type Bucket struct {
// Object container for object metadata
// Object container for object metadata
type Object struct {
type Object struct {
ETag string
Key string
Key string
LastModified string // time string of format "2006-01-02T15:04:05.000Z"
LastModified string // time string of format "2006-01-02T15:04:05.000Z"
ETag string
Size int64
Size int64
// Owner of the object.
Owner Owner
Owner Owner
// The class of storage used to store the object.
// The class of storage used to store the object.
StorageClass string
StorageClass string
}
}
// CopyObjectResponse container returns ETag and LastModified of the
// CopyObjectResponse container returns ETag and LastModified of the successfully copied object
// successfully copied object
type CopyObjectResponse struct {
type CopyObjectResponse struct {
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult" json:"-" `
XMLName xml . Name ` xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult" json:"-" `
ETag string
LastModified string // time string of format "2006-01-02T15:04:05.000Z"
LastModified string // time string of format "2006-01-02T15:04:05.000Z"
ETag string // md5sum of the copied object.
}
}
// Initiator inherit from Owner struct, fields are same
// Initiator inherit from Owner struct, fields are same
@ -370,6 +376,7 @@ func generateListObjectsV2Response(bucket, prefix, token, startAfter, delimiter
prefixes = append ( prefixes , prefixItem )
prefixes = append ( prefixes , prefixItem )
}
}
data . CommonPrefixes = prefixes
data . CommonPrefixes = prefixes
data . KeyCount = len ( data . Contents ) + len ( data . CommonPrefixes )
return data
return data
}
}