Put Action

Prev Next

Available in Classic and VPC

Create or edit a Cloud Functions action.

Request

The following describes the request format for the endpoint. The request format is as follows:

Method URI
PUT /packages/{packageName}/actions/{actionName}

Request headers

For headers common to all Cloud Functions APIs, see Cloud Functions common headers.

Request path parameters

The following describes the parameters.

Field Type Required Description
packageName String Required Package name
  • 1 to 50 characters, including English letters, numbers, and special characters "-" and "_", and it can't start with "-"
  • It can't be duplicated with other resource (package, action, trigger) names
  • Enter the special character "-" to create actions that are not part of a package
    • <E.g.> /packages/-/actions/myaction
actionName String Required Action name
  • 1 to 50 characters, including English letters, numbers, and special characters "-" and "_", and it can't start with "-"
  • It can't be duplicated with other resource (package, action, trigger) names

Request query parameters

The following describes the parameters.

Field Type Required Description
platform String Optional Platform type
  • vpc | classic (default)

Request body

The following describes the request body.

Basic action

The following describes the request body for basic actions.

Field Type Required Description
description String Optional Action description (byte)
  • 0 - 3000
web Boolean Optional Set web action
  • true | false
    • true: web action
    • false: general action
  • Default
    • When creating a new action: false
    • When editing an existing action: true
  • Can't change the type of an existing action
raw-http Boolean Optional Whether to use the HTTP origin
  • true | false (default)
  • If web is false, only false can be entered
  • Only supported for web actions
custom-options Boolean Optional Set header options
  • true | false (default)
  • If web is false, only false can be entered
  • Only supported for web actions
parameters Object Optional Default parameters of the action
  • JSON in the form of {"key": "value"}
  • Priority of applying parameters when running actions
    • 1st priority: runtime parameters passed at runtime
    • 2nd priority: default parameters of connected triggers
    • 3rd priority: default parameters in actions
    • 4th priority: default parameters of included packages
limits.timeout Integer Required Maximum action execution time (milliseconds)
  • 500 - 300,000
  • Force terminate the action on timeout
limits.memory Integer Required Maximum memory size for the action (MB)
  • 128 | 256 | 512 | 1024
exec.kind String Required Action runtime
exec.binary Boolean Required Whether the action code file is binary
  • true | false
    • true: Enter the Base64 -encoded value from the action code file in exec.code
    • false: Enter the action code in exec.code
  • If exec.kind is java or dotnet:2.2, enter true
exec.code String Required Action source code
  • Source code: Enter the code verbatim
  • File attachment: Enter the action code file binary data encoded in Base64
  • Need to escape when typing code directly
  • Java or .NET runtime only allows file binaries
  • Java can only be uploaded as a compressed *.jar file
  • .NET (dotnet) can only be uploaded as a *.zip file (compressed file)
exec.main String Required Execution function
vpc Object Optional VPC information to connect
  • Enter only if platform is vpc
vpc.vpcNo Integer Optional Number of VPC to connect
vpc.subnetNo Integer Optional Number of subnet to connect

Sequence action

The following describes the request body for sequence actions.

Field Type Required Description
description String Optional Action description (byte)
  • 0 - 3000
web Boolean Optional Set web action
  • true | false
    • true: web action
    • false: general action
  • Default
    • When creating a new action: false
    • When editing an existing action: true
  • Can't change the type of an existing action
exec.kind String Required Action type
  • sequence (fixed value)
exec.components String[] Required List of actions to connect to the sequence action
  • {packageName}/{actionName} format
  • Enter actions in the order of execution
  • When connecting an action that is not part of a package, enter the special character "-" in packageName

Request example

The following is a sample request.

curl --location --request PUT 'https://cloudfunctions.apigw.ntruss.com/api/v2/packages/package003/actions/action001?platform=classic' \
--header 'Content-Type: application/json' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Sub Account Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--data '<See below>'
{
    "description" : "Create Action",
    "web": false,
    "raw-http": false,
    "custom-options" : false,
    "parameters": {
            "name": "action000"
    },
    "limits": {
        "timeout": 60000,
        "memory": 128
    },
    "exec": {
        "kind": "nodejs:16",
        "code": "function main(params) { \nlet name = params.name || \"World\";\nlet place = params.place || \"Naver\"; \n  return {payload:  \"abc\"};\n}",
        "binary": false,
        "main": "main"
    }
}

Response

The following describes the response format.

Response body

The following describes the response body.

Basic action

The following describes the response body for basic actions.

Field Type Required Description
content.name String - Action name
content.path String - Action path
content.description String - Action description
content.parameters Object - Default parameters of the action
content.resourceId String - Action's resource ID
content.web Boolean - Web action settings
content.raw-http Boolean - Whether to use the HTTP origin
  • Supported only for web actions
  • content.custom-options Boolean - Set header options
  • Supported only for web actions
  • content.exec.binary Boolean - Whether the action code is file binary
    content.exec.code String - Action source code or Base64-encoded code file binary
    content.exec.kind String - Language in use
    content.exec.main String - Execution function
    content.limits.memory Integer - Size of memory allocated to the action container
    content.limits.timeout Integer - Maximum time an action can run
    content.vpc Object - Information of the connected VPC
    • Display only if platform is vpc
    content.vpc.vpcNo Integer - Number of the connected VPC
    content.vpc.subnetNo Integer - Number of the connected subnet

    Sequence action

    The following describes the response body for sequence actions.

    Field Type Description
    content.name String Action name
    content.path String Action path
    content.description String Action description
    content.resourceId String Action's resource ID
    content.web Boolean Web action settings
    content.exec.kind String Action type
    • sequence (fixed value)
    content.exec.components String[] List of connected actions

    Response status codes

    For response status codes common to NAVER Cloud Platform, see Ncloud API response status codes.

    Response example

    The following is a sample example.

    {
        "content": {
            "custom-options": false,
            "description": "Create Action",
            "exec": {
                "binary": false,
                "code": "function main(params) { \nlet name = params.name || \"World\";\nlet place = params.place || \"Naver\"; \n  return {payload:  \"abc\"};\n}",
                "kind": "nodejs:16",
                "main": "main"
            },
            "limits": {
                "memory": 128,
                "timeout": 60000
            },
            "name": "action001",
            "parameters": {
                "name": "action000"
            },
            "path": "otojYBN*****/package003",
            "raw-http": false,
            "resourceId": "Hb***",
            "web": false
        }
    }