Aliyun.Oss.Bucket.WORM (aliyun_oss v2.0.0)

Bucket operations - Retention policy.

Link to this section 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.

Link to this section Types

@type error() ::
  %Aliyun.Oss.Client.Error{
    body: String.t(),
    parsed_details: map(),
    status_code: integer()
  }
  | atom()

Link to this section Functions

Link to this function

abort(config, bucket)

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

AbortBucketWorm - deletes an unlocked retention policy.

examples

Examples

iex> Aliyun.Oss.Bucket.WORM.abort("some-bucket", "report1")
{:ok, %Aliyun.Oss.Client.Response{
  data: "",
  headers: [
    {"Server", "AliyunOSS"},
    ...
  ]
}}
Link to this function

complete(config, bucket, worm_id)

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

CompleteBucketWorm - locks a retention policy.

examples

Examples

iex> Aliyun.Oss.Bucket.WORM.complete("some-bucket", "worm_id_1")
{:ok, %Aliyun.Oss.Client.Response{
  data: "",
  headers: [
    {"Server", "AliyunOSS"},
    ...
  ]
}}
Link to this function

extend(config, bucket, worm_id, days)

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

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

examples

Examples

iex> Aliyun.Oss.Bucket.WORM.extend("some-bucket", "worm_id_1")
{:ok,
%Aliyun.Oss.Client.Response{
  data: "",
  headers: [
    {"Server", "AliyunOSS"},
    ...
  ]
}}
Link to this function

get(config, bucket)

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

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

examples

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: [
    {"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
    ...
  ]
}}
Link to this function

initiate(config, bucket, days)

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

InitiateBucketWorm - creates a retention policy.

examples

Examples

iex> Aliyun.Oss.Bucket.WORM.initiate("some-bucket", 1)
{:ok, %Aliyun.Oss.Client.Response{
  data: "",
  headers: [
    {"Server", "AliyunOSS"},
    {"x-oss-worm-id", "F0000000000000000000000000000000"},
    ...
  ]
}}