gufo.blob.common.s3¶
Common S3 definitions and utilities.
S3Error
¶
S3Info
¶
Information about an S3-compatible service connection.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
Server hostname or address. |
|
port |
Server port. |
|
bucket |
Bucket name used for this connection. |
|
prefix |
Optional key prefix within the bucket. |
|
access_key |
AWS access key (optional). |
|
secret_key |
AWS secret key (optional). |
endpoint
property
¶
Build the S3-compatible endpoint URL.
clone()
¶
Return a shallow copy of this connection info.
Returns:
| Type | Description |
|---|---|
S3Info
|
New S3Info with the same attributes. |
url(*, prefix=None)
¶
Build full connection URL for gufo.blob backends.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str | None
|
Override default key prefix. |
None
|
S3Response
¶
S3Xml
¶
Parse XML responses from S3-compatible API.
list_objects(body)
classmethod
¶
Parse ListObjectsV2 response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
XML body with object listings. |
required |
Returns:
| Type | Description |
|---|---|
tuple[list[str], str | None]
|
Tuple of (list_of_keys, next_continuation_token_or_none). |
Raises:
| Type | Description |
|---|---|
BlobError
|
on malformed XML response. |
parse_url(url)
¶
Parse S3 URL and extract parameters for the constructor.
Accepts s3://bucket/path URLs with optional query params::
s3://mybucket/prefix?endpoint=http://127.0.0.1:5555®ion=us-east-1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
S3-compatible URL. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|
Raises:
| Type | Description |
|---|---|
BlobError
|
on unsupported schemas or missing bucket name. |
sign_request(method, url, body, region, credentials)
¶
Create SigV4 headers when credentials are configured.