diff --git a/api/handler/attributes.go b/api/handler/attributes.go index 89cf8f41..6cdbc296 100644 --- a/api/handler/attributes.go +++ b/api/handler/attributes.go @@ -187,7 +187,7 @@ func encodeToObjectAttributesResponse(info *data.ObjectInfo, p *GetObjectAttribu case eTag: resp.ETag = info.HashSum case storageClass: - resp.StorageClass = "STANDARD" + resp.StorageClass = api.DefaultStorageClass case objectSize: resp.ObjectSize = info.Size case checksum: diff --git a/api/handler/get.go b/api/handler/get.go index c17a4a03..7e273473 100644 --- a/api/handler/get.go +++ b/api/handler/get.go @@ -98,6 +98,7 @@ func writeHeaders(h http.Header, requestHeader http.Header, extendedInfo *data.E h.Set(api.ETag, info.ETag(md5Enabled)) h.Set(api.AmzTaggingCount, strconv.Itoa(tagSetLength)) + h.Set(api.AmzStorageClass, api.DefaultStorageClass) if !isBucketUnversioned { h.Set(api.AmzVersionID, extendedInfo.Version()) diff --git a/api/handler/multipart_upload.go b/api/handler/multipart_upload.go index ecf51f4c..16ef167f 100644 --- a/api/handler/multipart_upload.go +++ b/api/handler/multipart_upload.go @@ -61,7 +61,7 @@ type ( Owner Owner `xml:"Owner"` Parts []*layer.Part `xml:"Part"` PartNumberMarker int `xml:"PartNumberMarker,omitempty"` - StorageClass string `xml:"StorageClass,omitempty"` + StorageClass string `xml:"StorageClass"` UploadID string `xml:"UploadId"` } @@ -70,7 +70,7 @@ type ( Initiator Initiator `xml:"Initiator"` Key string `xml:"Key"` Owner Owner `xml:"Owner"` - StorageClass string `xml:"StorageClass,omitempty"` + StorageClass string `xml:"StorageClass"` UploadID string `xml:"UploadId"` } @@ -697,7 +697,8 @@ func encodeListMultipartUploadsToResponse(info *layer.ListMultipartUploadsInfo, ID: u.Owner.String(), DisplayName: u.Owner.String(), }, - UploadID: u.UploadID, + UploadID: u.UploadID, + StorageClass: api.DefaultStorageClass, } uploads = append(uploads, m) } @@ -726,6 +727,7 @@ func encodeListPartsToResponse(info *layer.ListPartsInfo, params *layer.ListPart PartNumberMarker: params.PartNumberMarker, UploadID: params.Info.UploadID, Parts: info.Parts, + StorageClass: api.DefaultStorageClass, } } diff --git a/api/handler/object_list.go b/api/handler/object_list.go index 9c1ff173..5144b5c9 100644 --- a/api/handler/object_list.go +++ b/api/handler/object_list.go @@ -6,6 +6,7 @@ import ( "strconv" "time" + "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer" @@ -196,6 +197,7 @@ func fillContents(src []*data.ObjectInfo, encode string, fetchOwner bool) []Obje Size: obj.Size, LastModified: obj.Created.UTC().Format(time.RFC3339), ETag: obj.HashSum, + StorageClass: api.DefaultStorageClass, } if size, err := layer.GetObjectSize(obj); err == nil { @@ -284,9 +286,10 @@ func encodeListObjectVersionsToResponse(info *layer.ListObjectVersionsInfo, buck ID: ver.ObjectInfo.Owner.String(), DisplayName: ver.ObjectInfo.Owner.String(), }, - Size: ver.ObjectInfo.Size, - VersionID: ver.Version(), - ETag: ver.ObjectInfo.ETag(md5Enabled), + Size: ver.ObjectInfo.Size, + VersionID: ver.Version(), + ETag: ver.ObjectInfo.ETag(md5Enabled), + StorageClass: api.DefaultStorageClass, }) } // this loop is not starting till versioning is not implemented diff --git a/api/handler/response.go b/api/handler/response.go index 9d07b337..c4edc84d 100644 --- a/api/handler/response.go +++ b/api/handler/response.go @@ -110,7 +110,7 @@ type Object struct { Owner *Owner `xml:"Owner,omitempty"` // Class of storage used to store the object. - StorageClass string `xml:"StorageClass,omitempty"` + StorageClass string `xml:"StorageClass"` } // ObjectVersionResponse container for object version in the response of ListBucketObjectVersionsHandler. @@ -121,7 +121,7 @@ type ObjectVersionResponse struct { LastModified string `xml:"LastModified"` Owner Owner `xml:"Owner"` Size uint64 `xml:"Size"` - StorageClass string `xml:"StorageClass,omitempty"` // is empty!! + StorageClass string `xml:"StorageClass"` VersionID string `xml:"VersionId"` } diff --git a/api/headers.go b/api/headers.go index bbffc24a..0a51e641 100644 --- a/api/headers.go +++ b/api/headers.go @@ -61,6 +61,7 @@ const ( AmzObjectAttributes = "X-Amz-Object-Attributes" AmzMaxParts = "X-Amz-Max-Parts" AmzPartNumberMarker = "X-Amz-Part-Number-Marker" + AmzStorageClass = "X-Amz-Storage-Class" AmzServerSideEncryptionCustomerAlgorithm = "x-amz-server-side-encryption-customer-algorithm" AmzServerSideEncryptionCustomerKey = "x-amz-server-side-encryption-customer-key" @@ -89,6 +90,8 @@ const ( DefaultLocationConstraint = "default" StreamingContentSHA256 = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD" + + DefaultStorageClass = "STANDARD" ) // S3 request query params.