All Products
Search
Document Center

CloudOps Orchestration Service:Template outputs

Last Updated:Apr 27, 2024

Outputs can be generated for all tasks in a template and the template. You can obtain the execution results from the template outputs after the template is executed. If a template is nested into another template (parent template) as a child template, the task that nests the child template into the parent template can reference the outputs of the child template if you configure the output parameters for the child template. In this case, the output parameters of the child template are filtered by ValueSelector to obtain the values of the output parameters of the child template. The obtained values of the output parameters of the child template are used as the values of the output parameters of the task. The other tasks in the parent template can reference the values of the output parameters of the child template by referencing the values of the output parameters of the task.

For example, Template A contains a task that creates Elastic Compute Service (ECS) instances, and the outputs of Template A are the IDs of the created ECS instances. You can view the execution results of Template A to obtain the IDs of the ECS instances from the outputs of Template A. Template A is nested into Template B as a child template, and Template B contains Task 1 and Task 2. Task 1 nests Template A into Template B. Task 2 restarts all the ECS instances whose IDs are obtained from the outputs of Template A. In this case, the outputs of Template A are referenced by the output parameters of Task 1 in Template B. Then, Task 2 references the values of the output parameters of Task 1 to obtain the ECS instance IDs.

Syntax

The values of the output parameters of a template can be the values of all parameters that can be referenced within the template. The values of the output parameters, pseudo parameters, and parameters defined in the Parameters section of the template can be referenced by the template output parameters and used as the outputs of the template.

A single output:

  • YAML format

Outputs:
  OutputParameterName: # required. The name of the output parameter. The name can contain letters, digits, underscores (_), and hyphens (-). It can be up to 200 characters in length. 
    Type: String # optional. The type of the output parameter. The valid values include the basic parameter types supported by the YAML or JSON format, such as String, Number, Boolean, List or Array, and Object. Default value: String. 
    Value: "{{ TaskName.OutputParameterName }}" # required. The value of the output parameter. In most cases, the value is the output of a task.
  • JSON format (For more information, see the parameter description of the YAML format.)

{
  "Outputs": {
    "OutputParameterName": {
      "Type": "String",
      "Value": "{{ TaskName.OutputParameterName }}"
    }
  }
}

Multiple outputs:

  • YAML format

Outputs:
  OutputParameterName1: 
    Type: String # optional. The type of the output parameter. The valid values include the basic parameter types supported by the YAML or JSON format, such as String, Number, Boolean, List or Array, and Object. Default value: String. 
    Value: "{{ TaskName1.OutputParameterName }}" # required. The value of the output parameter. In most cases, the value is the output of a task. 
  OutputParameterName2: # required. The name of the output parameter. The name can contain letters, digits, underscores (_), and hyphens (-). It can be up to 200 characters in length. 
    Type: String # optional. The type of the output parameter. The valid values include the basic parameter types supported by the YAML or JSON format, such as String, Number, Boolean, List or Array, and Object. Default value: String. 
    Value: "{{ TaskName2.OutputParameterName }}" # required. The value of the output parameter. In most cases, the value is the output of a task. 
  OutputParameterName3: # required. The name of the output parameter. The name can contain letters, digits, underscores (_), and hyphens (-). It can be up to 200 characters in length. 
    Type: String # optional. The type of the output parameter. The valid values include the basic parameter types supported by the YAML or JSON format, such as String, Number, Boolean, List or Array, and Object. Default value: String. 
    Value: "{{ TaskName3.OutputParameterName }}" # required. The value of the output parameter. In most cases, the value is the output of a task.
  • JSON format (For more information, see the parameter description of the YAML format.)

{
  "Outputs": {
    "OutputParameterName1": {
      "Type": "String",
      "Value": "{{ TaskName1.OutputParameterName }}"
    }
    "OutputParameterName2": {
      "Type": "String",
      "Value": "{{ TaskName2.OutputParameterName }}"
    }
    "OutputParameterName3": {
      "Type": "String",
      "Value": "{{ TaskName3.OutputParameterName }}"
    }
  }
}