All Products
Search
Document Center

Container Service for Kubernetes:CreateTrigger

Last Updated:Feb 29, 2024

You can call the CreateTrigger operation to create a trigger for an application.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cs:CreateTriggerRead
  • All Resources
    *
    none
none

Request syntax

POST /clusters/{cluster_id}/triggers

Request parameters

ParameterTypeRequiredDescriptionExample
bodyobjectNo

The request body.

cluster_idstringYes

The cluster ID.

c5cdf7e3938bc4f8eb0e44b21a80f****
project_idstringYes

The name of the trigger project.

The name consists of the namespace where the application is deployed and the name of the application. The format is ${namespace}/${name}.

Example: default/test-app.

default/test-app
actionstringYes

The action that the trigger performs. Set the value to redeploy.

redeploy: redeploys the resources specified by project_id.

redeploy
typestringNo

The type of trigger. Valid values:

  • deployment: performs actions on Deployments.
  • application: performs actions on applications that are deployed in Application Center.

Default value: deployment.

deployment
cluster_idstringYes

The cluster ID.

c68deb844dc6d480eb775be611fdf****

Response parameters

ParameterTypeDescriptionExample
object

The returned data.

idstring

The ID of the trigger.

102536
cluster_idstring

The ID of the cluster.

c93095129fc41463aa455d89444fd****
project_idstring

The name of the trigger project.

default/test-app
typestring

The type of trigger. Default value: deployment.

deployment
actionstring

The action that the trigger performs. For example, a value of redeploy indicates that the trigger redeploys the application.

redeploy

Examples

Sample success responses

JSONformat

{
  "id": "102536",
  "cluster_id": "c93095129fc41463aa455d89444fd****",
  "project_id": "default/test-app",
  "type": "deployment",
  "action": "redeploy"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history