async def presigned_delete_object(
self,
bucket: "capo_s3.types.bucket_name.BucketName",
key: "capo_s3.types.object_key.ObjectKey",
expire_in: int = 3600,
*,
config_overrides: Optional[AsyncS3ClientConfig] = None,
mfa: Optional["capo_s3.types.mfa.MFA"] = None,
version_id: Optional["capo_s3.types.object_version_id.ObjectVersionId"] = None,
request_payer: Optional["capo_s3.types.request_payer.RequestPayer"] = None,
bypass_governance_retention: Optional[
"capo_s3.types.bypass_governance_retention.BypassGovernanceRetention"
] = None,
expected_bucket_owner: Optional["capo_s3.types.account_id.AccountId"] = None,
if_match: Optional["capo_s3.types.if_match.IfMatch"] = None,
if_match_last_modified_time: Optional[
"capo_s3.types.if_match_last_modified_time.IfMatchLastModifiedTime"
] = None,
if_match_size: Optional["capo_s3.types.if_match_size.IfMatchSize"] = None,
) -> str:
_, options_ = self.operation_options(config_overrides)
input_: "capo_s3.types.delete_object_request.DeleteObjectRequest" = {
"bucket": bucket,
"key": key,
}
if mfa is not None:
input_["mfa"] = mfa
if version_id is not None:
input_["version_id"] = version_id
if request_payer is not None:
input_["request_payer"] = request_payer
if bypass_governance_retention is not None:
input_["bypass_governance_retention"] = bypass_governance_retention
if expected_bucket_owner is not None:
input_["expected_bucket_owner"] = expected_bucket_owner
if if_match is not None:
input_["if_match"] = if_match
if if_match_last_modified_time is not None:
input_["if_match_last_modified_time"] = if_match_last_modified_time
if if_match_size is not None:
input_["if_match_size"] = if_match_size
import capo_s3._operations.amazon_s3.delete_object
request = capo_s3._operations.amazon_s3.delete_object.build_request(
options_, input_
)
request = strip_checksum_headers(request)
signer = (request.context or {}).get("signer")
if not isinstance(signer, SigV4Signer):
raise RuntimeError("presign requires SigV4 credentials")
creds = await signer.provider.aresolve_identity()
ctx: capo_s3._auth._sigv4.SigV4AuthContext = {
"type": "sig_v4",
"access_key_id": creds["access_key"],
"secret_access_key": creds["secret_key"],
"session_token": creds.get("session_token"),
"signing_region": signer._auth_scheme["signingRegion"],
"signing_name": signer._auth_scheme["signingName"],
"disable_double_encoding": signer._auth_scheme.get(
"disableDoubleEncoding", False
),
"disable_normalize_path": signer._auth_scheme.get(
"disableNormalizePath", False
),
}
return str(presign_sigv4(request, ctx, expires_in=expire_in).url)