Aliyun.Oss.Bucket.WORM (aliyun_oss v3.3.0)

Bucket operations - Retention policy.

Summary

Functions

AbortBucketWorm - deletes an unlocked retention policy.

CompleteBucketWorm - locks a retention policy.

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

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

InitiateBucketWorm - creates a retention policy.

Functions

abort(config, bucket)

@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(config, bucket, worm_id)

@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(config, bucket, worm_id, days)

@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(config, bucket)

@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(config, bucket, days)

@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"]
  }
}}