
# 删除在线解压策略
#### 功能介绍
桶拥有者或拥有删除在线解压策略权限的用户可通过本接口删除指定桶中配置的文件解压策略，删除成功status code返回值为204。
#### 接口约束
- 您必须是桶拥有者或拥有删除在线解压策略的权限，才能调用本接口，建议使用IAM或桶策略进行授权。了解更多OBS授权方式请参见[OBS不同权限控制方式的区别](https://support.huaweicloud.com/perms-cfg-obs/obs_40_0001.html)。
- OBS支持的Region与Endpoint的对应关系，详细信息请参见[地区与终端节点](https://developer.huaweicloud.com/endpoint?OBS)。
 
#### 方法定义
**func** (obsClient ObsClient) DeleteBucketDecompression(input \*[DeleteBucketDecompressionInput], extensions ...extensionOptions) (output \*[BaseModel], err error)
#### 请求参数说明
 表1请求参数列表 
| **参数名称**   | **参数类型**                                                                             | **是否必选** | **描述**                                                                                                                                                             |
|:---|:---|:---|:---|
| input      | \*[DeleteBucketDecompressionInput]                      | 必选       | **参数解释：** 删除在线解压策略请求参数，详见[DeleteBucketDecompressionInput]。                                             |
| extensions | [extensionOptions](https://support.huaweicloud.com/sdk-go-devg-obs/obs_33_0105.html) | 可选       | **参数解释：** 桶相关扩展信息。通过调用拓展配置项为对应请求配置额外的拓展请求头，详情参考[extensionOptions](https://support.huaweicloud.com/sdk-go-devg-obs/obs_33_0105.html)。 |
   
 表2DeleteBucketDecompressionInput 
| **参数名称** | **参数类型** | **是否必选** | **描述**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|:---|
| Bucket   | string   | 必选       | **参数解释** **：** 桶名。 **约束限制：** - 桶命名规则如下： - 需全局唯一，不能与已有的任何桶名称重复，包括其他用户创建的桶。用户删除桶后，立即创建同名桶或并行文件系统会创建失败，需要等待30分钟才能创建。  - 长度范围为3到63个字符，仅支持小写字母、数字、中划线（-）、英文句号（.）。  - 禁止两个英文句号（.）相邻，禁止英文句号（.）和中划线（-）相邻，禁止以英文句号（.）和中划线（-）开头或结尾。  - 禁止使用IP地址。    - 同一用户在同一个区域多次创建同名桶不会报错，创建的桶属性以第一次请求为准。   **默认取值：** 无 |
   
#### 返回结果说明
表3返回结果列表 
| **参数名称** | **参数类型**                                     | **描述**                                                                                       |
|:---|:---|:---|
| output   | \*[BaseModel] | **参数解释：** 接口返回信息，详见[BaseModel]。 |
| err      | error                                        | **参数解释：** 接口返回错误信息。                                           |
   
 表4BaseModel 
| **参数名称**        | **参数类型**                | **描述**                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|
| StatusCode      | int                     | **参数解释：** HTTP状态码。 **约束限制：** 无 **取值范围：** 状态码是一组从2xx（成功）到4xx或5xx（错误）的数字代码，状态码表示了请求响应的状态。完整的状态码列表请参见[状态码](https://support.huaweicloud.com/api-obs/obs_04_0114.html)。 **默认取值：** 无 |
| RequestId       | string                  | **参数解释：** OBS服务端返回的请求ID。 **约束限制：** 无 **取值范围：** 无 **默认取值：** 无                                                                                                                      |
| ResponseHeaders | map\[string\]\[\]string | **参数解释：** HTTP响应头信息。 **约束限制：** 无 **取值范围：** 无 **默认取值：** 无                                                                                                                      |
   
#### 代码示例
本示例用于删除examplebucket桶的在线解压策略。
```
package main
import (
    "fmt"
    "os"
)
func main() {
    // 推荐通过环境变量获取AKSK，这里也可以使用其他外部引入方式传入，如果使用硬编码可能会存在泄露风险。
    // 您可以登录访问管理控制台获取访问密钥AK/SK。
    ak := os.Getenv("AccessKeyID")
    sk := os.Getenv("SecretAccessKey")
    // 【可选】如果使用临时AK/SK和SecurityToken访问OBS，同样建议您尽量避免使用硬编码，以降低信息泄露风险。您可以通过环境变量获取访问密钥AK/SK，也可以使用其他外部引入方式传入。
    securityToken := os.Getenv("SecurityToken")
    // endpoint填写Bucket对应的Endpoint，这里以华北-北京四为例，其他地区请按实际情况填写。
    endPoint := "https://obs.cn-north-4.myhuaweicloud.com"
    // 创建obsClient实例
    // 如果使用临时AKSK和SecurityToken访问OBS，需要在创建实例时通过obs.WithSecurityToken方法指定securityToken值。
    obsClient, err := obs.New(ak, sk, endPoint, obs.WithSecurityToken(securityToken))
    if err != nil {
        fmt.Printf("Create obsClient error, errMsg: %s", err.Error())
    }
    input := &obs.DeleteBucketDecompressionInput{}
    // 指定存储桶名称
    input.Bucket = "examplebucket"
    // 删除桶的在线解压策略
    output, err := obsClient.DeleteBucketDecompression(input)
    if err == nil {
        fmt.Printf("Delete bucket(%s)'s decompression policy successful!\n", input.Bucket)
        fmt.Printf("RequestId:%s\n", output.RequestId)
        return
    }
    fmt.Printf("Delete bucket(%s)'s decompression policy fail!\n", input.Bucket)
    if obsError, ok := err.(obs.ObsError); ok {
        fmt.Println("An ObsError was found, which means your request sent to OBS was rejected with an error response.")
        fmt.Println(obsError.Error())
    } else {
        fmt.Println("An Exception was found, which means the client encountered an internal problem when attempting to communicate with OBS, for example, the client was unable to access the network.")
        fmt.Println(err)
    }
}
```
#### 相关链接
- 关于删除在线解压策略的API说明，请参见[删除在线解压策略](https://support.huaweicloud.com/api-obs/obs_04_0150.html)。
- 删除在线解压策略过程中返回的错误码含义、问题原因及处理措施可参考[OBS错误码](https://support.huaweicloud.com/api-obs/obs_04_0115.html#section1)。
- 删除在线解压策略相关问题请参见[在线解压](https://support.huaweicloud.com/usermanual-obs/obs_03_0368.html)。
 
