All Products
Search
Document Center

Function Compute:UpdateService

Last Updated:Nov 01, 2024

Updates the information about a service.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only the common request header. For more information, see the topic about common request parameters.

Parameter

Type

Required

Example

Description

If-Match

String

No

e19d5cd5af0378da05f63f891c7467af

The name of the service.

Request syntax

PUT /services/{serviceName} HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

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: allows functions to access the Internet.

  • false: does not allow functions to access the Internet.

logConfig

LogConfig

Body

No

The log configuration, which specifies a Logstore to store function execution logs.

nasConfig

NASConfig

Body

No

The configuration of the File Storage NAS file system, which allows functions in the specified service in Function Compute to access the NAS file system.

role

String

Body

No

acs:ram::198613743****:role/fc-public-test

The Alibaba Cloud Resource Name (ARN) of the RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:

  • Sends function execution logs to your Logstore.

  • Generates a token for a function to access other cloud resources during function execution.

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 configuration of Tracing Analysis. After you configure Tracing Analysis for a service in Function Compute, you can record the execution duration of a request, view the amount of the cold start time for a function, and record the execution duration of 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

Indicates whether functions are allowed to access the Internet. Valid values:

  • true: Functions are allowed to access the Internet.

  • false: Functions are not allowed to access the Internet.

lastModifiedTime

String

2020-04-03T07:57:33Z

The last time when the service was updated.

logConfig

LogConfig

The log configuration. Function Compute writes function execution logs to the specified Logstore.

nasConfig

NASConfig

The configuration of the NAS file system, which allows functions in the specified service in Function Compute to access the NAS file system.

role

String

acs:ram::198613743****:role/fc-public-test

The ARN of the RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:

  • Sends function execution logs 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 unique ID generated by the system for the service.

serviceName

String

service_name

The name of the service.

vpcConfig

VPCConfig

The VPC configuration, which allows functions in the specified service in Function Compute to access the specified VPC.

tracingConfig

TracingConfig

The configuration of Tracing Analysis. After you configure Tracing Analysis for a service in Function Compute, you can record the execution duration of a request, view the amount of the cold start time for a function, and record the execution duration of a function. For more information, see Overview.

Examples

Sample requests

PUT /2016-08-15/services/service_name HTTP/1.1
Common request parameters

{
  "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",
  "vpcConfig" : {
    "securityGroupId" : "sg-bp18hj1wtxgy3b0***",
    "vSwitchIds" : [ "vsw-bp1ozpcrdc6r****" ],
    "vpcId" : "vpc-***"
  },
  "tracingConfig" : {
    "type" : "Jaeger"
  }
}

Sample success responses

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-03T07:57:33Z",
  "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-f6fa-44e6-b659-56***",
  "serviceName" : "service_name",
  "vpcConfig" : {
    "securityGroupId" : "sg-bp18hj1wtxgy3b0***",
    "vSwitchIds" : [ "vsw-bp1ozpcrdc6r****" ],
    "vpcId" : "vpc-***"
  },
  "tracingConfig" : {
    "type" : "Jaeger"
  }
}

Error codes

For a list of error codes, visit the API Error Center.