Put Trigger

Prev Next

Available in Classic and VPC

Create or edit a Cloud Functions trigger.

Request

This section describes the request format. The method and URI are as follows:

Method URI
PUT /triggers/{triggerName}

Request headers

For information about the headers common to all Cloud Funtions APIs, see Common Cloud Functions headers.

Request path parameters

The following describes the parameters.

Field Type Required Description
triggerName String Required Trigger 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 (default) | classic
type String Required Trigger type
  • cron | github | insight | object_storage | source_commit | secret_manager
  • Can't be changed after creation

Request body

You can include the following data in the body of your request: If there are no fields in the request body, it should be requested as {} empty JSON object.

Common

The following describes the common request body.

Field Type Required Description
description String Optional Trigger description (byte)
  • 0 - 3000
parameters Object Optional Default parameters of the trigger
  • JSON in the form of {"key": "value"}
  • Priority of applying parameters when running triggers
    • 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

cron trigger

The following describes the request body for cron triggers.

Field Type Required Description
cronOption String Required cron execution option

GitHub trigger

The following describes the request body for GitHub triggers.

Field Type Required Description
credential Object Required GitHub information
credential.username String Required GitHub username
credential.accessToken String Required GitHub access token
credential.repository String Required GitHub repository
  • Enter the repository name or in the format organization/repository name
events String[] Required Event to trigger
  • * | check_run | check_suite | commit_comment | create | delete | deployment | deployment_status | fork | gollum | issue_comment | issues | label | member | milestone | page_build | project_card | project_column | project | public | pull_request_review_comment | pull_request_review_thread | pull_request_review | pull_request | push | repository | repository_import | repository_vulnerability_alert | release | status | team_add | watch | branch_protection_rule | code_scanning_alert | deploy_key | discussion_comment | discussion | meta | package | registry_package | secret_scanning_alert_location | secret_scanning_alert | security_and_analysis | star | workflow_job | workflow_run
link Object Conditional API Gateway information
  • Valid only when creating a trigger and required
link.productName String Conditional API Gateway's product name
link.apiName String Conditional API Gateway API name
link.stageName String Conditional API Gateway's stage name

Cloud Insight trigger

The following describes the request body for Cloud Insight triggers.

Field Type Required Description
insightLink Object[] Optional Event rule information of the Cloud Insight to connect
insightLink[].prodKey String Conditional Cloud Insight event rule's prodKey
  • Required when entering insightLink
insightLink[].ruleGrpId String Conditional Cloud Insight event rule's ruleGrpId
  • Required when entering insightLink
insightLink[].reminderTime Integer Optional Cloud Insight event rule's reminder notification frequency (minute)
  • 5 - 720
insightLink[].enableNotiWhenEventClose Boolean Optional Whether to call Cloud Insight event rules at the end of an event
  • true | false (default)

Object Storage trigger

The following describes the request body for Object Storage triggers.

Caution

If an action attached to an Object Storage trigger uses the same bucket as an Object Storage event rule, recursive calls can result in increased usage and excessive costs.

Field Type Required Description
objectStorageLink Object[] Required Event rule information of the Object Storage to connect
objectStorageLink[].bucketName String Required Object Storage's bucket name
objectStorageLink[].eventRuleName String Required Object Storage's event rule name

SourceCommit trigger

The following describes the request body for SourceCommit triggers.

Note

SourceCommit triggers are supported only on the VPC platform of the Korea Region.

Field Type Required Description
sourceCommitLink Object[] Required Webhook information for the SourceCommit repository to connect
sourceCommitLink[].enable Boolean Optional Webhook activation status of SourceCommit
  • true (default) | false
sourceCommitLink[].repositoryName String Required SourceCommit repository name
sourceCommitLink[].webhookName String Required SourceCommit webhook name

Secret Manager trigger

The following describes the request body for Secret Manager triggers.

Note
  • Secret Manager triggers are supported only on the VPC platform of the Korea Region.
  • A trigger can have multiple secrets associated with it, but only one trigger can be associated with a secret.
Field Type Description
secretManagerLink Object[] Required
secretManagerLink[].secretName String Required

Request example

The request example is as follows:

curl --location --request PUT 'https://cloudfunctions.apigw.ntruss.com/ncf/api/v2/triggers/trigger001?platform=vpc&type=cron' \
--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": "Cron Trigger",
    "parameters": {
        "period": "daily"
    },
    "cronOption": "30 1 * * *"
}

Response

This section describes the response format.

Response body

The response body includes the following data:

