All Products
Search
Document Center

CloudOps Orchestration Service:Overview

Last Updated:Oct 24, 2023

You can improve the flexibility and reusability of a template by configuring the Parameters field.

Define parameters

You can define a parameter in the Parameters field of the template, including the parameter name, description, type, default value, and verification rules.

Syntax

Parameters:
  parameter-name-1: # The name of the parameter. The name can contain letters, digits, backslashes (\), underscores (_), and hyphens (-). Spaces are not allowed. We recommend that you use the lower camel case for a parameter name. Example: instanceId. 
    Type: String # Optional. The type of the parameter. Valid values: List, Number, String, Boolean, and Json. Default value: String.
    Description: description # Optional. The description of the parameter, such as the usage of the parameter.
    AssociationProperty: DateTime # Optional. The property of a parameter. This facilitates parameter setting when you use the template to create an execution. After you specify a property for a parameter, you can specify the parameter in the Operation Orchestration Service (OOS) console more easily than entering the value in a text box. For example, you can select a value from a drop-down list, specify time on a tab, or enter commands in a code editor. If you want a parameter to specify the type of Elastic Compute Service (ECS) instances, you can specify ALIYUN::ECS::Instance::InstanceType for the AssociationProperty parameter. Then, when you specify the parameter-name-1 parameter, a drop-down list with all available instance types is provided for you to select. If you want the parameter to specify shell commands, you can specify the Code property for the AssociationProperty parameter. Then, a code editor is provided for you to enter commands. This is more user-friendly than entering commands in a small input box. The following properties are available: ALIYUN::ECS::Instance::InstanceType, ALIYUN::ECS::SecurityGroup::SecurityGroupId, ALIYUN::VPC::VSwitch::VSwitchId, ALIYUN::ECS::Image::ImageId, Targets, RateControl, Code, DateTime, Cron, and TimeZone. You can also use the AssociationPropertyMetadata parameter to define a parameter property in a fine-grained manner. For example, if you specify the DateTime property for the AssociationProperty parameter, you can set the time format of the parameter value by using the AssociationPropertyMetadata parameter. 
    AssociationPropertyMetadata:
      Format: 'YYYY-MM-DDThh:mm:ssZ'   # The fine-grained definition of the property that you specify by using the AssociationProperty parameter. The AssociationPropertyMetadata parameter determines how the value of the parameter-name-1 parameter is displayed. For example, if you set the Format parameter to YYYY-MM-DDThh:mm:ssZ, you can specify the date and time on a tab. If you set the Format parameter to hh:mm:ssZ, you can specify only the time on a tab. 
    Default: default-value # Optional. The default value of the parameter.
    AllowedValues: # Optional. Valid values of the parameter. 
      - value1
      - value2
    AllowedPattern: regular-expression # Optional. The regular expression that the parameter value must match. This attribute is valid only if the parameter value is of the String type.
    MinLength: 1 # Optional. The minimum length of the parameter value. This parameter is valid only if the parameter value is of the String type.
    MaxLength: 10 # Optional. The maximum length of the parameter value. This parameter is valid only if the parameter value is of the String type.
{
  "Parameters": {
    "parameter-name-1": {
      "Type": "String",
      "Description": "description",
      "AssociationProperty": "DateTime",
      "AssociationPropertyMetadata": {
        "Format": "YYYY-MM-DDThh:mm:ssZ"
      },
      "Default": "default-value",
      "AllowedValues": [
        "value1",
        "value2"
      ],
      "AllowedPattern": "regular-expression",
      "MinLength": 1,
      "MaxLength": 10
    }
  }
}

Reference parameters

You can reference the parameters that are defined above as properties in the Tasks field. The following syntax can be used:

"some text {{ parameter_name }} some text {{parameter_name_2}} ..."                

Example:

If the YAML format is used, referenced parameters must be enclosed in double quotation marks ("").

"{{ parameter-name }}" # Reference a parameter itself.
"this is the {{ parameter-name }}" # Reference a parameter in a fixed string.
"hello {{parameter-last-name}} {{ parameter-first-name }}" # Reference multiple parameters in a fixed string.

Pseudo parameters

OOS provides pseudo parameters for obtaining the execution information. You can reference these parameters without the need to define them. The following table describes the supported pseudo parameters. If you need more pseudo parameters, submit a ticket and describe your scenarios. We will give you feedback and support at the earliest opportunity.

Parameter

Type

Description

Example

ACS::TemplateName

String

The name of the template based on which you create an execution.

test

ACS::ExecutionId

String

The ID of the execution.

exec-2123445567

ACS::RegionId

String

The region in which the execution resides.

cn-hangzhou

ACS::AccountId

String

The account to which the execution belongs.

1234567890****

ACS::TaskLoopItem

String

The items to be iterated in a loop task.

i-bpzxcvb1234****

ACS::OOSUtilVersion

String

The version number of the proxy of OOS.

1.01

ACS::CurrentDate

String

The current UTC date.

2020-12-29T

ACS::CurrentUTCTime

String

The current UTC time.

2020-12-29T10:00:30Z

ACS::ExecuteUser

String

The name of the Resource Access Management (RAM) user that triggers the execution.

zhangsan

ACS::ExecuteUserType

String

The type of the RAM entity that triggers the execution.

RamRole, RamUser or AlibabaCloudAccount