层 layer
更新时间 2025-10-23 09:41:29
最近更新时间: 2025-10-23 09:41:29
layer命令管理函数的层。
layer publish 命令
发布层版本。
参数解析
| 参数全称 | 参数缩写 | Yaml 模式下必填 | Cli 模式下必填 | 参数含义 |
|---|---|---|---|---|
| region | - | 选填 | 必填 | 资源池ID,请参考资源池列表 |
| layer-name | - | 必填 | 必填 | 层名称 |
| description | 选填 | 选填 | 层描述 | |
| code | - | 必填 | 必填 | 层代码路径 |
| compatible-runtime | - | 必填 | 必填 | 支持的运行时,多个运行时使用,隔开 |
操作案例
Yaml 模式
进入到资源描述文件(s.yaml)所在的路径,然后执行如下命令发布层版本:
s layer publish --layer-name hello-layer --code ./code --compatible-runtime python3.6,python3.9,python3.10Cli 模式
直接执行如下命令发布层版本:
s cli faas-cf layer publish --layer-name hello-layer --code ./code --compatible-runtime python3.6,python3.9,python3.10 --region bb9fdb42056f11eda1610242ac110002执行完成输出示例:
acl: 0
code:
ossBucketName: xxxxxx
ossObjectName: xxxxxx
codeDigest:
snapshotOssObjectName:
zipFile:
codeChecksum: "0aa9cc96cdc10ad36bc9340c5047bc0f"
codesize: 186
compatibleRuntime:
- python3.6
- python3.9
- python3.10
createTime: 2025-09-01T15:22:21.190889+08:00
description:
layerName: hello-layer
version: 1
ctrn: ctrn:cf:xxxxxx:layers/hello-layer/versions/1layer version 命令
获取层版本。
参数解析
| 参数全称 | 参数缩写 | Yaml 模式下必填 | Cli 模式下必填 | 参数含义 |
|---|---|---|---|---|
| region | - | 选填 | 必填 | 资源池ID,请参考资源池列表 |
| layer-name | - | 必填 | 必填 | 层名称 |
| version-id | - | 必填 | 必填 | 层版本 |
| acl | - | 选填 | 选填 | ACL,0表示私有层,1表示公共层,默认为0 |
操作案例
Yaml 模式
进入到资源描述文件(s.yaml)所在的路径,然后执行如下命令获取层版本:
s layer version --layer-name hello-layer --acl 0 --version-id 1Cli 模式
直接执行如下命令获取层版本:
s cli faas-cf layer version --layer-name hello-layer --acl 0 --version-id 1 --region bb9fdb42056f11eda1610242ac110002执行完成输出示例:
acl: 0
region: bb9fdb42056f11eda1610242ac110002
code:
ossBucketName: xxxxxx
ossObjectName: xxxxxx
codeDigest:
snapshotOssObjectName:
zipFile:
codeChecksum: "0aa9cc96cdc10ad36bc9340c5047bc0f"
codeSize: 186
compatibleRuntime:
- python3.6
- python3.9
- python3.10
createTime: 2025-09-01T15:22:21.190889+08:00
description:
imageName: xxxxxx
layerName: hello-layer
license:
version: 1
ctrn: ctrn:cf:xxxxxx:layers/hello-layer/versions/1
buildStatus: falselayer versions 命令
获取层版本列表。
参数解析
| 参数全称 | 参数缩写 | Yaml 模式下必填 | Cli 模式下必填 | 参数含义 |
|---|---|---|---|---|
| region | - | 选填 | 必填 | 资源池ID,请参考资源池列表 |
| layer-name | - | 必填 | 必填 | 层名称 |
操作案例
Yaml 模式
进入到资源描述文件(s.yaml)所在的路径,然后执行如下命令获取层版本列表:
s layer versions --layer-name hello-layerCli 模式
直接执行如下命令获取层版本列表:
s cli faas-cf layer versions --layer-name hello-layer --region bb9fdb42056f11eda1610242ac110002执行完成输出示例:
-
acl: 0
region: bb9fdb42056f11eda1610242ac110002
code:
ossBucketName: xxxxxx
ossObjectName: xxxxxx
codeDigest:
snapshotOssObjectName:
zipFile:
codeChecksum: "0aa9cc96cdc10ad36bc9340c5047bc0f"
codeSize: 186
compatibleRuntime:
- python3.6
- python3.9
- python3.10
createTime: 2025-09-01T15:22:21.190889+08:00
description:
imageName: xxxxxx
layerName: hello-layer
license:
version: 1
ctrn: ctrn:cf:xxxxxx:layers/hello-layer/versions/1
buildStatus: truelayer list 命令
获取层列表。
参数解析
| 参数全称 | 参数缩写 | Yaml 模式下必填 | Cli 模式下必填 | 参数含义 |
|---|---|---|---|---|
| region | - | 选填 | 必填 | 资源池ID,请参考资源池列表 |
| page-index | - | 选填 | 选填 | 页码,默认为1 |
| page-size | 选填 | 选填 | 每页大小,默认为10 | |
| search | 选填 | 选填 | 搜索关键字 | |
| order | 选填 | 选填 | ASC表示升序,DESC表示降序,默认为DESC | |
| order-by | 选填 | 选填 | 排序字段,默认按创建时间 | |
| scope | 选填 | 选填 | all表示所有层,custom表示私有层,默认为all |
操作案例
Yaml 模式
进入到资源描述文件(s.yaml)所在的路径,然后执行如下命令获取层版本列表:
s layer list --scope customCli 模式
直接执行如下命令获取层版本列表:
s cli faas-cf layer list --scope custom --region bb9fdb42056f11eda1610242ac110002执行完成输出示例:
data:
-
acl: 0
region: bb9fdb42056f11eda1610242ac110002
code:
ossBucketName: xxxxxx
ossObjectName: xxxxxx
codeDigest:
snapshotOssObjectName:
zipFile:
codeChecksum: "7b920dfc76794de51a0f1748d453ac38"
codeSize: 229604
compatibleRuntime:
- Python 3.6
- Python 3.9
- Python 3.10
createTime: 2025-10-22T20:06:53.598306+08:00
description:
imageName: xxxxxx
layerName: hello-layer
license:
version: 1
ctrn: ctrn:cf:xxxxxx:layers/hello-layer/versions/1
tenantId: xxxxxx
buildStatus: false
-
acl: 0
region: bb9fdb42056f11eda1610242ac110002
code:
ossBucketName: xxxxxx
ossObjectName: xxxxxx
codeDigest:
snapshotOssObjectName:
zipFile:
codeChecksum: "3141979e2f07e559f16cffba1f81a6b9"
codeSize: 500732
compatibleRuntime:
- Python 3.9
- Python 3.10
createTime: 2025-09-11T11:50:10.139679+08:00
description: a test layer
imageName: xxxxxx
layerName: test-layer
license:
version: 1
ctrn: ctrn:cf:xxxxxx:layers/test-layer/versions/1
tenantId: xxxxxx
buildStatus: false
pagination:
pageIndex: 1
pageSize: 10
total: 2layer remove 命令
删除层或层版本。
参数解析
| 参数全称 | 参数缩写 | Yaml 模式下必填 | Cli 模式下必填 | 参数含义 |
|---|---|---|---|---|
| region | - | 选填 | 必填 | 资源池ID,请参考资源池列表 |
| layer-name | - | 必填 | 必填 | 层名称 |
| version-id | - | 选填 | 选填 | 层版本,若不指定或指定为0时删除当前层的所有版本 |
操作案例
Yaml 模式
进入到资源描述文件(s.yaml)所在的路径,然后执行如下命令删除层版本:
s layer remove --layer-name hello-layer --version-id 1Cli 模式
直接执行如下命令删除层版本:
s cli faas-cf layer remove --layer-name hello-layer --version-id 1 --region bb9fdb42056f11eda1610242ac110002执行完成输出示例:
result: success