# `Aliyun.Oss.Bucket.WORM`

Bucket operations - Retention policy.

# `abort`

```elixir
@spec abort(Aliyun.Oss.Config.t(), String.t()) ::
  {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
```

AbortBucketWorm - deletes an unlocked retention policy.

## Examples

    iex> Aliyun.Oss.Bucket.WORM.abort("some-bucket", "report1")
    {:ok, %Aliyun.Oss.Client.Response{
      data: "",
      headers: %{
        "connection" => ["keep-alive],
        ...
      }
    }}

# `complete`

```elixir
@spec complete(Aliyun.Oss.Config.t(), String.t(), String.t()) ::
  {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
```

CompleteBucketWorm - locks a retention policy.

## Examples

    iex> Aliyun.Oss.Bucket.WORM.complete("some-bucket", "worm_id_1")
    {:ok, %Aliyun.Oss.Client.Response{
      data: "",
      headers: %{
        "connection" => ["keep-alive],
        ...
      }
    }}

# `extend`

```elixir
@spec extend(Aliyun.Oss.Config.t(), String.t(), String.t(), integer()) ::
  {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
```

ExtendBucketWorm - extends the retention period of objects in an bucket whose retention policy is locked.

## Examples

    iex> Aliyun.Oss.Bucket.WORM.extend("some-bucket", "worm_id_1")
    {:ok,
    %Aliyun.Oss.Client.Response{
      data: "",
      headers: %{
        "connection" => ["keep-alive],
        ...
      }
    }}

# `get`

```elixir
@spec get(Aliyun.Oss.Config.t(), String.t()) ::
  {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
```

GetBucketWorm - gets the retention policy configured for the specified bucket.

## Examples

    iex> Aliyun.Oss.Bucket.WORM.get("some-bucket")
    {:ok, %Aliyun.Oss.Client.Response{
      data: %{
        "WormConfiguration" => %{
          "CreationDate" => "2021-01-19T08:34:39.000Z",
          "ExpirationDate" => "2021-01-20T08:34:39.000Z",
          "RetentionPeriodInDays" => "1",
          "State" => "InProgress",
          "WormId" => "20000000000000000000000000000000"
        }
      },
      headers: %{
        "connection" => ["kee-alive],
        ...
      }
    }}

# `initiate`

```elixir
@spec initiate(Aliyun.Oss.Config.t(), String.t(), integer()) ::
  {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
```

InitiateBucketWorm - creates a retention policy.

## Examples

    iex> Aliyun.Oss.Bucket.WORM.initiate("some-bucket", 1)
    {:ok, %Aliyun.Oss.Client.Response{
      data: "",
      headers: %{
        "connection" => ["keep-alive"],
        "content-length" => ["0"],
        "date" => ["Tue, 08 Jul 2025 01:37:08 GMT"],
        "server" => ["AliyunOSS"],
        "x-oss-request-id" => ["686C70000000000000007373"],
        "x-oss-server-time" => ["44"],
        "x-oss-worm-id" => ["0E2910000000000000000000000F5D09"]
      }
    }}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
