aliyun_oss_rs/bucket/
complete_bucket_worm.rs1use crate::{
2 Error,
3 error::normal_error,
4 request::{Oss, OssRequest},
5};
6use http::Method;
7
8pub struct CompleteBucketWorm {
12 req: OssRequest,
13}
14
15impl CompleteBucketWorm {
16 pub(super) fn new(oss: Oss, worm_id: impl ToString) -> Self {
17 let mut req = OssRequest::new(oss, Method::POST);
18 req.insert_query("wormId", worm_id.to_string());
19 req.insert_query("comp", "complete");
20 CompleteBucketWorm { req }
21 }
22
23 pub async fn send(self) -> Result<(), Error> {
25 let response = self.req.send_to_oss()?.await?;
26 match response.status() {
27 code if code.is_success() => Ok(()),
28 _ => Err(normal_error(response).await),
29 }
30 }
31}