You can call this operation to update service information.

Request headers

This operation uses only common request headers. For more information, see Common parameters.

Request structure

PUT /services/{serviceName} 

Request parameters

Parameter Type Position Required Example Description
If-Match String Header No e19d5cd5af0378da05f63f891c7467af

The name of the service.

serviceName String Path Yes service_name

The name of the service.

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:

  • true
  • false
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:

  • Sends logs generated by a function to your Logstore.
  • Generates a token for a function to access other cloud resources during function execution.
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:

  • true
  • false
lastModifiedTime String 2020-04-03T07:57:33Z

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:

  • Sends logs generated by a function to your Logstore.
  • Generates a token for a function to access other cloud resources during function execution.
serviceId String c910061f-f6fa-44e6-b659-56***

The ID generated by the system for each 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

PUT /2016-08-15/services/service_name HTTP/1.1
Common request headers
{
    "role":"acs:ram::19861****3743:role/fc-public-test",
    "logConfig":{
        "enableRequestMetrics":"true",
        "project":"test_project",
        "logstore":"test_logstore"
    },
    "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***"
    },
    "nasConfig":{
        "userId":100,
        "groupId":100,
        "mountPoints":[
            {
                "serverAddr":"***-uni85.cn-hangzhou.nas.aliyuncs.com:/",
                "mountDir":"/home/test"
            }
        ]
    }
}

Sample success responses

JSON format

HTTP/1.1 200 OK
Common response headers
{
  "serviceName": "service_name",
  "description": "test_description",
  "role": "acs:ram::19861****3743:role/fc-public-test",
  "logConfig": {
    "enableRequestMetrics": "true",
    "project": "test_project",
    "logstore": "test_logstore"
  },
  "serviceId": "c910061f-f6fa-44e6-b659-56***",
  "createdTime": "2020-04-03T05:57:28Z",
  "lastModifiedTime": "2020-04-03T07:57:33Z",
  "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***"
  },
  "internetAccess": true,
  "nasConfig": {
    "userId": 100,
    "groupId": 100,
    "mountPoints": [
      {
        "serverAddr": "***-uni85.cn-hangzhou.nas.aliyuncs.com:/",
        "mountDir": "/home/test"
      }
    ]
  }
}