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

Bucket operations - Versioning.

Summary

Functions

GetBucketVersioning - gets the versioning state of a bucket.

GetBucketVersions (ListObjectVersions) - lists the versions of all objects and delete markers in a bucket.

PutBucketVersioning - configures the versioning state for a bucket.

Functions

get(config, bucket)

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

GetBucketVersioning - gets the versioning state of a bucket.

Examples

iex> Aliyun.Oss.Bucket.Versioning.get("some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
  data: %{"VersioningConfiguration" => %{"Status" => "Enabled"}},
  headers: %{
    "connection" => ["keep-alive"],
    ...
  }
}}

list_object_versions(config, bucket, query_params \\ %{})

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

GetBucketVersions (ListObjectVersions) - lists the versions of all objects and delete markers in a bucket.

Examples

iex> Aliyun.Oss.Bucket.Versioning.list_object_versions("some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
  data: %{
    "ListVersionsResult" => %{
      "Delimiter" => nil,
      "DeleteMarker" => [
        %{
          "IsLatest" => "false",
          "Key" => "example",
          "LastModified" => "2019-04-09T07:27:28.000Z",
          "Owner" => %{
            "DisplayName" => "12345125285864390",
            "ID" => "1234512528586****"
          },
          "VersionId" => "CAEQMxiBgICAof2D0BYiIDJhMGE3N2M1YTI1NDQzOGY5NTkyNTI3MGYyMzJm****"
        },
      ],
      "IsTruncated" => true,
      "KeyMarker" => nil,
      "MaxKeys" => 100,
      "Name" => "some-bucket",
      "NextKeyMarker" => "docs/test2.txt",
      "NextVersionIdMarker" => "null",
      "Prefix" => nil,
      "Version" => [
        %{
          "ETag" => ""250F8A0AE989679A22926A875F0A2****"",
          "IsLatest" => "false",
          "Key" => "example",
          "LastModified" => "2019-04-09T07:27:28.000Z",
          "Owner" => %{
            "DisplayName" => "12345125285864390",
            "ID" => "1234512528586****"
          },
          "Size" => "93731",
          "StorageClass" => "Standard",
          "Type" => "Normal",
          "VersionId" => "CAEQMxiBgMDNoP2D0BYiIDE3MWUxNzgxZDQxNTRiODI5OGYwZGMwNGY3MzZjN****"
        },
        ...
      ],
      "VersionIdMarker" => nil,
    }
  },
  headers: %{
    "connection" => ["keep-alive"],
    ...
  }
}}

put(config, bucket, status)

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

PutBucketVersioning - configures the versioning state for a bucket.

Examples

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