aliyun_oss_rs/bucket/
complete_bucket_worm.rs

1use crate::{
2    Error,
3    error::normal_error,
4    request::{Oss, OssRequest},
5};
6use http::Method;
7
8/// Complete a WORM retention configuration after locking the specified objects.
9///
10/// See the [Alibaba Cloud documentation](https://help.aliyun.com/zh/oss/developer-reference/completebucketworm) for details.
11pub 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    /// Send the request.
24    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}