Common

The common response body includes the following data:

Field Type Description
content.name String Trigger name
content.resourceId String Trigger's resource ID
content.triggerType String Trigger type
content.namespace String Namespace of the user
content.description String Trigger description
content.parameters Object Default parameters of the trigger
content.rules Object Trigger action connection information

cron trigger

The following describes the response body for cron triggers.

Field Type Description
content.cronOption String Cron execution option

GitHub trigger

The following describes the response body for GitHub triggers.

Field Type Description
content.credential Object GitHub information
content.credential.username String GitHub username
content.credential.accessToken String Trigger type
content.namespace String GitHub access token
content.credential.repository String GitHub repository
content.events String[] Type of events to trigger

Cloud Insight trigger

The following describes the response body for Cloud Insight triggers.

Field Type Description
content.insightLink Object[] Event rule information of the connected Cloud Insight
content.insightLink[].prodKey String Cloud Insight event rule's prodKey
content.insightLink[].ruleGrpId String Cloud Insight event's ruleGrpId
content.insightLink[].reminderTime Integer Cloud Insight event's reminder notification frequency (minute)
content.insightLink[].enableNotiWhenEventClose Boolean Whether to call Cloud Insight event rules at the end of an event

Object Storage trigger

The following describes the response body for Object Storage triggers.

Field Type Description
content.objectStorageLink Object[] Event rule information of the connected Object Storage
content.objectStorageLink[].bucketName String Object Storage's bucket name
content.objectStorageLink[].eventRuleName String Object Storage's event rule name

SourceCommit trigger

The following describes the response body for SourceCommit triggers.

Field Type Description
content.sourceCommitLink Object[] Webhook information for the connected SourceCommit repository
content.sourceCommitLink[].enable Boolean SourceCommit webhook activation status
content.sourceCommitLink[].repositoryName String SourceCommit repository name
content.sourceCommitLink[].webhookName String SourceCommit webhook name

Secret Manager trigger

The following describes the response body for Secret Manager triggers.

Field Type Description
content.secretManagerLink Object[] Connected Secret Manager secret information
content.secretManagerLink[].secretId String Secret Manager's secret ID

Response status codes

The following describes the response status codes.

HTTP status code Code Message Description
400 80500 TRIGGER_INVALID_NAME Invalid trigger name
400 80502 TRIGGER_PLATFORM_MISMATCH Trigger's platform can't be changed
400 80503 TRIGGER_INVALID_TYPE Invalid trigger type
400 80504 TRIGGER_TYPE_MISMATCH Trigger type can't be changed
400 80505 TRIGGER_BODY_INVALID_TYPE Invalid request body field type
400 80506 TRIGGER_BODY_MISSING_FIELD Missing required fields in the request body
400 80507 TRIGGER_BODY_INVALID_VALUE Invalid request body field value
400 80700 NO_APIGW_SUBSCRIPTION Need to subscribe to API Gateway
400 80710 NO_INSIGHT_SUBSCRIPTION Need to subscribe to Cloud Insight
400 80711 INSIGHT_INVALID_EVENT_RULE Invalid Cloud Insight event rule information
400 80730 NO_OBJECT_STORAGE_SUBSCRIPTION Need to subscribe to Object Storage
400 80731 OBJECT_STORAGE_INVALID_EVENT_RULE Invalid Object Storage event rule information
400 80740 SOURCE_COMMIT_INVALID_WEBHOOK Invalid SourceCommit webhook information
400 80750 NO_SECRET_MANGER_SUBSCRIPTION Need to subscribe to Secret Manager
400 80751 SECRET_MANAGER_INVALID_SECRET Invalid Secret Manager secret information
400 80752 SECRET_MANAGER_SECRET_ROTATING Secret Manager secret being replaced
403 80002 SUB_ACC_NO_PERMISSION Detailed permission error
409 80011 RESOURCE_NAME_CONFLICT Duplicate resource name
422 80508 TRIGGER_COUNT_EXCEED Maximum number of triggers exceeded
- 80005 INTEGRATION_EXCEPTION Need to subscribe to the integrated service

Response example

The response example is as follows:

{
    "content": {
        "description": "",
        "name": "trigger001",
        "namespace": "****YBNz****",
        "parameters": {
            "period": "daily"
        },
        "resourceId": "4ci**",
        "rules": {
            "****YBNz****/qr98**: {
                "action": {
                    "name": "action001",
                    "path": "****YBNz****"
                },
                "status": "active"
        },
        "triggerType": "cron"
    }
}