@@ -252,7 +252,7 @@ async def _list_blobs(self, prefix=None) -> t.List[AbstractBlob]:
252252
253253 for o in response .get ('Contents' , []):
254254 obj_hash = o ['ETag' ].replace ('"' , '' )
255- blobs .append (AbstractBlob (o ['Key' ], o ['Size' ], obj_hash , o ['LastModified' ]))
255+ blobs .append (AbstractBlob (o ['Key' ], o ['Size' ], obj_hash , o ['LastModified' ], o [ 'StorageClass' ] ))
256256
257257 return blobs
258258
@@ -264,6 +264,10 @@ async def _upload_object(self, data: io.BytesIO, object_key: str, headers: t.Dic
264264 kms_args ['ServerSideEncryption' ] = 'aws:kms'
265265 kms_args ['SSEKMSKeyId' ] = self .kms_id
266266
267+ storage_class = self .get_storage_class ()
268+ if storage_class is not None :
269+ kms_args ['StorageClass' ] = storage_class
270+
267271 logging .debug (
268272 '[S3 Storage] Uploading object from stream -> s3://{}/{}' .format (
269273 self .bucket_name , object_key
@@ -326,7 +330,7 @@ async def _stat_blob(self, object_key: str) -> AbstractBlob:
326330 try :
327331 resp = self .s3_client .head_object (Bucket = self .bucket_name , Key = object_key )
328332 item_hash = resp ['ETag' ].replace ('"' , '' )
329- return AbstractBlob (object_key , int (resp ['ContentLength' ]), item_hash , resp ['LastModified' ])
333+ return AbstractBlob (object_key , int (resp ['ContentLength' ]), item_hash , resp ['LastModified' ], None )
330334 except ClientError as e :
331335 if e .response ['Error' ]['Code' ] == 'NoSuchKey' or e .response ['Error' ]['Code' ] == '404' :
332336 logging .debug ("[S3 Storage] Object {} not found" .format (object_key ))
@@ -339,7 +343,7 @@ async def _stat_blob(self, object_key: str) -> AbstractBlob:
339343 def __stat_blob (self , key ):
340344 resp = self .s3_client .head_object (Bucket = self .bucket_name , Key = key )
341345 item_hash = resp ['ETag' ].replace ('"' , '' )
342- return AbstractBlob (key , int (resp ['ContentLength' ]), item_hash , resp ['LastModified' ])
346+ return AbstractBlob (key , int (resp ['ContentLength' ]), item_hash , resp ['LastModified' ], None )
343347
344348 @retry (stop_max_attempt_number = MAX_UP_DOWN_LOAD_RETRIES , wait_fixed = 5000 )
345349 async def _upload_blob (self , src : str , dest : str ) -> ManifestObject :
@@ -353,6 +357,10 @@ async def _upload_blob(self, src: str, dest: str) -> ManifestObject:
353357 kms_args ['ServerSideEncryption' ] = 'aws:kms'
354358 kms_args ['SSEKMSKeyId' ] = self .kms_id
355359
360+ storage_class = self .get_storage_class ()
361+ if storage_class is not None :
362+ kms_args ['StorageClass' ] = storage_class
363+
356364 file_size = os .stat (src ).st_size
357365 logging .debug (
358366 '[S3 Storage] Uploading {} ({}) -> {}' .format (
0 commit comments