# `Aliyun.Oss.Bucket.Encryption`

Bucket operations - Encryption.

# `delete`

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

DeleteBucketEncryption - deletes encryption rules configured for a bucket.

## Examples

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

# `get`

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

GetBucketEncryption - gets the encryption rules configured for a bucket.

## Examples

    iex> Aliyun.Oss.Bucket.Encryption.get(config, "some-bucket")
    {:ok, %Aliyun.Oss.Client.Response{
      data: %{
        "ServerSideEncryptionRule" => %{
          "ApplyServerSideEncryptionByDefault" => %{
            "SSEAlgorithm" => "AES256"
          }
        }
      },
      headers: %{
        "connection" => ["keep-alive"],
        ...
      }
    }}

# `put`

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

PutBucketEncryption - configures encryption rules for a bucket.

## Options

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

## Examples

    iex> Aliyun.Oss.Bucket.Encryption.put(config, "some-bucket", algorithm: :aes256)
    {:ok,
    %Aliyun.Oss.Client.Response{
      data: "",
      headers: %{
        "connection" => ["keep-alive"],
        "content-length" => ["0"],
        "date" => ["Wed, 09 Jul 2025 06:44:24 GMT"],
        "server" => ["AliyunOSS"],
        "x-oss-request-id" => ["686E0FC88A**************"],
        "x-oss-server-time" => ["50"]
      }
    }}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
