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

Bucket Inventory - Logging.

Link to this section Summary

Functions

DeleteBucketLogging - deletes the logging configurations for a bucket.

GetBucketLogging - gets the access logging configuration of a bucket.

PutBucketLogging - enables logging for 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

delete(config, bucket)

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

DeleteBucketLogging - deletes the logging configurations for a 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(config, bucket)

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

GetBucketLogging - gets the access logging configuration of a 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(config, bucket, target_bucket, target_prefix \\ "oss-accesslog/")

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

PutBucketLogging - enables logging for a 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"}
  ]
}}