All Products
Search
Document Center

CloudOps Orchestration Service:Tasks

Last Updated:Dec 05, 2025

A task is the most important component of a template. It defines a specific O&M operation. The type of a task is called an action. OOS provides a wide range of actions, including common actions for cloud products such as ECS and RDS. If you need common product actions that OOS does not yet provide, contact us and describe your scenario. You can also write your own atomic actions to perform CloudOps Orchestration Service and execution.

General properties

The syntax for a task in a template is as follows:

  • YAML format

Tasks:
  - Name: TaskName1 # Required. The name of the task. The name can contain letters, digits, underscores (_), and hyphens (-). The name can be up to 200 characters long. We recommend that you use camel case, such as StartInstance.
    When: Condition1 # Optional. Specifies whether to execute the task based on a condition. If the condition is true, the task is executed. If the condition is false, the task is skipped and the next task is executed.
    Action: TaskType # Required. The type of the task, also called an action. For more information, see the related documents.
    Description: description # Optional. A description of the task's purpose.
    Properties: # The list of properties varies based on the action used. For more information, see the related documents.
      Property1: Value1 # The properties and values that the action depends on.
      Property2: Value2 # When Property is Parameters, define the input parameter names based on the original OpenAPI. If an original parameter name does not contain a period (.), use the original name. If an original parameter name contains a period (.) but is not tag-related, remove the period. For example, for the Temporary.InternetMaxBandwidthOut parameter of the ModifyInstanceSpec API, the name becomes TemporaryInternetMaxBandwidthOut. If an original parameter name contains a period (.) and is tag-related, use Tags as the name, such as "Tags": [{"Key": tagKey1,"Value": tagValue1 }].
    Outputs:  # The output parameters of the current task. They can be used as input for subsequent tasks or as outputs for the template.
      outputParameterName1:
        Type: # Optional. Declares the type of the output parameter. Supported primitive data types are String, Number, Boolean, List, and Json. The default is String. Note: The output value of outputParameterName1 is generated by wrapping the result from ValueSelector based on the declared Type. If Type is List, the result from ValueSelector is wrapped in brackets ([]). For example, if the result is "i-12345zxcv", the final output is ["i-12345zxcv"]. If Type is not List, the result from ValueSelector is used directly as the output. For example, if Type is String and the result is "i-12345zxcv", the final output is "i-12345zxcv".
        ValueSelector: "jq selector" # If the task is an OpenAPI call, the result of the call is treated as JSON input. Use a jq expression to extract the required value from the JSON. For examples, see cloud product actions and public templates.
    # Flow control parameters
    OnError: "ACS::END/ACS::NEXT/other-task-name" # Optional. Defines the execution flow if an error occurs in the current task. Default: END, which stops the entire execution.
    OnCancel: "ACS::END/ACS::NEXT/other-task-name" # Optional. Defines the execution flow if the current task is canceled. Default: END, which stops the entire execution.
    OnSuccess: "ACS::NEXT/other-task-name/ACS::END" # Optional. Defines the execution flow after the current task succeeds. Default: NEXT, which executes the next task.
  • JSON format (For more information, see the comments in the YAML format.)

{
  "Tasks": [
    {
      "Name": "TaskName1",
      "Action": "TaskType",
      "When": "Condition",
      "Description": "description",
      "Properties": {
        "Property1": "Value1",
        "Property2": "Value2"
      },
      "Outputs": {
        "outputParameterName1": {
          "Type": null,
          "ValueSelector": "jq selector"
        }
      },
      "OnError": "ACS::END/ACS::NEXT/other-task-name",
      "OnCancel": "ACS::END/ACS::NEXT/other-task-name",
      "OnSuccess": "ACS::NEXT/other-task-name/ACS::END"
    }
  ]
}