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

Bucket operations - ACL.

Summary

Functions

GetBucketAcl - gets the ACL of a bucket.

PutBucketACL - modifies the ACL of a bucket.

Functions

get(config, bucket)

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

GetBucketAcl - gets the ACL of a bucket.

Examples

iex> Aliyun.Oss.Bucket.ACL.get(config, "some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
    data: %{
      "AccessControlPolicy" => %{
        "AccessControlList" => %{"Grant" => "private"},
        "Owner" => %{"DislayName" => "11111111", "ID" => "11111111"}
      }
    },
    headers: %{
      "connection" => ["keep-alive],
      ...
    }
  }
}

put(config, bucket, acl)

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

PutBucketACL - modifies the ACL of a bucket.

Examples

iex> Aliyun.Oss.Bucket.ACL.put(config, "some-bucket", "public-read")
{:ok,
%Aliyun.Oss.Client.Response{
  data: "",
  headers: %{
    "connection" => ["keep-alive"],
    "content-length" => ["0"],
    "date" => ["Tue, 08 Jul 2025 02:11:14 GMT"],
    "location" => ["/some-bucket"],
    "server" => ["AliyunOSS"],
    "x-oss-request-id" => ["686C00000000000000000D6B"],
    "x-oss-server-time" => ["479"]
  }
}}
iex> Aliyun.Oss.Bucket.ACL.put(config, "some-bucket", "invalid-permission")
{:error,
%Aliyun.Oss.Client.Error{
  status: 400,
  code: "InvalidArgument",
  message: "no such bucket access control exists",
  details: %{
    "ArgumentName" => "x-oss-acl",
    "ArgumentValue" => "invalid-permission",
    "Code" => "InvalidArgument",
    "EC" => "0015-00000204",
    "HostId" => "some-bucket.oss-cn-shenzhen.aliyuncs.com",
    "Message" => "no such bucket access control exists",
    "RecommendDoc" => "https://api.aliyun.com/troubleshoot?q=0015-00000204,
    "RequestId" => "5C3000000000000000000000"
  }
}}