Skip to content

查看函数 info

Info 命令

info 命令是查看函数线上资源详情的命令。

命令解析

当执行命令info -h/info --help命令时,可以获取帮助文档。

参数解析

参数全称参数缩写Yaml模式下必填Cli模式下必填参数含义
region-选填必填地区,取值范围:cn-hangzhou, cn-beijing, cn-beijing, cn-hangzhou, cn-shanghai, cn-qingdao, cn-zhangjiakou, cn-huhehaote, cn-shenzhen, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, ap-south-1
service-name-选填必填服务名
function-name-选填选填函数名
trigger-name-选填选填触发器名

当前命令还支持部分全局参数(例如-a/--access, --debug等),详情可参考 Serverless Devs 全局参数文档

操作案例

  • 有资源描述文件(Yaml)时,可以直接执行s info获取函数详情;
  • 纯命令行形式(在没有资源描述 Yaml 文件时),需要根据需求,指定服务名,函数名等信息,例如s cli fc info --region cn-hangzhou --service-name fc-deploy-service --function-name http-trigger-py36

上述命令的执行结果示例:

fc-deploy-test:
region: cn-hangzhou
service:
name: fc-deploy-service
internetAccess: true
role: acs:ram::1583208943291465:role/aliyunfcdefaultrole
description: demo for fc-deploy component
logConfig:
logstore: fc-service-fc-deploy-service-logstore
project: 1583208943291465-cn-hangzhou-logproject
function:
name: http-trigger-py36
runtime: python3
handler: index.handler
timeout: 60
instanceType: e1
memorySize: 128
description: this is a test
initializationTimeout: 3
instanceConcurrency: 1
environmentVariables: {}
triggers:
- name: httpTrigger
type: http
config:
qualifier: null
authType: anonymous
methods:
- GET

如果需要只查询服务详情,只需要指定--service-name即可,例如执行命令s cli fc info --region cn-hangzhou --service-name fc-deploy-service的示例输出为:

region: cn-hangzhou
service:
name: fc-deploy-service
internetAccess: true
role: acs:ram::1583208943291465:role/aliyunfcdefaultrole
description: demo for fc-deploy component
logConfig:
logstore: fc-service-fc-deploy-service-logstore
project: 1583208943291465-cn-hangzhou-logproject

权限与策略说明

使用该命令时,推荐配置系统策略:AliyunFCReadOnlyAccess