Put action
    • PDF

    Put action

    • PDF

    Article summary

    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:

    MethodURI
    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.

    FieldTypeRequiredDescription
    packageNameStringRequiredPackage name
    • 1 to 50 characters, including English letters, numbers, and special characters "-" and "_"
    • It can't be duplicated with other resource (package, action, trigger) names.
    • Enter the special character "-" to create an action that is not part of a package
      • <E.g.> /packages/-/actions/myaction
    actionNameStringRequiredAction 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.

    FieldTypeRequiredDescription
    platformStringOptionalPlatform type
    • vpc | classic (default)

    Request body

    The following describes the request body.

    Basic action

    The following describes the request body for basic actions.

    FieldTypeRequiredDescription
    descriptionStringOptionalDescription of the action (byte)
    • 0 - 3000
    webBooleanOptionalSet web action
    • true | false
      • true: web action
      • false: general action
    • default
      • When creating a new action: false
      • When editing an existing action: true
    • The type of an existing action cannot be changed
    raw-httpBooleanOptionalWhether to use the HTTP origin
    • true | false (default)
    • Only false can be entered if web is false
    • Only support web actions
    custom-optionsBooleanOptionalSet header options
    • true | false (default)
    • Only false can be entered if web is false
    • Only support web actions
    parametersObjectOptionalAction default parameters
    • 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 the associated trigger
      • 3rd priority: default parameters of the action
      • 4th priority: default parameters of the included packages
    limits.timeoutIntegerRequiredMaximum action execution time (milliseconds)
    • 500 - 300,000
    • Force terminate the action on timeout
    limits.memoryIntegerRequiredMaximum memory size for the action (MB)
    • 128 | 256 | 512 | 1024
    exec.kindStringRequiredAction runtime
    exec.binaryBooleanRequiredWhether the action code file is binary
    • true | false
      • true: Enter the Base64-encoded value of the action code file in exec.code
      • false: Enter the action code in exec.code
    • Enter true if exec.kind is java or dotnet:2.2
    exec.codeStringRequiredAction source code
    • Source code: Enter the code verbatim
    • Attach file: Enter action code file binary data in Base64 encoding
    • Need to escape when typing code directly
    • Java or .NET runtime only allows file binaries
    • Java can only be registered as a compressed *.jar file
    • .NET (dotnet) can only be uploaded as a *.zip file (compressed file)
    content.exec.mainStringRequiredFunctions to execute
    vpcObjectOptionalInformation of the VPC to connect
    • Enter only if platform is vpc
    vpc.vpcNoIntegerOptionalNumber of VPC to connect
    vpc.subnetNoIntegerOptionalNumber of subnet to connect

    Sequence action

    The following describes the request body for sequence actions.

    FieldTypeRequiredDescription
    descriptionStringOptionalDescription of the action (byte)
    • 0 - 3000
    webBooleanOptionalSet web action
    • true | false
      • true: web action
      • false: general action
    • default
      • When creating a new action: false
      • When editing an existing action: true
    • The type of an existing action cannot be changed
    exec.kindStringRequiredAction type
    • sequence (fixed value)
    exec.componentsString[]RequiredList of actions to associate with a sequence action
    • {packageName}/{actionName} format
    • Enter the actions in the order you want them to run
    • When associating 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.

    FieldTypeRequiredDescription
    content.nameString-Action name
    content.pathString-Action path
    content.descriptionString-Action description
    content.parametersObject-Default parameter of the action
    content.resourceIdString-Action's resource ID
    content.webBoolean-Set web action
    content.raw-httpBoolean-Whether to use HTTP origin
  • Only support web actions
  • content.custom-optionsBoolean-Set header options
  • Only support web actions
  • content.exec.binaryBoolean-Whether the action code file is binary or not
    content.exec.codeString-Action source code or Base64-encoded code file binary
    content.exec.kindString-Language used
    content.exec.mainString-Functions to execute
    content.limits.memoryInteger-Size of memory allocated to the action container
    content.limits.timeoutInteger-Maximum time an action can run
    content.vpcObject-Connected VPC information
    • It is displayed only if platform is vpc
    content.vpc.vpcNoInteger-Number of connected VPC
    content.vpc.subnetNoInteger-Number of connected subnet

    Sequence action

    The following describes the response body for sequence actions.

    FieldTypeDescription
    content.nameStringAction name
    content.pathStringAction path
    content.descriptionStringAction description
    content.resourceIdStringAction's resource ID
    content.webBooleanSet web action
    content.exec.kindStringAction type
    • sequence (fixed value)
    content.exec.componentsString[]List of associated 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 response.

    {
        "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
        }
    }
    

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.