Skip to content

Commit c8c9ce5

Browse files
committed
add missing fields
Signed-off-by: Bala.FA <bala@minio.io>
1 parent 2b9e6cb commit c8c9ce5

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

minio/minio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,14 @@ def bucket_exists(
15581558
extra_headers: Optional[HTTPHeaderDict] = None,
15591559
extra_query_params: Optional[HTTPQueryDict] = None,
15601560
) -> bool:
1561+
## FIXME: add HeadBucket S3 API
1562+
"""
1563+
x-amz-bucket-arn: BucketArn
1564+
x-amz-bucket-location-type: BucketLocationType
1565+
x-amz-bucket-location-name: BucketLocationName
1566+
x-amz-bucket-region: BucketRegion
1567+
x-amz-access-point-alias: AccessPointAlias
1568+
"""
15611569
"""
15621570
Check if a bucket exists.
15631571

minio/models.py

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)

0 commit comments

Comments
 (0)