DATASOURCE::ECS::Commands类型用于查询您手动创建的所有可用的命令。

语法

{
  "Type": "DATASOURCE::ECS::Commands",
  "Properties": {
    "Type": String,
    "Description": String,
    "CommandId": String,
    "CommandName": String
  }
}

属性

属性名称类型必须允许更新描述约束
TypeString命令类型。取值:
  • RunBatScript:命令为在Windows实例中运行的Bat脚本。
  • RunPowerShellScript:命令为在Windows实例中运行的PowerShell脚本。
  • RunShellScript:命令为在Linux实例中运行的Shell脚本。
DescriptionString命令描述。
CommandIdString命令ID。
CommandNameString命令名称。

返回值

Fn::GetAtt

  • CommandIds:命令ID列表。
  • Commands:命令数据集列表。
属性名称类型描述约束
CommandIdsList命令ID列表。
CommandsList命令数据集列表。
ParameterNamesList通过创建命令时的CommandContent解析出的自定义参数名列表。例如:
[ "['parameter1','parameter2']" ]
DescriptionString命令描述。
TagsList命令的标签信息。例如:
 [ {
      "TagKey" : "owner",
      "TagValue" : "zhangsan"
    } ]
WorkingDirString执行路径。
CommandNameString命令名称。
CreateTimeString命令创建时间。
CommandContentString命令内容。以Base64编码后传输。
EnableParameterBoolean该命令是否启用自定义参数。取值:
  • true:启用自定义参数。
  • false:禁用自定义参数。
TimeoutString超时时间。
TypeString命令类型。
CommandIdString命令ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters: {}
    Resources:
      ExtensionDataSource:
        Type: DATASOURCE::ECS::Commands
        Properties:
          Type: RunShellScript
    Outputs:
      CommandIds:
        Description: The list of command IDs.
        Value:
          Fn::GetAtt:
            - ExtensionDataSource
            - CommandIds
      Commands:
        Description: The list of commands.
        Value:
          Fn::GetAtt:
            - ExtensionDataSource
            - Commands
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
      },
      "Resources": {
        "ExtensionDataSource": {
          "Type": "DATASOURCE::ECS::Commands",
          "Properties": {
            "Type": "RunShellScript"
          }
        }
      },
      "Outputs": {
        "CommandIds": {
          "Description": "The list of command IDs.",
          "Value": {
            "Fn::GetAtt": [
              "ExtensionDataSource",
              "CommandIds"
            ]
          }
        },
        "Commands": {
          "Description": "The list of commands.",
          "Value": {
            "Fn::GetAtt": [
              "ExtensionDataSource",
              "Commands"
            ]
          }
        }
      }
    }