The FC component is a tool that is developed based on Serverless Devs in Function Compute. With this tool, you can run interactive commands to call the Function Compute API.
Prerequisites
Before you start, make sure that the following operations are performed:
Create a version
Command syntax:
sudo s cli fc api PublishServiceVersion --region <regionid> --access <accessname> --apiVersion <20210406 or 20160815> --path '{"serviceName": "serviceName"}' --body '{"description": "description"}'
Parameters:
(Required) --region string: the region in which you want to deploy resources.
(Optional) --access string or -a string: the alias of the key to be used.
(Optional) --apiVersion: the API version. Valid values: 20210416 and 20160815.
path
(Required) --serviceName string: the service name.
body
(Optional) --description string: the description of the service version.
Sample code:
sudo s cli fc api PublishServiceVersion --region cn-hangzhou --access default --path '{"serviceName": "mytest"}' --body '{"description": "myversion"}'
For more information about the API operation for creating a version, see PublishServiceVersion.
Delete a version
Command syntax:
sudo s cli fc api DeleteServiceVersion --region <regionid> --access <accessname> --apiVersion <20210406 or 20160815> --path '{"serviceName": "serviceName","versionId": "versionId"}'
Parameters:
(Required) --region string: the region in which you want to deploy resources.
(Optional) --access string or -a string: the alias of the key to be used.
(Optional) --apiVersion: the API version. Valid values: 20210416 and 20160815.
path
(Required) --serviceName string: the service name.
(Required) --versionId string: the version of the service.
Sample code:
sudo s cli fc api DeleteServiceVersion --region cn-hangzhou --access default --path '{"serviceName": "mytest","versionId": 1}'
For more information about the API operation for deleting a version, see DeleteServiceVersion.
Query versions
Command syntax:
sudo s cli fc api ListServiceVersions --region <regionid> --access <accessname> --apiVersion <20210406 or 20160815> --path '{"serviceName": "serviceName"}' --query '{"limit": "limit number","nextToken": "nextresult","startkey": "startkey","direction": "FORWARD or BACKWARD"}'
Parameters:
(Required) --region string: the region in which you want to deploy resources.
(Optional) --access string or -a string: the alias of the key to be used.
(Optional) --apiVersion: the API version. Valid values: 20210416 and 20160815.
path
(Required) --serviceName string: the service name.
query
(Optional) --limit string: the number of resources to return.
(Optional) --nextToken string: the token that you can use to return more results. Include this parameter in subsequent invocations to obtain more results. You do not need to provide this parameter in the first invocation.
(Optional) --startKey string: specifies that results are returned alphabetically starting from the first after startKey (including startKey).
(Optional) direction string: the sorting direction of the returned versions. Valid values: FORWARD (ascending order) and BACKWARD (descending order). Default value: BACKWARD.
Sample code:
sudo s cli fc api ListServiceVersions --region cn-hangzhou --access default --path '{"serviceName": "mytest"}' --query '{"limit": "10","direction": "FORWARD"}'
For more information about the API operation for querying versions, see ListServiceVersions.