Put Action
- Print
- PDF
Put Action
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
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
|
actionName | String | Required | Action name
|
Request query parameters
The following describes the parameters.
Field | Type | Required | Description |
---|---|---|---|
platform | String | Optional | Platform type
|
type | String | Optional | Action type
|
Request body
The following describes the request body.
Basic/web action
The following describes the parameters.
Field | Type | Required | Description |
---|---|---|---|
description | String | Optional | Action description (byte)
|
parameters | Object | Optional | Default parameters of the action
|
limits.timeout | Integer | Required | Maximum action execution time (milliseconds)
|
limits.memory | Integer | Required | Maximum memory size for the action (MB)
|
exec.kind | String | Required | Action runtime
|
exec.imageUri | String | Conditional | User image path
|
exec.binary | Boolean | Required | Whether the action code file is binary
|
exec.code | String | Required | Action source code
|
exec.main | String | Required | Execution function |
vpc | Object[] | Required | Information about the VPC to connect
|
vpc[].vpcNo | Integer | Required | ID of the VPC to connect |
vpc[].subnetNo | Integer | Required | ID of subnet to connect |
raw-http | Boolean | Optional | Whether to use the HTTP origin
|
custom-options | Boolean | Optional | Set the HTTP header options
|
Sequence/sequence-web action
The following describes the parameters.
Field | Type | Required | Description |
---|---|---|---|
description | String | Optional | Action description (byte)
|
exec.kind | String | Required | Action type
|
exec.components | String[] | Required | List of actions to connect to the sequence action
|
Request example
The following is a sample request.
curl -X PUT 'https://cloudfunctions.apigw.ntruss.com/ncf/api/v2/packages/{packageName}/actions/{actionName}' \
--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}'
-d '<See below>'
{
"description" : "My action",
"parameters": {
"name": "Cloud Functions",
"place": "NCloud"
},
"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"
},
"vpc": [
{
"vpcNo" : ******,
"subnetNo" : *****
}
]
}
Response
The following describes the response format.
Response body
The following describes the response body.
Common fields
Field | Type | Description |
---|---|---|
content.name | String | Action name |
content.resourceId | String | Action's resource ID |
content.path | String | Action path |
content.description | String | - |
content.type | String | - |
Basic/web action
Field | Type | Description |
---|---|---|
content.parameters | Object | Default parameters of the action |
content.raw-http | Boolean | Whether to use the HTTP origin
|
content.custom-options | Boolean | Set the header options
|
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.imageUri | String | User image path
|
content.exec.kind | String | Action runtime |
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[] | - |
content.vpc[].vpcNo | Integer | - |
content.vpc[].subnetNo | Integer | - |
Sequence/web-sequence action
Field | Type | Description |
---|---|---|
content.exec.kind | String | Action type
|
content.exec.components | String[] | List of connected actions |
Response status codes
The following describes the response status codes.
HTTP status code | Code | Messages | Description |
---|---|---|---|
400 | 80300 | ACTION_INVALID_NAME | Invalid action name |
400 | 80102 | PACKAGE_PLATFORM_MISMATCH | The platform of the action's parent package can't be changed |
400 | 80302 | ACTION_PLATFORM_MISMATCH | Action's platform can't be changed |
400 | 80303 | ACTION_INVALID_TYPE | Invalid action type |
400 | 80304 | ACTION_TYPE_MISMATCH | Action's type can't be changed |
400 | 80305 | ACTION_BODY_INVALID_TYPE | Invalid request body field type |
400 | 80306 | ACTION_BODY_MISSING_FIELD | Missing required fields in the request body |
400 | 80307 | ACTION_BODY_INVALID_VALUE | Invalid request body field value |
403 | 80002 | SUB_ACC_NO_PERMISSION | Detailed permission error |
409 | 80011 | RESOURCE_NAME_CONFLICT | Duplicate resource name |
422 | 80308 | ACTION_COUNT_EXCEED | Maximum number of actions exceeded |
500 | 81311 | ACTION_NAT_EXCEPTION | Subnet query failed |
500 | 81312 | NAT_CREATE_FAIL | Subnet connection failed |
500 | 81313 | NAT_BEING_CREATED | Subnet being connected |
500 | 81314 | NAT_RETURN_FAIL | Subnet being disconnected |
Response example
The following is a sample example.
{
"content": {
"description": "My 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": "myaction",
"parameters": {
"name": "Cloud Functions",
"place": "NCloud"
},
"path": "***QK06kFG8C/mypackage",
"resourceId": "*****",
"type": "basic",
"vpc": [
{
"subnetNo": ******,
"vpcNo": *****
}
]
}
}
Was this article helpful?