Aliyun.Oss.Bucket.Encryption (aliyun_oss v1.0.0)

Bucket Encryption 相关操作

Link to this section Summary

Functions

DeleteBucketEncryption接口用于删除Bucket加密规则。

GetBucketEncryption 用于获取Bucket加密规则。

PutBucketEncryption接口用于配置Bucket的加密规则。

Link to this section Types

Specs

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

Link to this section Functions

Specs

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

DeleteBucketEncryption接口用于删除Bucket加密规则。

Examples

iex> Aliyun.Oss.Bucket.Encryption.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"}
  ]
}}

Specs

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

GetBucketEncryption 用于获取Bucket加密规则。

Examples

iex> Aliyun.Oss.Bucket.Encryption.get("some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
  data: %{
    "ServerSideEncryptionRule" => %{
      "ApplyServerSideEncryptionByDefault" => %{
        "SSEAlgorithm" => "AES256"
      }
    }
  },
  headers: [
    {"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
    ...
  ]
}}
Link to this function

put(bucket, opts \\ [])

Specs

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

PutBucketEncryption接口用于配置Bucket的加密规则。

Options

  • :algorithm - Accept value: :aes256, :kms, default is :aes256
  • :kms_master_key_id - Should and only be set if algorithm is :kms

Examples

iex> Aliyun.Oss.Bucket.Encryption.put("some-bucket", algorithm: :aes256)
{: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"}
  ]
}}