Custom domain name-related commands
The FC component is an operation tool for Alibaba Cloud Function Compute (FC) built on Serverless Devs. Use it to manage custom domain names by running CLI commands that call the underlying FC API operations directly.
Prerequisites
Before you begin, ensure that you have:
Create a custom domain name
Synopsis:
sudo s cli fc api CreateCustomDomain \
--region <region-id> \
[--access <access-name>] \
[--apiVersion <20210416 | 20160815>] \
--body '{"domainName": "<domain-name>", "protocol": "<protocol-type>", "certConfig": "<cert-config>", "routeConfig": "<route-config>"}'Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where resources are deployed. Example: cn-hangzhou |
--access / -a | No | The alias of the key to use |
--apiVersion | No | The API version. Valid values: 20210416, 20160815 |
--body.domainName | Yes | The custom domain name |
--body.protocol | Yes | The protocol type. Valid values: HTTP, HTTP,HTTPS |
--body.certConfig | Yes | The HTTPS certificate configuration |
--body.routeConfig | Yes | The route table that maps request paths to functions |
Example:
To create a custom domain name with an HTTP route to a function:
sudo s cli fc api CreateCustomDomain \
--region cn-hangzhou \
--apiVersion 20210416 \
--body '{
"domainName": "41055826-1034354682****.example.com",
"routeConfig": {
"routes": [{
"path": "/login/*",
"serviceName": "mytest",
"functionName": "mytest",
"qualifier": "LATEST"
}]
}
}'For the full API reference, see CreateCustomDomain.
Delete a custom domain name
Synopsis:
sudo s cli fc api DeleteCustomDomain \
--region <region-id> \
[--access <access-name>] \
[--apiVersion <20210416 | 20160815>] \
--path '{"domainName": "<domain-name>"}'Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where resources are deployed. Example: cn-hangzhou |
--access / -a | No | The alias of the key to use |
--apiVersion | No | The API version. Valid values: 20210416, 20160815 |
--path.domainName | Yes | The custom domain name to delete |
Example:
To delete a custom domain name:
sudo s cli fc api DeleteCustomDomain \
--region cn-hangzhou \
--path '{"domainName": "41055826-1034354682****.example.com"}'For the full API reference, see DeleteCustomDomain.
Update a custom domain name
Synopsis:
sudo s cli fc api UpdateCustomDomain \
--region <region-id> \
[--access <access-name>] \
[--apiVersion <20210416 | 20160815>] \
--path '{"domainName": "<domain-name>"}' \
--body '{"protocol": "<protocol-type>", "certConfig": "<cert-config>", "routeConfig": "<route-config>"}'Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where resources are deployed. Example: cn-hangzhou |
--access / -a | No | The alias of the key to use |
--apiVersion | No | The API version. Valid values: 20210416, 20160815 |
--path.domainName | Yes | The custom domain name to update |
--body.protocol | Yes | The protocol type. Valid values: HTTP, HTTP,HTTPS |
--body.certConfig | Yes | The HTTPS certificate configuration |
--body.routeConfig | Yes | The route table that maps request paths to functions |
Example:
To update the route configuration of a custom domain name:
sudo s cli fc api UpdateCustomDomain \
--region cn-hangzhou \
--access default \
--apiVersion 20210416 \
--path '{"domainName": "41055826-1034354682****.example.com"}' \
--body '{
"routeConfig": {
"routes": [{
"path": "/login/*",
"serviceName": "mytest",
"functionName": "mytest",
"qualifier": "LATEST"
}]
}
}'For the full API reference, see UpdateCustomDomain.
Query a custom domain name
Synopsis:
sudo s cli fc api GetCustomDomain \
--region <region-id> \
[--access <access-name>] \
[--apiVersion <20210416 | 20160815>] \
--path '{"domainName": "<domain-name>"}'Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where resources are deployed. Example: cn-hangzhou |
--access / -a | No | The alias of the key to use |
--apiVersion | No | The API version. Valid values: 20210416, 20160815 |
--path.domainName | Yes | The custom domain name to query |
Example:
To query the details of a custom domain name:
sudo s cli fc api GetCustomDomain \
--region cn-hangzhou \
--path '{"domainName": "41055826-1034354682****.example.com"}'For the full API reference, see GetCustomDomain.
List custom domain names
Synopsis:
sudo s cli fc api ListCustomDomains \
--region <region-id> \
[--access <access-name>] \
[--apiVersion <20210416 | 20160815>] \
[--query '{"limit": "<limit>", "nextToken": "<token>", "prefix": "<prefix>", "startKey": "<start-key>"}']Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where resources are deployed. Example: cn-hangzhou |
--access / -a | No | The alias of the key to use |
--apiVersion | No | The API version. Valid values: 20210416, 20160815 |
--query.limit | No | The maximum number of results to return |
--query.nextToken | No | The pagination token from a previous response. Omit in the first request |
--query.prefix | No | Filters results to domain names that start with this prefix |
--query.startKey | No | Returns results alphabetically starting from this key (inclusive) |
Example:
To list the first 10 custom domain names in a region:
sudo s cli fc api ListCustomDomains \
--region cn-hangzhou \
--query '{"limit": "10"}'For the full API reference, see ListCustomDomains.