Aliyun.Oss.Bucket.Tags (aliyun_oss v3.2.0)

Bucket operations - Tags.

Summary

Functions

DeleteBucketTags - deletes tags configured for a bucket.

GetBucketTags - gets the tags configured for a bucket.

PutBucketTags - adds tags to a bucket or modifies the tags of a bucket.

Types

error()

@type error() ::
  %Aliyun.Oss.Client.Error{
    body: String.t(),
    parsed_details: map(),
    status_code: integer()
  }
  | atom()

Functions

delete(config, bucket)

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

DeleteBucketTags - deletes tags configured for a bucket.

Examples

iex> Aliyun.Oss.Bucket.Tags.delete(config, "some-bucket")
{:ok,
%Aliyun.Oss.Client.Response{
  data: "",
  headers: %{
    "connection" => ["keep-alive"],
    "content-length" => ["0"],
    "date" => ["Wed, 09 Jul 2025 05:47:50 GMT"],
    "server" => ["AliyunOSS"],
    "x-oss-request-id" => ["686E0285B630************"],
    "x-oss-server-time" => ["374"]
  }
}}
iex> Aliyun.Oss.Bucket.Tags.delete(config, "unknown-bucket")
{:error,
%Aliyun.Oss.Client.Error{
  parsed_details: %{
    "BucketName" => "unknown-bucket",
    "Code" => "NoSuchBucket",
    "EC" => "0015-00000101",
    "HostId" => "unknown-bucket.oss-cn-shenzhen.aliyuncs.com",
    "Message" => "The specified bucket does not exist.",
    "RecommendDoc" => "https://api.aliyun.com/troubleshoot?q=0015-00000101",
    "RequestId" => "5C38283EC84D1C4471F2F48A"
  },
  body: "<?xml version="1.0" encoding="UTF-8"?>...</xml>",
  status_code: 404
}}

get(config, bucket)

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

GetBucketTags - gets the tags configured for a bucket.

Examples

iex> Aliyun.Oss.Bucket.Tagging.get(config, "some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
    data: %{"Tagging" => %{"TagSet" => [%{"Key" => "key", "Value" => "value"}]}},
    headers: %{
      "connection" => ["keep-alive"],
      ...
    }
  }
}

put(config, bucket, tags)

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

PutBucketTags - adds tags to a bucket or modifies the tags of a bucket.

Examples

iex> Aliyun.Oss.Bucket.Tags.put(config, "some-bucket", [{"key1", "value1"}, {:key2, "value2}])
{:ok, %Aliyun.Oss.Client.Response{
    data: "",
    headers: %{
      "connection" => ["keep-alive"],
      "content-length" => ["0"],
      "date" => ["Wed, 09 Jul 2025 05:46:16 GMT"],
      "server" => ["AliyunOSS"],
      "x-oss-request-id" => ["686E0227B63*************"],
      "x-oss-server-time" => ["393"]
    }
  }
}