Skip to content

S3Client.rename_object

rboto-s3==0.4.0 · Service index · Types

Model summary (excerpt): Renames an existing object in a directory bucket that uses the S3 Express One Zone storage class. You can use RenameObject by specifying an existing object’s name as the source and the new name of the object as the destination within the same directory bucket. RenameObject is only supported for objects stored in the S3 Express One Zone storage class. To prevent overwriting an object, you can...

Install and imports

python -m pip install "rboto[s3]==0.4.0"
from rboto import S3Client
from rboto_s3.types import (
    RenameObjectOutput,
)

Signature

async def rename_object(
    *,
    bucket: str,
    key: str,
    rename_source: str,
    destination_if_match: str | None = None,
    destination_if_none_match: str | None = None,
    destination_if_modified_since: str | None = None,
    destination_if_unmodified_since: str | None = None,
    source_if_match: str | None = None,
    source_if_none_match: str | None = None,
    source_if_modified_since: str | None = None,
    source_if_unmodified_since: str | None = None,
    client_token: str | None = None,
) -> RenameObjectOutput: ...

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 of the directory bucket containing the object. 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 Availability Zone. Bucket names must follow the format bucket-base-name--zone-id--x-s3 (for example,...
key Yes Key name of the object to rename.
rename_source Yes Specifies the source for the rename operation. The value must be URL encoded.
destination_if_match No Renames the object only if the ETag (entity tag) value provided during the operation matches the ETag of the object in S3. The If-Match header field makes the request method conditional on ETags. If the ETag values do not match, the operation returns a 412 Precondition Failed error. Expects the ETag value as a string.
destination_if_none_match No Renames the object only if the destination does not already exist in the specified directory bucket. If the object does exist when you send a request with If-None-Match:* , the S3 API will return a 412 Precondition Failed error, preventing an overwrite. The If-None-Match header prevents overwrites of existing data by validating that there's not an object with the same key name already in your...
destination_if_modified_since No Renames the object if the destination exists and if it has been modified since the specified time.
destination_if_unmodified_since No Renames the object if it hasn't been modified since the specified time.
source_if_match No Renames the object if the source exists and if its entity tag (ETag) matches the specified ETag.
source_if_none_match No Renames the object if the source exists and if its entity tag (ETag) is different than the specified ETag. If an asterisk ( * ) character is provided, the operation will fail and return a 412 Precondition Failed error.
source_if_modified_since No Renames the object if the source exists and if it has been modified since the specified time.
source_if_unmodified_since No Renames the object if the source exists and hasn't been modified since the specified time.
client_token No A unique string with a max of 64 ASCII characters in the ASCII range of 33 - 126. RenameObject supports idempotency using a client token. To make an idempotent API request using RenameObject , specify a client token in the request. You should not reuse the same client token for other API requests. If you retry a request that completed successfully using the same client token and the same...

Output

RenameObjectOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

No fields.

| 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.

RenameObjectOutput

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.

Errors

Import from rboto_s3.exceptions:

IdempotencyParameterMismatchError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model