@@ -63,6 +63,7 @@ const (
63
63
keyBucketLock key = "Bucketlock"
64
64
keyObjRetention key = "Objectretention"
65
65
keyObjLegalHold key = "Objectlegalhold"
66
+ keyExpires key = "Vgwexpires"
66
67
onameAttr key = "Objname"
67
68
onameAttrLower key = "objname"
68
69
metaTmpMultipartPrefix key = ".sgwtmp" + "/multipart"
@@ -76,6 +77,7 @@ func (key) Table() map[string]struct{} {
76
77
"policy" : {},
77
78
"bucketlock" : {},
78
79
"objectretention" : {},
80
+ "vgwexpires" : {},
79
81
"objectlegalhold" : {},
80
82
"objname" : {},
81
83
".sgwtmp/multipart" : {},
@@ -292,21 +294,36 @@ func (az *Azure) DeleteBucketOwnershipControls(ctx context.Context, bucket strin
292
294
return az .deleteContainerMetaData (ctx , bucket , string (keyOwnership ))
293
295
}
294
296
295
- func (az * Azure ) PutObject (ctx context.Context , po * s3 .PutObjectInput ) (s3response.PutObjectOutput , error ) {
297
+ func (az * Azure ) PutObject (ctx context.Context , po s3response .PutObjectInput ) (s3response.PutObjectOutput , error ) {
296
298
tags , err := parseTags (po .Tagging )
297
299
if err != nil {
298
300
return s3response.PutObjectOutput {}, err
299
301
}
300
302
303
+ metadata := parseMetadata (po .Metadata )
304
+
305
+ // Store the "Expires" property in the object metadata
306
+ if getString (po .Expires ) != "" {
307
+ if metadata == nil {
308
+ metadata = map [string ]* string {
309
+ string (keyExpires ): po .Expires ,
310
+ }
311
+ } else {
312
+ metadata [string (keyExpires )] = po .Expires
313
+ }
314
+ }
315
+
301
316
opts := & blockblob.UploadStreamOptions {
302
- Metadata : parseMetadata ( po . Metadata ) ,
317
+ Metadata : metadata ,
303
318
Tags : tags ,
304
319
}
305
320
306
321
opts .HTTPHeaders = & blob.HTTPHeaders {}
307
322
opts .HTTPHeaders .BlobContentEncoding = po .ContentEncoding
308
323
opts .HTTPHeaders .BlobContentLanguage = po .ContentLanguage
309
324
opts .HTTPHeaders .BlobContentDisposition = po .ContentDisposition
325
+ opts .HTTPHeaders .BlobContentLanguage = po .ContentLanguage
326
+ opts .HTTPHeaders .BlobCacheControl = po .CacheControl
310
327
if strings .HasSuffix (* po .Key , "/" ) {
311
328
// Hardcode "application/x-directory" for direcoty objects
312
329
opts .HTTPHeaders .BlobContentType = backend .GetPtrFromString (backend .DirContentType )
@@ -430,17 +447,21 @@ func (az *Azure) GetObject(ctx context.Context, input *s3.GetObjectInput) (*s3.G
430
447
}
431
448
432
449
return & s3.GetObjectOutput {
433
- AcceptRanges : backend .GetPtrFromString ("bytes" ),
434
- ContentLength : blobDownloadResponse .ContentLength ,
435
- ContentEncoding : blobDownloadResponse .ContentEncoding ,
436
- ContentType : contentType ,
437
- ETag : (* string )(blobDownloadResponse .ETag ),
438
- LastModified : blobDownloadResponse .LastModified ,
439
- Metadata : parseAzMetadata (blobDownloadResponse .Metadata ),
440
- TagCount : & tagcount ,
441
- ContentRange : blobDownloadResponse .ContentRange ,
442
- Body : blobDownloadResponse .Body ,
443
- StorageClass : types .StorageClassStandard ,
450
+ AcceptRanges : backend .GetPtrFromString ("bytes" ),
451
+ ContentLength : blobDownloadResponse .ContentLength ,
452
+ ContentEncoding : blobDownloadResponse .ContentEncoding ,
453
+ ContentType : contentType ,
454
+ ContentDisposition : blobDownloadResponse .ContentDisposition ,
455
+ ContentLanguage : blobDownloadResponse .ContentLanguage ,
456
+ CacheControl : blobDownloadResponse .CacheControl ,
457
+ ExpiresString : blobDownloadResponse .Metadata [string (keyExpires )],
458
+ ETag : (* string )(blobDownloadResponse .ETag ),
459
+ LastModified : blobDownloadResponse .LastModified ,
460
+ Metadata : parseAzMetadata (blobDownloadResponse .Metadata ),
461
+ TagCount : & tagcount ,
462
+ ContentRange : blobDownloadResponse .ContentRange ,
463
+ Body : blobDownloadResponse .Body ,
464
+ StorageClass : types .StorageClassStandard ,
444
465
}, nil
445
466
}
446
467
@@ -494,10 +515,11 @@ func (az *Azure) HeadObject(ctx context.Context, input *s3.HeadObjectInput) (*s3
494
515
ContentEncoding : resp .ContentEncoding ,
495
516
ContentLanguage : resp .ContentLanguage ,
496
517
ContentDisposition : resp .ContentDisposition ,
518
+ CacheControl : resp .CacheControl ,
519
+ ExpiresString : resp .Metadata [string (keyExpires )],
497
520
ETag : (* string )(resp .ETag ),
498
521
LastModified : resp .LastModified ,
499
522
Metadata : parseAzMetadata (resp .Metadata ),
500
- Expires : resp .ExpiresOn ,
501
523
StorageClass : types .StorageClassStandard ,
502
524
}
503
525
@@ -826,7 +848,7 @@ func (az *Azure) DeleteObjectTagging(ctx context.Context, bucket, object string)
826
848
return nil
827
849
}
828
850
829
- func (az * Azure ) CreateMultipartUpload (ctx context.Context , input * s3 .CreateMultipartUploadInput ) (s3response.InitiateMultipartUploadResult , error ) {
851
+ func (az * Azure ) CreateMultipartUpload (ctx context.Context , input s3response .CreateMultipartUploadInput ) (s3response.InitiateMultipartUploadResult , error ) {
830
852
if input .ObjectLockLegalHoldStatus != "" || input .ObjectLockMode != "" {
831
853
bucketLock , err := az .getContainerMetaData (ctx , * input .Bucket , string (keyBucketLock ))
832
854
if err != nil {
@@ -850,6 +872,10 @@ func (az *Azure) CreateMultipartUpload(ctx context.Context, input *s3.CreateMult
850
872
meta := parseMetadata (input .Metadata )
851
873
meta [string (onameAttr )] = input .Key
852
874
875
+ if getString (input .Expires ) != "" {
876
+ meta [string (keyExpires )] = input .Expires
877
+ }
878
+
853
879
// parse object tags
854
880
tagsStr := getString (input .Tagging )
855
881
tags := map [string ]string {}
@@ -892,12 +918,13 @@ func (az *Azure) CreateMultipartUpload(ctx context.Context, input *s3.CreateMult
892
918
opts := & blockblob.UploadBufferOptions {
893
919
Metadata : meta ,
894
920
Tags : tags ,
895
- }
896
- if getString (input .ContentType ) != "" {
897
- opts .HTTPHeaders = & blob.HTTPHeaders {
898
- BlobContentType : input .ContentType ,
899
- BlobContentEncoding : input .ContentEncoding ,
900
- }
921
+ HTTPHeaders : & blob.HTTPHeaders {
922
+ BlobContentType : input .ContentType ,
923
+ BlobContentEncoding : input .ContentEncoding ,
924
+ BlobCacheControl : input .CacheControl ,
925
+ BlobContentDisposition : input .ContentDisposition ,
926
+ BlobContentLanguage : input .ContentLanguage ,
927
+ },
901
928
}
902
929
903
930
// Create and empty blob in .sgwtmp/multipart/<uploadId>/<object hash>
@@ -1260,8 +1287,11 @@ func (az *Azure) CompleteMultipartUpload(ctx context.Context, input *s3.Complete
1260
1287
Tags : parseAzTags (tags .BlobTagSet ),
1261
1288
}
1262
1289
opts .HTTPHeaders = & blob.HTTPHeaders {
1263
- BlobContentType : props .ContentType ,
1264
- BlobContentEncoding : props .ContentEncoding ,
1290
+ BlobContentType : props .ContentType ,
1291
+ BlobContentEncoding : props .ContentEncoding ,
1292
+ BlobContentDisposition : props .ContentDisposition ,
1293
+ BlobContentLanguage : props .ContentLanguage ,
1294
+ BlobCacheControl : props .CacheControl ,
1265
1295
}
1266
1296
1267
1297
resp , err := client .CommitBlockList (ctx , blockIds , opts )
0 commit comments