diff --git a/cmd/api-response.go b/cmd/api-response.go index b252616e5..6b528e762 100644 --- a/cmd/api-response.go +++ b/cmd/api-response.go @@ -339,7 +339,7 @@ func generateListObjectsV1Response(bucket, prefix, marker, delimiter string, max content.ETag = "\"" + object.ETag + "\"" } content.Size = object.Size - content.StorageClass = globalMinioDefaultStorageClass + content.StorageClass = object.StorageClass content.Owner = owner contents = append(contents, content) } @@ -385,7 +385,7 @@ func generateListObjectsV2Response(bucket, prefix, token, nextToken, startAfter, content.ETag = "\"" + object.ETag + "\"" } content.Size = object.Size - content.StorageClass = globalMinioDefaultStorageClass + content.StorageClass = object.StorageClass content.Owner = owner contents = append(contents, content) } diff --git a/cmd/object-api-datatypes.go b/cmd/object-api-datatypes.go index feb4a77d9..976c11272 100644 --- a/cmd/object-api-datatypes.go +++ b/cmd/object-api-datatypes.go @@ -98,6 +98,9 @@ type ObjectInfo struct { // by the Content-Type header field. ContentEncoding string + // Specify object storage class + StorageClass string + // User-Defined metadata UserDefined map[string]string diff --git a/cmd/xl-v1-metadata.go b/cmd/xl-v1-metadata.go index c33b5e1a3..362b2166f 100644 --- a/cmd/xl-v1-metadata.go +++ b/cmd/xl-v1-metadata.go @@ -315,6 +315,13 @@ func (m xlMetaV1) ToObjectInfo(bucket, object string) ObjectInfo { // All the parts per object. objInfo.Parts = m.Parts + // Update storage class + if sc, ok := m.Meta[amzStorageClass]; ok { + objInfo.StorageClass = sc + } else { + objInfo.StorageClass = globalMinioDefaultStorageClass + } + // Success. return objInfo }