Aliyun.Oss.Bucket.Inventory (aliyun_oss v2.0.0)
Bucket operations - Inventory.
Link to this section 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.
Link to this section Types
Link to this type
error()
Link to this section Functions
Link to this function
delete(config, bucket, inventory_id)
@spec delete(Aliyun.Oss.Config.t(), String.t(), String.t()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
DeleteBucketInventory - deletes a specified inventory task of a bucket.
examples
Examples
iex> Aliyun.Oss.Bucket.Inventory.delete("some-bucket", "report1")
{: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, inventory_id)
@spec get(Aliyun.Oss.Config.t(), String.t(), String.t()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
GetBucketInventory - gets the specified inventory task configured for a bucket.
examples
Examples
iex> Aliyun.Oss.Bucket.Inventory.get("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: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}
Link to this function
list(config, bucket, continuation_token \\ nil)
@spec list(Aliyun.Oss.Config.t(), String.t(), nil | String.t()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
ListBucketInventory - gets all inventory tasks configured for a bucket.
examples
Examples
iex> Aliyun.Oss.Bucket.Inventory.list("some-bucket", "report1")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"ListInventoryConfigurationsResult" => %{
"ContinuationToken" => "inventory2",
"InventoryConfiguration" => [
# ...
],
"IsTruncated" => false
}
},
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}
Link to this function
put(config, bucket, inventory_id, config)
@spec put(Aliyun.Oss.Config.t(), String.t(), String.t(), String.t() | map()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
PutBucketInventory - configures inventories for a bucket.
examples
Examples
iex> config_json = %{
"InventoryConfiguration" => %{
"Destination" => %{
"OSSBucketDestination" => %{
"AccountId" => "100000000000000",
"Bucket" => "acs:oss:::bucket_0001",
"Encryption" => %{"SSE-KMS" => %{"KeyId" => "keyId"}},
"Format" => "CSV",
"Prefix" => "prefix1",
"RoleArn" => "acs:ram::100000000000000:role/AliyunOSSRole"
}
},
"Filter" => %{"Prefix" => "Pics"},
"Id" => "56594298207FB304438516F9",
"IncludedObjectVersions" => "All",
"IsEnabled" => "true",
"OptionalFields" => %{
"Field" => ["Size", "LastModifiedDate", "ETag", "StorageClass",
"IsMultipartUploaded", "EncryptionStatus"]
},
"Schedule" => %{"Frequency" => "Daily"}
}
}
iex> Aliyun.Oss.Bucket.Inventory.put("some-bucket", "inventory_id", config_json)
{:ok, %Aliyun.Oss.Client.Response{
data: "",
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}
iex> config_xml = ~S[
<?xml version="1.0" encoding="UTF-8"?>
<InventoryConfiguration>
<Id>56594298207FB304438516F9</Id>
<IsEnabled>true</IsEnabled>
...
</InventoryConfiguration>
]
iex> Aliyun.Oss.Bucket.Inventory.put("some-bucket", "inventory_id", config_xml)
{:ok, %Aliyun.Oss.Client.Response{
data: "",
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}}