pub async fn set_object_storage_class(
client: &Client,
bucket: &str,
key: &str,
new_class: String,
) -> Result<PutResult, AppError>Expand description
Change the storage class of bucket/key via a server-side self-copy.
S3 does not expose a dedicated “change storage class” API. The only
supported approach is a CopyObject from bucket/key back to itself
with StorageClass set to the new value and MetadataDirective::Copy
so the existing metadata and tags are preserved.
§Errors
AppError::Validation—new_classis not a recognised S3 storage class string (validation happens at the SDK builder level; unrecognised values pass through to S3 which returnsInvalidStorageClass).AppError::AccessDenied—s3:CopyObjectpermission denied.AppError::NotFound— bucket or key does not exist.AppError::RateLimited— throttling response from AWS.AppError::Network— any other SDK or transport error.
§Note: not optimistic (Decision D2)
Storage class change is a diff-gated mutation and is intentionally excluded
from EXCLUDED_FROM_OPTIMISM in src/query/optimistic.ts. The test
storage_class_change_does_not_use_optimistic_path asserts this invariant.