All Products
Search
Document Center

Resource Orchestration Service:DATASOURCE::ECS::Commands

Last Updated:Oct 28, 2024

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,
    "RefreshOptions": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Type

String

No

Yes

The command type.

Valid values:

  • RunBatScript: batch command, applicable to Windows instances

  • RunPowerShellScript: PowerShell command, applicable to Windows instances

  • RunShellScript: shell command, applicable to Linux instances

Description

String

No

Yes

The description of the command.

None.

CommandId

String

No

Yes

The command ID.

None.

CommandName

String

No

Yes

The command name.

None.

RefreshOptions

String

No

Yes

The refresh policy for data source resources when the stack is updated.

Valid values:

  • Never (default): does not refresh data source resources when the stack is updated.

  • Always: refreshes data source resources when the stack is updated.

Return values

Fn::GetAtt

  • CommandIds: the IDs of the commands.

  • Commands: details of the commands.

Property

Type

Description

Constraint

CommandIds

List

The IDs of the commands.

None.

Commands

List

Details of the commands.

None.

ParameterNames

List

The custom parameter names that are parsed from the command content that you specified by using CommandContent when you created the command.

Example:

[ "['parameter1','parameter2']" ]

Description

String

The description of the command.

None.

Tags

List

The tags of the command.

Example:

 [ {
      "TagKey" : "owner",
      "TagValue" : "zhangsan"
    } ]

WorkingDir

String

The working directory.

None.

CommandName

String

The command name.

None.

CreateTime

String

The time when the command was created.

None.

CommandContent

String

The command content.

The command content is Base64-encoded.

EnableParameter

Boolean

Indicates whether the custom parameter feature is enabled for the command.

Valid values:

  • true

  • false

Timeout

String

The timeout period.

None.

Type

String

The command type.

None.

CommandId

String

The command ID.

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