S3Client.head_bucket
rboto-s3==0.4.0 · Service index · Types
Model summary (excerpt): You can use this operation to determine if a bucket exists and if you have permission to access it. The action returns a 200 OK HTTP status code if the bucket exists and you have permission to access it. You can make a HeadBucket call on any bucket name to any Region in the partition, and regardless of the permissions on the bucket, you will receive a response header with the correct bucket...
Install and imports
Signature
async def head_bucket(
*,
bucket: str,
expected_bucket_owner: str | None = None,
) -> HeadBucketOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
bucket |
Yes | The bucket name. Directory buckets - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format Bucket-name .s3express- zone-id . region-code .amazonaws.com . Path-style requests are not supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the format bucket-base-name --... |
expected_bucket_owner |
No | The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied). |
Output
HeadBucketOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
bucket_arn |
str | None |
Always present | — |
bucket_location_type |
LocationTypeOutput | None |
Always present | LocationTypeOutput |
bucket_location_name |
str | None |
Always present | — |
bucket_region |
str | None |
Always present | — |
access_point_alias |
bool | None |
Always present | — |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
No generated paginator for this operation.
No output stream.
Waiters
from rboto import WaiterConfig. Calls use this public operation, including configured middleware and native retries. Polling, deadlines and errors.
client.waiters.bucket_exists:
async def bucket_exists(
*,
bucket: str,
expected_bucket_owner: str | None = None,
waiter_config: WaiterConfig | None = None,
) -> HeadBucketOutput: ...
Default fixed delay: 5 seconds. Default maximum: 40 polls. No overall timeout unless configured.
Returns the successful polling Output.
| Acceptor index | State | Matcher | Model path | Expected |
|---|---|---|---|---|
| 0 | success | success | — |
True |
| 1 | retry | errorType | — |
NotFound |
Acceptors are checked in order. Missing fields or unmatched successful responses continue polling. Unmatched service errors propagate.
client.waiters.bucket_not_exists:
async def bucket_not_exists(
*,
bucket: str,
expected_bucket_owner: str | None = None,
waiter_config: WaiterConfig | None = None,
) -> None: ...
Default fixed delay: 5 seconds. Default maximum: 40 polls. No overall timeout unless configured.
Returns None when the modeled error confirms success.
| Acceptor index | State | Matcher | Model path | Expected |
|---|---|---|---|---|
| 0 | success | errorType | — |
NotFound |
Acceptors are checked in order. Missing fields or unmatched successful responses continue polling. Unmatched service errors propagate.
Errors
Import from rboto_s3.exceptions:
Other service failures use the service base error; credential, transport and timeout failures use shared errors.