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

Bucket operations - ACL.

Link to this section Summary

Functions

GetBucketAcl - gets the ACL of a bucket.

PutBucketACL - modifies the ACL of a bucket.

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

get(config, bucket)

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

GetBucketAcl - gets the ACL of a bucket.

examples

Examples

iex> Aliyun.Oss.Bucket.ACL.get("some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
    data: %{
      "AccessControlPolicy" => %{
        "AccessControlList" => %{"Grant" => "private"},
        "Owner" => %{"DislayName" => "11111111", "ID" => "11111111"}
      }
    },
    headers: [
      {"Date", "Wed, 05 Dec 2018 02:34:57 GMT"}
    ]
  }
}
Link to this function

put(config, bucket, acl)

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

PutBucketACL - modifies the ACL of a bucket.

examples

Examples

iex> Aliyun.Oss.Bucket.Acl.put("some-bucket", "public-read")
{:ok,
%Aliyun.Oss.Client.Response{
  data: "",
  headers: [
    {"Server", "AliyunOSS"},
    {"Date", "Fri, 11 Jan 2019 04:43:42 GMT"},
    {"Content-Length", "0"},
    {"Connection", "keep-alive"},
    {"x-oss-request-id", "5C0000000000000000000000"},
    {"Location", "/some-bucket"},
    {"x-oss-server-time", "333"}
  ]
}}
iex> Aliyun.Oss.Bucket.Acl.put("some-bucket", "invalid-permission")
{:error,
%Aliyun.Oss.Client.Error{
  parsed_details: %{
    "ArgumentName" => "x-oss-acl",
    "ArgumentValue" => "invalid-read",
    "Code" => "InvalidArgument",
    "HostId" => "some-bucket.oss-cn-shenzhen.aliyuncs.com",
    "Message" => "no such bucket access control exists",
    "RequestId" => "5C3000000000000000000000"
  },
  body: "<?xml version="1.0" encoding="UTF-8"?>...</xml>",
  status_code: 400
}}