Aliyun.Oss.Bucket.Logging (aliyun_oss v1.0.3)
Bucket Logging 相关操作
Link to this section Summary
Functions
DeleteBucketLogging接口用于关闭bucket访问日志记录功能
GetBucketLogging 用于查看Bucket的访问日志配置情况。
PutBucketLogging接口用于为 Bucket 开启访问日志记录功能。
Link to this section Types
Link to this type
error()
Link to this section Functions
Link to this function
delete(bucket)
DeleteBucketLogging接口用于关闭bucket访问日志记录功能
examples
Examples
iex> Aliyun.Oss.Bucket.Logging.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"}
]
}}
iex> Aliyun.Oss.Bucket.Logging.delete("unknown-bucket")
{:error,
%Aliyun.Oss.Client.Error{
parsed_details: %{
"BucketName" => "unknown-bucket",
"Code" => "NoSuchBucket",
"HostId" => "unknown-bucket.oss-cn-shenzhen.aliyuncs.com",
"Message" => "The specified bucket does not exist.",
"RequestId" => "5C38283EC84D1C4471F2F48A"
},
body: "<?xml version="1.0" encoding="UTF-8"?>...</xml>",
status_code: 404
}}
Link to this function
get(bucket)
GetBucketLogging 用于查看Bucket的访问日志配置情况。
examples
Examples
iex> Aliyun.Oss.Bucket.Logging.get("some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"BucketLoggingStatus" => %{
"LoggingEnabled" => %{
"TargetBucket" => "some-bucket",
"TargetPrefix" => "oss-accesslog/"
}
}
},
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}
Link to this function
put(bucket, target_bucket, target_prefix \\ "oss-accesslog/")
@spec put(String.t(), String.t(), String.t()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
PutBucketLogging接口用于为 Bucket 开启访问日志记录功能。
examples
Examples
iex> Aliyun.Oss.Bucket.Logging.put("some-bucket", "target-bucket", "target-prefix")
{:ok,
%Aliyun.Oss.Client.Response{
data: "",
headers: [
{"Server", "AliyunOSS"},
{"Date", "Fri, 11 Jan 2019 05:05:50 GMT"},
{"Content-Length", "0"},
{"Connection", "keep-alive"},
{"x-oss-request-id", "5C0000000000000000000000"},
{"x-oss-server-time", "63"}
]
}}