> For the complete documentation index, see [llms.txt](https://smallso.gitbook.io/tencent-cloud-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-functions/class-and-method/client/delete-layer.md).

# delete\_layer 方法

## 简要

删除一个已创建就绪的层或层的指定版本。

```python
def delete_layer(self,
    region_id: str,
    layer_name: str,
    layer_version: int = None
)
```

## 参数

该方法的参数和参数描述如下：

| 参数             | 类型  | 必选 | 描述                                                                                       |
| -------------- | --- | -- | ---------------------------------------------------------------------------------------- |
| region\_id     | str | 是  | <p>删除的层的数据中心唯一标识符。</p><p>例如：<code>ap-shanghai</code></p>                                 |
| layer\_name    | str | 是  | <p>删除的层的唯一名称。</p><p>例如：<code>default</code></p>                                          |
| layer\_version | int | 否  | <p>删除的层的版本编号。<br>如果该参数被忽略或设置为 <code>None</code>，默认批量删除所有层版本。</p><p>例如：<code>1</code></p> |

### 兼容性

在 Tencent Cloud SDK for Python 0.1.6 或更低版本中，参数 `layer_version` 必须提供。

## 返回值

该方法没有返回值。

## 异常

该方法可能会主动引发以下异常：

#### ValueError

参数值或类型不符合预期。

#### ActionError

Tencent Cloud API 错误。例如访问凭据无效、给定无服务器云函数不存在等均会引发该异常。

## 示例

下面我们将通过一段 Python 代码向您演示如何使用该方法：

```python
function_client.delete_layer(
    region_id = 'ap-shanghai',
    layer_name = 'default',
    layer_version = 1
)
```

## 适用于

#### Tencent Cloud SDK for Python

产品软件包：tencent-cloud-sdk-serverless-functions >= 0.1.6
