@@ -195,6 +195,10 @@ class Object:
195195 is_delete_marker : bool = False
196196 tags : Optional [Tags ] = None
197197 is_dir : bool = field (default = False , init = False )
198+ checksum_algorithms : Optional [List [Algorithm ]] = None
199+ checksum_type : Optional [ChecksumType ] = None
200+ is_restore_in_progress : bool = False
201+ restore_expiry_date : Optional [datetime ] = None
198202
199203 def __post_init__ (self ):
200204 object .__setattr__ (
@@ -248,6 +252,22 @@ def fromxml(
248252 ),
249253 )
250254
255+ checksum_algorithms : List [Algorithm ] = []
256+ for elem in findall (element , "ChecksumAlgorithm" ):
257+ if elem .text :
258+ checksum_algorithms .append (Algorithm [elem .text ])
259+
260+ checksum_type = findtext (element , "ChecksumType" )
261+
262+ is_restore_in_progress = cast (
263+ str ,
264+ findtext (element , "RestoreStatus/IsRestoreInProgress" , default = "" ),
265+ )
266+
267+ restore_expiry_date = findtext (
268+ element , "RestoreStatus/RestoreExpiryDate" ,
269+ )
270+
251271 return cls (
252272 bucket_name = bucket_name ,
253273 object_name = object_name ,
@@ -261,7 +281,16 @@ def fromxml(
261281 owner_name = owner_name ,
262282 metadata = metadata ,
263283 is_delete_marker = is_delete_marker ,
264- tags = tags
284+ tags = tags ,
285+ checksum_algorithms = checksum_algorithms or None ,
286+ checksum_type = (
287+ ChecksumType [checksum_type ] if checksum_type else None
288+ ),
289+ is_restore_in_progress = is_restore_in_progress .lower () == "true" ,
290+ restore_expiry_date = (
291+ from_iso8601utc (restore_expiry_date ) if restore_expiry_date
292+ else None
293+ ),
265294 )
266295
267296
@@ -2519,6 +2548,7 @@ class Bucket:
25192548 name : str
25202549 creation_date : Optional [datetime ] = None
25212550 bucket_region : Optional [str ] = None
2551+ bucket_arn : Optional [str ] = None
25222552
25232553 @classmethod
25242554 def fromxml (
@@ -2533,6 +2563,7 @@ def fromxml(
25332563 creation_date = from_iso8601utc (
25342564 creation_date ) if creation_date else None ,
25352565 bucket_region = findtext (element , "BucketRegion" ),
2566+ bucket_arn = findtext (element , "BucketArn" ),
25362567 )
25372568
25382569
@@ -2614,6 +2645,8 @@ class Upload:
26142645 owner_name : Optional [str ] = None
26152646 storage_class : Optional [str ] = None
26162647 initiated_time : Optional [datetime ] = None
2648+ checksum_algorithm : Optional [Algorithm ] = None
2649+ checksum_type : Optional [ChecksumType ] = None
26172650
26182651 def __init__ (
26192652 self , element : ET .Element , encoding_type : Optional [str ] = None ,
@@ -2661,6 +2694,20 @@ def __init__(
26612694 "initiated_time" ,
26622695 from_iso8601utc (initiated_time ) if initiated_time else None ,
26632696 )
2697+ checksum_algorithm = findtext (element , "ChecksumAlgorithm" )
2698+ if checksum_algorithm :
2699+ object .__setattr__ (
2700+ self ,
2701+ "checksum_algorithm" ,
2702+ Algorithm [checksum_algorithm ],
2703+ )
2704+ checksum_type = findtext (element , "ChecksumType" )
2705+ if checksum_type :
2706+ object .__setattr__ (
2707+ self ,
2708+ "checksum_type" ,
2709+ ChecksumType [checksum_type ],
2710+ )
26642711
26652712
26662713@dataclass (frozen = True )
@@ -2946,6 +2993,48 @@ def __init__( # pylint: disable=too-many-positional-arguments
29462993 )
29472994
29482995
2996+ @dataclass (frozen = True )
2997+ class HeadBucketResponse (GenericResponse ):
2998+ """ Response of HeadBucket API."""
2999+ bucket_arn : Optional [str ] = None
3000+ location_type : Optional [str ] = None
3001+ location_name : Optional [str ] = None
3002+ access_point_alias : Optional [str ] = None
3003+
3004+ def __init__ (
3005+ self ,
3006+ * ,
3007+ headers : HTTPHeaderDict ,
3008+ bucket_name : str ,
3009+ region : str ,
3010+ ):
3011+ super ().__init__ (
3012+ headers = headers ,
3013+ bucket_name = bucket_name ,
3014+ region = region ,
3015+ )
3016+ object .__setattr__ (
3017+ self ,
3018+ "bucket_arn" ,
3019+ headers .get ("x-amz-bucket-arn" ),
3020+ )
3021+ object .__setattr__ (
3022+ self ,
3023+ "location_type" ,
3024+ headers .get ("x-amz-bucket-location-type" ),
3025+ )
3026+ object .__setattr__ (
3027+ self ,
3028+ "location_name" ,
3029+ headers .get ("x-amz-bucket-location-name" ),
3030+ )
3031+ object .__setattr__ (
3032+ self ,
3033+ "access_point_alias" ,
3034+ headers .get ("x-amz-access-point-alias" ),
3035+ )
3036+
3037+
29493038@dataclass (frozen = True )
29503039class HeadObjectResponse (GenericResponse ):
29513040 """ Response of HeadObject API."""
0 commit comments