DATASOURCE::ECS::Commands

更新时间:
复制 MD 格式

Queries all available commands that you manually 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 parsed from the command content specified in CommandContent when the command was created.

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 custom parameters are 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"
        ]
      }
    }
  }
}