UpdateFunction

Updated at:

Update a function.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mpserverless:UpdateFunction

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Desc

string

No

Function description.

description

Name

string

Yes

Function name.

demoFunction

SpaceId

string

Yes

Service space ID.

dece4ea0-d432-4cfa-8514-8a88d205e2b8

Memory

integer

No

Function memory size. Must be a multiple of 64 MB. Minimum is 128 MB. Maximum is 2048 MB.

256

Timeout

integer

No

Function timeout period in seconds. Default is 5. Valid range is 1 to 7200.

5

HttpTriggerPath

string

No

HTTP trigger path. To disable this feature, set this parameter to an empty string. The path must start with /http. It cannot end with /. Paths must be unique within the same service space. Only the following characters are allowed: /, -, _, ., letters, and digits. Maximum length is 128 characters.

/http/hello

TimingTriggerConfig

string

No

Scheduled trigger configuration. To disable this feature, set this parameter to an empty string. For configuration rules, see Use scheduled triggers for functions.

Note

Public preview: cron:0 0 */2 * * *. Commercial edition: 0 0 */2 * * *.

cron:0 0 * * * *

TimingTriggerUserPayload

string

No

Custom input parameter for scheduled tasks.

Note

This feature is supported only in the commercial edition.

hello

InstanceConcurrency

integer

No

Maximum concurrent invocations per instance. Default is 1. Valid range is 1 to 20. Setting a value greater than 1 reduces cold starts. Use this setting when your function spends most of its time waiting for downstream services. Do not use it if your function has shared state that cannot be accessed concurrently. Also avoid it if a single request consumes large amounts of CPU or memory.

Note
  • When you set this value to more than 1, memory must be at least 512 MB.

1

Runtime

string

No

Function runtime environment. Supported values include nodejs12 and nodejs14. For the full list, see Supported runtimes.

Valid values:

  • nodejs14 :

    nodejs14

  • nodejs12 :

    nodejs12

  • nodejs16 :

    nodejs16

nodejs14

Response elements

Element

Type

Description

Example

object

RequestId

string

Request ID.

C293BB03-B6AD-46C2-80D1-19C8FB573916

TimingTriggerConfig

string

Scheduled trigger configuration.

cron:0 0 * * * *

TimingTriggerUserPayload

string

Custom input parameter for scheduled tasks. You can access this value in your function code as ctx.args.userPayload.

24

HttpTriggerPath

string

HTTP trigger path.

/http/hello

CreatedAt

string

Function creation time.

2019-06-20T03:22:54.854Z

Name

string

Function name.

demoFunction

ModifiedAt

string

Function last modified time.

2019-06-20T03:22:54.854Z

Desc

string

Function description.

description

Spec

object

Function runtime configuration.

Timeout

string

Timeout period.

5s

Runtime

string

Runtime environment.

Node.js 8

InstanceConcurrency

integer

Maximum concurrent invocations per instance.

1

Memory

string

Memory size.

128 MB

Examples

Success response

JSON format

{
  "RequestId": "C293BB03-B6AD-46C2-80D1-19C8FB573916",
  "TimingTriggerConfig": "cron:0 0 * * * *",
  "TimingTriggerUserPayload": "24",
  "HttpTriggerPath": "/http/hello",
  "CreatedAt": "2019-06-20T03:22:54.854Z",
  "Name": "demoFunction",
  "ModifiedAt": "2019-06-20T03:22:54.854Z",
  "Desc": "description",
  "Spec": {
    "Timeout": "5s",
    "Runtime": "Node.js 8",
    "InstanceConcurrency": 1,
    "Memory": "128 MB"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.