Aliyun.Oss.Bucket.Policy (aliyun_oss v2.0.0)
Bucket operations - Authorization policy.
Link to this section Summary
Functions
DeleteBucketPolicy - deletes the policies configured for a specified bucket.
GetBucketPolicy - gets the policies configured for a specified bucket.
PutBucketPolicy - configures policies for a specified bucket.
Link to this section Types
Link to this type
error()
Link to this section Functions
Link to this function
delete(config, bucket)
@spec delete(Aliyun.Oss.Config.t(), String.t()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
DeleteBucketPolicy - deletes the policies configured for a specified bucket.
examples
Examples
iex> Aliyun.Oss.Bucket.Policy.delete("some-bucket")
{:ok,
%Aliyun.Oss.Client.Response{
data: "",
headers: [
{"Server", "AliyunOSS"},
{"Date", "Fri, 11 Jan 2019 05:19:45 GMT"},
{"Content-Length", "0"},
{"Connection", "keep-alive"},
{"x-oss-request-id", "5C3000000000000000000000"},
{"x-oss-server-time", "90"}
]
}}
Link to this function
get(config, bucket)
@spec get(Aliyun.Oss.Config.t(), String.t()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
GetBucketPolicy - gets the policies configured for a specified bucket.
examples
Examples
iex> Aliyun.Oss.Bucket.Policy.get("some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"Statement" => [
%{
"Action" => ["oss:PutObject", "oss:GetObject"],
"Effect" => "Deny",
"Principal" => ["1234567890"],
"Resource" => ["acs:oss:*:1234567890:*/*"]
}
],
"Version" => "1"
},
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}
Link to this function
put(config, bucket, policy)
@spec put(Aliyun.Oss.Config.t(), String.t(), map()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
PutBucketPolicy - configures policies for a specified bucket.
examples
Examples
iex> policy = %{
"Statement" => [
%{
"Action" => ["oss:PutObject", "oss:GetObject"],
"Effect" => "Deny",
"Principal" => ["1234567890"],
"Resource" => ["acs:oss:*:1234567890:*/*"]
}
],
"Version" => "1"
}
iex> Aliyun.Oss.Bucket.Policy.put("some-bucket", policy)
{:ok, %Aliyun.Oss.Client.Response{
data: "",
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}