DATASOURCE::ECS::Commands is used to query all available commands that you created.

Syntax

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

Properties

PropertyTypeRequiredEditableDescriptionConstraint
TypeStringNoYesThe type of the command. Valid values:
  • RunBatScript: batch command, applicable to Windows instances
  • RunPowerShellScript: PowerShell command, applicable to Windows instances
  • RunShellScript: shell command, applicable to Linux instances
DescriptionStringNoYesThe description of the command. None.
CommandIdStringNoYesThe ID of the command. None.
CommandNameStringNoYesThe name of the command. None.

Return values

Fn::GetAtt

  • CommandIds: the IDs of the commands.
  • Commands: details of the commands.
PropertyTypeDescriptionConstraint
CommandIdsListThe IDs of the commands. None.
CommandsListDetails of the commands. None.
ParameterNamesListThe custom parameter names that are parsed from the command content that you specified by using CommandContent when you created the command. Example:
[ "['parameter1','parameter2']" ]
DescriptionStringThe description of the command. None.
TagsListThe tags of the command. Example:
 [ {
      "TagKey" : "owner",
      "TagValue" : "zhangsan"
    } ]
WorkingDirStringThe working directory of the command. None.
CommandNameStringThe name of the command. None.
CreateTimeStringThe time when the command was created. None.
CommandContentStringThe command content. The command content is Base64-encoded.
EnableParameterBooleanIndicates whether the custom parameter feature is enabled for the command. Valid values:
  • true
  • false
TimeoutStringThe timeout period. None.
TypeStringThe type of the command. None.
CommandIdStringThe ID of the command. None.

Examples

  • YAML format

    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 format

    {
      "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"
            ]
          }
        }
      }
    }