Creates a service.
Request headers
This operation uses only common request headers. For more information, see Common parameters.
Request syntax
POST /services HTTP/1.1
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. Function Compute writes function execution logs to the specified Logstore. |
|
nasConfig | NASConfig | Body | No | The configurations of the Apsara File Storage NAS (NAS) file system. The configurations allow functions to access the specified NAS resources. |
|
role | String | Body | No | acs:ram::198613743****:role/fc-public-test | The RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:
|
serviceName | String | Body | Yes | service_name | The name of the service. The service name can only contain letters, digits, underscores (_), and hyphens (-). It cannot start with a digit or hyphen (-) and must be 1 to 128 characters in length. |
vpcConfig | VPCConfig | Body | No | The virtual private cloud (VPC) configuration, which allows functions in the specified service in Function Compute to access the specified VPC. |
|
tracingConfig | TracingConfig | Body | No | The configurations of Managed Service for OpenTelemetry. After you configure Managed Service for OpenTelemetry for a service in Function Compute, you can record the time required to run a requested function, view the cold start time for a function, and record the time required to run a function. For more information, see Overview. |
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 | Specifies whether to allow functions to access the Internet. Valid values:
|
lastModifiedTime | String | 2020-04-03T05:57:28Z | The last time when the service was updated. |
logConfig | LogConfig | The logging configuration. Function Compute writes function execution logs to the specified Logstore. |
|
nasConfig | NASConfig | The configurations of the NAS file system. The configurations allow functions to access the specified NAS resources. |
|
role | String | acs:ram::198613743****:role/fc-public-test | The RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:
|
serviceId | String | c910061f-****-44e6-b659-***c | The unique ID generated by the system for the service. |
serviceName | String | service_name | The name of the service. |
vpcConfig | VPCConfig | The VPC configuration. The configuration allows a function to access the specified VPC. |
|
tracingConfig | TracingConfig | The configurations of Managed Service for OpenTelemetry. After you configure Managed Service for OpenTelemetry for a service in Function Compute, you can record the time required to run a requested function, view the cold start time for a function, and record the time required to run a function. For more information, see Overview. |
Examples
Sample requests
POST /2016-08-15/services HTTP/1.1
Common request headers
{
"description" : "test_description",
"internetAccess" : true,
"logConfig" : {
"logstore" : "test-prj",
"project" : "test-logstore",
"enableRequestMetrics" : true,
"logBeginRule" : "DefaultRegex"
},
"nasConfig" : {
"groupId" : "100",
"mountPoints" : [ {
"mountDir" : "/home/test",
"serverAddr" : "***-uni85.cn-hangzhou.nas.aliyuncs.com:/"
} ],
"userId" : "100"
},
"role" : "acs:ram::198613743****:role/fc-public-test",
"serviceName" : "service_name",
"vpcConfig" : {
"securityGroupId" : "sg-bp18hj1wtxgy3b0***",
"vSwitchIds" : [ "vsw-bp1ozpcrdc6r****" ],
"vpcId" : "vpc-***"
},
"tracingConfig" : {
"type" : "Jaeger"
}
}
Sample success response
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"createdTime" : "2020-04-03T05:57:28Z",
"description" : "test_description",
"internetAccess" : true,
"lastModifiedTime" : "2020-04-03T05:57:28Z",
"logConfig" : {
"logstore" : "test-prj",
"project" : "test-logstore",
"enableRequestMetrics" : true,
"logBeginRule" : "DefaultRegex"
},
"nasConfig" : {
"groupId" : "100",
"mountPoints" : [ {
"mountDir" : "/home/test",
"serverAddr" : "***-uni85.cn-hangzhou.nas.aliyuncs.com:/"
} ],
"userId" : "100"
},
"role" : "acs:ram::198613743****:role/fc-public-test",
"serviceId" : "c910061f-****-44e6-b659-***c",
"serviceName" : "service_name",
"vpcConfig" : {
"securityGroupId" : "sg-bp18hj1wtxgy3b0***",
"vSwitchIds" : [ "vsw-bp1ozpcrdc6r****" ],
"vpcId" : "vpc-***"
},
"tracingConfig" : {
"type" : "Jaeger"
}
}