You can call this operation to create a service.
Request headers
This operation uses only common request headers. For more information, see Common parameters.
Request structure
POST /services
Request parameters
Parameter | Type | Position | Required | Example | Description |
---|---|---|---|---|---|
Object | Body | No |
The definition of the service. |
||
description | String | Body | No | test_description |
The description of the service. |
internetAccess | Boolean | Body | No | true |
Specifies whether to allow functions to access the Internet. Valid values:
|
logConfig | LogConfig | Body | No |
The log configuration. This parameter specifies a Logstore to store function execution logs. |
|
nasConfig | NASConfig | Body | No |
The Apsara File Storage NAS (NAS) file system configuration. This parameter allows functions of the specified service to access the NAS file system. |
|
role | String | Body | No | acs:ram::19861****3743:role/fc-public-test |
The RAM role that is used to grant required permissions to Function Compute. The role is used in the following scenarios:
|
serviceName | String | Body | No | service_name |
The name of the service. |
vpcConfig | VPCConfig | Body | No |
The VPC configuration, which enables a function to access the specified VPC. |
|
tracingConfig | TracingConfig | Body | No |
The Tracing Analysis configuration. After Function Compute integrates with Tracing Analysis, you can record the stay time of a request in Function Compute, view the cold start time for a function, and record the execution time of a function. For more information, see Tracing analysis. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
ETag | String | e19d5cd5af0378da05f63f891c7467af |
The ETag value of the service name. This value is used to ensure that the modified service is consistent with the service to be modified. |
createdTime | String | 2020-04-03T05:57:28Z |
The time when the service was created. |
description | String | test_description |
The description of the service. |
internetAccess | Boolean | true |
Indicates whether functions were allowed to access the Internet. Valid values:
|
lastModifiedTime | String | 2020-04-03T05:57:28Z |
The time when the service was last updated. |
logConfig | LogConfig |
The log configuration. Function Compute writes function execution logs to the configured Logstore. |
|
nasConfig | NASConfig |
The Apsara File Storage NAS (NAS) file system configuration. This parameter allows functions of the specified service to access the NAS file system. |
|
role | String | acs:ram::19861****3743:role/fc-public-test |
The RAM role that is used to grant required permissions to Function Compute. The role is used in the following scenarios:
|
serviceId | String | c910061f-****-44e6-b659-***c |
The ID generated by the system for the service, which is unique in Function Compute. |
serviceName | String | service_name |
The name of the service. |
vpcConfig | VPCConfig |
The VPC configuration, which enables a function to access the specified VPC. |
|
tracingConfig | TracingConfig |
The Tracing Analysis configuration. After Function Compute integrates with Tracing Analysis, you can record the stay time of a request in Function Compute, view the cold start time for a function, and record the execution time of a function. For more information, see Tracing analysis. |
Examples
Sample requests
POST /2016-08-15/services HTTP/1.1
正常返回示例
JSON
格式
HTTP/1.1 200 OK 公共响应头 { "serviceName": "service_name", "description": "test_description", "role": "acs:ram::19861****3743:role/fc-public-test", "logConfig": { "project": "test_project", "logstore": "test_logstore" }, "serviceId": "c910061f-f6fa-44e6-b659-***c", "createdTime": "2020-04-03T05:57:28Z", "lastModifiedTime": "2020-04-03T05:57:28Z", "tracingConfig": { "params": { "endpoint": "http://tracing-*********-dc-sh-internal.aliyuncs.com/*****_iioe7jcnuk@***************_iioe7*****@******d2afe****/api/traces" }, "type": "Jaeger" }, "vpcConfig": { "vpcId": "vpc_***", "vSwitchIds": [ "vsw_***" ], "securityGroupId": "sg-bp18hj1wtxgy3***", "role": "acs:ram::19861****3743:role/fc-public-test" }, "internetAccess": true, "nasConfig": { "userId": 100, "groupId": 100, "mountPoints": [ { "serverAddr": "***-uni85.cn-hangzhou.nas.aliyuncs.com:/", "mountDir": "/home/test" } ] }, "vendorConfig": null }