Feature Description
Hi team, I think S3 has already supported conditional copy via if-none-match / if-match header (same as conditional write request headers). But I don't think it's currently supported
|
pub async fn s3_copy_object(&self, from: &str, to: &str) -> Result<Response<Buffer>> { |
|
let from = build_abs_path(&self.root, from); |
|
let to = build_abs_path(&self.root, to); |
|
|
|
let source = format!("{}/{}", self.bucket, percent_encode_path(&from)); |
|
let target = format!("{}/{}", self.endpoint, percent_encode_path(&to)); |
|
|
|
let mut req = Request::put(&target); |
|
|
|
// Set SSE headers. |
|
req = self.insert_sse_headers(req, true); |
|
|
|
if let Some(v) = &self.server_side_encryption_customer_algorithm { |
|
let mut v = v.clone(); |
|
v.set_sensitive(true); |
|
|
|
req = req.header( |
|
HeaderName::from_static( |
|
constants::X_AMZ_COPY_SOURCE_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM, |
|
), |
|
v, |
|
) |
|
} |
|
|
|
if let Some(v) = &self.server_side_encryption_customer_key { |
|
let mut v = v.clone(); |
|
v.set_sensitive(true); |
|
|
|
req = req.header( |
|
HeaderName::from_static( |
|
constants::X_AMZ_COPY_SOURCE_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY, |
|
), |
|
v, |
|
) |
|
} |
|
|
|
if let Some(v) = &self.server_side_encryption_customer_key_md5 { |
|
let mut v = v.clone(); |
|
v.set_sensitive(true); |
|
|
|
req = req.header( |
|
HeaderName::from_static( |
|
constants::X_AMZ_COPY_SOURCE_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5, |
|
), |
|
v, |
|
) |
|
} |
|
|
|
// Set request payer header if enabled. |
|
req = self.insert_request_payer_header(req); |
|
|
|
let req = req |
|
// Inject operation to the request. |
|
.extension(Operation::Copy) |
|
.extension(ServiceOperation("CopyObject")) |
|
.header(constants::X_AMZ_COPY_SOURCE, &source) |
|
.body(Buffer::new()) |
|
.map_err(new_request_build_error)?; |
|
|
|
self.send(req).await |
|
} |
Problem and Solution
Add support for conditional copy
Additional Context
No response
Are you willing to contribute to the development of this feature?
Feature Description
Hi team, I think S3 has already supported conditional copy via if-none-match / if-match header (same as conditional write request headers). But I don't think it's currently supported
opendal/core/services/s3/src/core.rs
Lines 651 to 711 in 4196c1f
Problem and Solution
Add support for conditional copy
Additional Context
No response
Are you willing to contribute to the development of this feature?