Aliyun.Oss.Bucket.Inventory (aliyun_oss v3.3.0)

Bucket operations - Inventory.

Summary

Functions

DeleteBucketInventory - deletes a specified inventory task of a bucket.

GetBucketInventory - gets the specified inventory task configured for a bucket.

ListBucketInventory - gets all inventory tasks configured for a bucket.

PutBucketInventory - configures inventories for a bucket.

Functions

delete(config, bucket, inventory_id)

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

DeleteBucketInventory - deletes a specified inventory task of a bucket.

Examples

iex> Aliyun.Oss.Bucket.Inventory.delete(config, "some-bucket", "report1")
{:ok,
%Aliyun.Oss.Client.Response{
  data: "",
  headers: %{
    "connection" => ["keep-alive"],
    "content-length" => ["0"],
    "date" => ["Wed, 09 Jul 2025 01:50:11 GMT"],
    "server" => ["AliyunOSS"],
    "x-oss-request-id" => ["686DCAD31344************"],
    "x-oss-server-time" => ["33"]
  }
}}

get(config, bucket, inventory_id)

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

GetBucketInventory - gets the specified inventory task configured for a bucket.

Examples

iex> Aliyun.Oss.Bucket.Inventory.get(config, "some-bucket", "report1")
{:ok, %Aliyun.Oss.Client.Response{
  data: %{
    "InventoryConfiguration" => %{
      "Destination" => %{
        "OSSBucketDestination" => %{
          "AccountId" => "1000000000000000",
          "Bucket" => "acs:oss:::zidcn-test",
          "Format" => "CSV",
          "Prefix" => "inventory-report",
          "RoleArn" => "acs:ram::1000000000000000:role/AliyunOSSRole"
        }
      },
      "Filter" => %{"Prefix" => "prefix"},
      "Id" => "report1",
      "IncludedObjectVersions" => "Current",
      "IsEnabled" => "true",
      "OptionalFields" => %{
        "Field" => ["Size", "StorageClass", "LastModifiedDate", "ETag",
          "IsMultipartUploaded", "EncryptionStatus"]
      },
      "Schedule" => %{"Frequency" => "Weekly"}
    }
  },
  headers: %{
    "connection" => ["keep-alive"],
    ...
  }
}}

list(config, bucket, continuation_token \\ nil)

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

ListBucketInventory - gets all inventory tasks configured for a bucket.

Examples

iex> Aliyun.Oss.Bucket.Inventory.list(config, "some-bucket", "report1")
{:ok, %Aliyun.Oss.Client.Response{
  data: %{
    "ListInventoryConfigurationsResult" => %{
      "ContinuationToken" => "inventory2",
      "InventoryConfiguration" => [
        # ...
      ],
      "IsTruncated" => false
    }
  },
  headers: %{
    "connection" => ["keep-alive"],
    ...
  }
}}

put(config, bucket, inventory_id, config_xml)

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

PutBucketInventory - configures inventories for a bucket.

Examples

iex> config_xml = ~S[
    <?xml version="1.0" encoding="UTF-8"?>
    <InventoryConfiguration>
      <Id>inventory_id</Id>
      <IsEnabled>true</IsEnabled>
      ...
    </InventoryConfiguration>
]
iex> Aliyun.Oss.Bucket.Inventory.put(config, "some-bucket", "inventory_id", config_xml)
{:ok, %Aliyun.Oss.Client.Response{
  data: "",
  headers: %{
    "connection" => ["keep-alive"],
    ...
  }
}}