すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:ターゲットリソースの選択:ACS::SelectTargets

最終更新日:Jan 09, 2026

このアクションを使用すると、パラメーターを設定する際にリソースをバッチで選択できます。

目的

ACS::SelectTargets アクションを使用し、AssociationProperty パラメーターが Targets に設定されているテンプレートに基づいて実行を作成する場合、テンプレートを変更することなく、リソースを選択するメソッドを切り替えることができます。実行を作成する際、特定のリソースの選択、リソースタグの指定、すべてのリソースの選択、リソース ID を含む CSV ファイルのアップロード、在庫の指定といったメソッドのいずれかを使用して、一度に複数のリソースを選択できます。

selecttargets

構文

FormatVersion: OOS-2019-06-01
Description: 'ACS::SelectTargets の使用法'
Parameters:
  targets:  # リソース範囲を選択するために使用されるパラメーター名。
    Type: Json  # パラメーターのタイプ。Json である必要があります。
    AssociationProperty: Targets    # パラメーターに関連付けられたアクション。ACS::SelectTargets の場合、これは Targets である必要があります。
    AssociationPropertyMetadata:  # 選択するリソースの定義。
      ResourceType: ALIYUN::ECS::Instance # 選択するリソースのタイプ。
                    # ALIYUN::ECS::Instance: リソースは ECS インスタンスです。
                    # ALIYUN::ECD::Desktop: リソースはクラウドデスクトップインスタンスです。
                    # ALIYUN::RDS::Instance: リソースは ApsaraDB RDS インスタンスです。
                    # ALIYUN::Redis::Instance: リソースは Redis インスタンスです。
                    # ALIYUN::MongoDB::Instance: リソースは MongoDB インスタンスです。
                    # ALIYUN::ECS::ManagedInstance: リソースはマネージドインスタンスです。
                    # ALIYUN::ComputeNestSupplier::Instance: リソースは Compute Nest サービスインスタンスです。
                    # ALIYUN::SWAS::Instance: リソースは Simple Application Server インスタンスです。
Tasks:
  - Name: getInstance # タスク名。
    Action: 'ACS::SelectTargets'  # 特定のリソースを選択するアクション。
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'  # 選択するリソースのタイプ。
      Filters: # フィルタリングする範囲。
        - '{{ targets }}'  # リソース範囲のパラメーター名。
    Outputs:  # タスクの出力。
      instanceIds: # 出力パラメーターの名前。
        Type: List  # 出力パラメーターのタイプ。
        ValueSelector: 'Instances.Instance[].InstanceId'  # jq セレクター。リソースタイプの Describe OpenAPI 操作によって返された結果をフィルタリングします。たとえば、ECS インスタンスの場合、フィルターオブジェクトは DescribeInstances OpenAPI 操作の結果です。
{
  "FormatVersion": "OOS-2019-06-01",
  "Description": "ACS::SelectTargets usage",
  "Parameters": {
    "targets": {
      "Type": "Json",
      "AssociationProperty": "Targets",
      "AssociationPropertyMetadata": {
        "ResourceType": "ALIYUN::ECS::Instance"
      }
    }
  },
  "Tasks": [
    {
      "Name": "getInstance",
      "Action": "ACS::SelectTargets",
      "Properties": {
        "ResourceType": "ALIYUN::ECS::Instance",
        "Filters": [
          "{{ targets }}"
        ]
      },
      "Outputs": {
        "instanceIds": {
          "Type": "List",
          "ValueSelector": "Instances.Instance[].InstanceId"
        }
      }
    }
  ]
}

サンプルテンプレート

  • ECS インスタンスの一括起動

    FormatVersion: OOS-2019-06-01
    Description:
      en: ECS インスタンスをまとめて起動します。
      name-en: ACS-ECS-BulkyStartInstances
      categories:
        - instance_manage
    Parameters:
      targets:
        Type: Json
        AssociationProperty: Targets
        AssociationPropertyMetadata:
          ResourceType: 'ALIYUN::ECS::Instance'
      rateControl:
        Description:
          en: タスク実行の同時実行率。
        Type: Json
        AssociationProperty: RateControl
        Default:
          Mode: Concurrency
          MaxErrors: 0
          Concurrency: 10
      OOSAssumeRole:
        Description:
          en: OOS が引き受ける RAM ロール。
        Type: String
        Default: OOSServiceRole
    RamRole: '{{ OOSAssumeRole }}'
    Tasks:
      - Name: getInstance
        Description:
          en: ECS インスタンスを表示します。
        Action: 'ACS::SelectTargets'
        Properties:
          ResourceType: 'ALIYUN::ECS::Instance'
          Filters:
            - '{{ targets }}'
        Outputs:
          instanceIds:
            Type: List
            ValueSelector: 'Instances.Instance[].InstanceId'
      - Name: startInstance
        Action: 'ACS::ECS::StartInstance'
        Description:
          en: ECS インスタンスを起動します。
        Properties:
          instanceId: '{{ ACS::TaskLoopItem }}'
        Loop:
          RateControl: '{{ rateControl }}'
          Items: '{{ getInstance.instanceIds }}'
    Outputs:
      instanceIds:
        Type: List
        Value: '{{ getInstance.instanceIds }}'
    {
      "FormatVersion": "OOS-2019-06-01",
      "Description": {
        "en": "ECS インスタンスをまとめて起動します。",
        "name-en": "ACS-ECS-BulkyStartInstances",
        "categories": [
          "instance_manage"
        ]
      },
      "Parameters": {
        "targets": {
          "Type": "Json",
          "AssociationProperty": "Targets",
          "AssociationPropertyMetadata": {
            "ResourceType": "ALIYUN::ECS::Instance"
          }
        },
        "rateControl": {
          "Description": {
            "en": "タスク実行の同時実行率。"
          },
          "Type": "Json",
          "AssociationProperty": "RateControl",
          "Default": {
            "Mode": "Concurrency",
            "MaxErrors": 0,
            "Concurrency": 10
          }
        },
        "OOSAssumeRole": {
          "Description": {
            "en": "OOS が引き受ける RAM ロール。"
          },
          "Type": "String",
          "Default": "OOSServiceRole"
        }
      },
      "RamRole": "{{ OOSAssumeRole }}",
      "Tasks": [
        {
          "Name": "getInstance",
          "Description": {
            "en": "ECS インスタンスを取得します。"
          },
          "Action": "ACS::SelectTargets",
          "Properties": {
            "ResourceType": "ALIYUN::ECS::Instance",
            "Filters": [
              "{{ targets }}"
            ]
          },
          "Outputs": {
            "instanceIds": {
              "Type": "List",
              "ValueSelector": "Instances.Instance[].InstanceId"
            }
          }
        },
        {
          "Name": "startInstance",
          "Action": "ACS::ECS::StartInstance",
          "Description": {
            "en": "インスタンスを起動します。"
          },
          "Properties": {
            "instanceId": "{{ ACS::TaskLoopItem }}"
          },
          "Loop": {
            "RateControl": "{{ rateControl }}",
            "Items": "{{ getInstance.instanceIds }}"
          }
        }
      ],
      "Outputs": {
        "instanceIds": {
          "Type": "List",
          "Value": "{{ getInstance.instanceIds }}"
        }
      }
    }

さまざまなメソッドを使用した ECS インスタンス選択のための targets パラメーター設定例

  • インスタンス ID による選択

    targets:
      Type: ResourceIds
      RegionId: cn-hangzhou
      ResourceIds:
        - i-******************1
        - i-******************2
        - i-******************3
    {
      "targets": {
        "Type": "ResourceIds",
        "RegionId": "cn-hangzhou",
        "ResourceIds": [
          "i-******************1",
          "i-******************2",
          "i-******************3"
        ]
      }
    }
  • タグに基づいてインスタンスを選択します。最大 1,000 個のインスタンスを選択できます。さらに多くのインスタンスを選択するには、ACS::SelectTargets をご参照ください。

    targets:
      Type: Tags
      RegionId: cn-hangzhou
      Tags:
        - Key: key1
          Value: value1
        - Key: key2
          Value: value2
    {
      "targets": {
        "Type": "Tags",
        "RegionId": "cn-hangzhou",
        "Tags": [
          {
            "Key": "key1",
            "Value": "value1"
          },
          {
            "Key": "key2",
            "Value": "value2"
          }
        ]
      }
    }
  • リソースグループによる選択

    targets:
      Type: ResourceGroup
      RegionId: cn-hangzhou
      ResourceGroupId: rg-acf*********re3y
    {
      "targets": {
        "Type": "ResourceGroup",
        "RegionId": "cn-hangzhou",
        "ResourceGroupId": "rg-acf*********re3y"
      }
    }
  • すべての ECS インスタンスを選択する

    targets:
      Type: All
      RegionId: cn-hangzhou
      Parameters:
        RegionId: cn-hangzhou
        Status: Running
        Tags:
          - Key: key1
            Value: value1
    {
      "targets": {
        "Type": "All",
        "RegionId": "cn-hangzhou",
        "Parameters": {
          "RegionId": "cn-hangzhou",
          "Status": "Running",
          "Tags": [
            {
              "Key": "key1",
              "Value": "value1"
            }
          ]
        }
      }
    }
  • 指定された構成マニフェストの基準に基づく選択

    targets:
        Type: Inventory
        RegionId: cn-hangzhou
        InventoryFilters:
          - Name: TypeName
            Operator: Equal
            Value:
              - ACS:InstanceInformation
          - Name: ACS:InstanceInformation.Status
            Value:
              - Running
            Operator: Equal
    {
      "targets": {
        "Type": "Inventory",
        "RegionId": "cn-hangzhou",
        "InventoryFilters": [
          {
            "Name": "TypeName",
            "Operator": "Equal",
            "Value": [
              "ACS:InstanceInformation"
            ]
          },
          {
            "Name": "ACS:InstanceInformation.Status",
            "Value": [
              "Running"
            ],
            "Operator": "Equal"
          }
        ]
      }
    }

    指定されたアプリケーショングループ内でインスタンス ID によってインスタンスを選択

    targets:
      ResourceIds:
        - i-001
        - i-002
      ApplicationName: 'test'
      ApplicationGroupName: 'test'
      RegionId: cn-hangzhou
      Type: ApplicationGroup
    {
      "targets": {
        "ResourceIds": [
          "i-001",
          "i-002"
        ],
        "ApplicationName": "test",
        "ApplicationGroupName": "test",
        "RegionId": "cn-hangzhou",
        "Type": "ApplicationGroup"
      }
    }

    指定されたアプリケーショングループ内のすべてのインスタンスを選択

    targets:
      ApplicationName: 'test'
      ApplicationGroupName: 'test'
      RegionId: cn-hangzhou
      Type: ApplicationGroup
    {
      "targets": {
        "ApplicationName": "test",
        "ApplicationGroupName": "test",
        "RegionId": "cn-hangzhou",
        "Type": "ApplicationGroup"
      }
    }

targets パラメーターのサンプル設定 (Compute Nest サービスインスタンスを選択する場合)

  • Compute Nest インスタンスのサンプルテンプレートの取得

    FormatVersion: OOS-2019-06-01
    Parameters:
      RegionId:
        Type: String
        Label:
          en: リージョン ID
          zh-cn: リージョン ID
        AssociationProperty: RegionId
        Default: '{{ ACS::RegionId }}'
      Targets:
        Type: Json
        Label:
          en: ターゲットインスタンス
          zh-cn: ターゲットインスタンス
        AssociationProperty: Targets
        AssociationPropertyMetadata:
          ResourceType: ALIYUN::ComputeNestSupplier::Instance
          RegionId: RegionId
      RateControl:
        Label:
          en: レート制御
          zh-cn: タスク実行の同時実行率
        Type: Json
        AssociationProperty: RateControl
        Default:
          Mode: Concurrency
          MaxErrors: 0
          Concurrency: 1
      OOSAssumeRole:
        Label:
          en: OOSAssumeRole
          zh-cn: OOS が引き受ける RAM ロール
        Type: String
    RamRole: '{{ OOSAssumeRole }}'
    Tasks:
      - Name: GetServiceInstance
        Description:
          en: Compute Nest サプライヤーインスタンスを表示します
          zh-cn: Compute Nest のサプライヤー側からサービスインスタンスを取得します
        Action: ACS::SelectTargets
        Properties:
          ResourceType: ALIYUN::ComputeNestSupplier::Instance
          RegionId: '{{ RegionId }}'
          Filters:
            - '{{ Targets }}'
        Outputs:
          InstanceIds:
            Type: List
            ValueSelector: ServiceInstances[].ServiceInstanceId
    Metadata:
      ALIYUN::OOS::Interface:
        ParameterGroups:
          - Parameters:
              - RegionId
              - Targets
            Label:
              default:
                zh-cn: 設定パラメーター
                en: パラメーターの設定
          - Parameters:
              - RateControl
              - OOSAssumeRole
            Label:
              default:
                zh-cn: 詳細オプション
                en: 制御オプション
    {
      "FormatVersion": "OOS-2019-06-01",
      "Parameters": {
        "RegionId": {
          "Type": "String",
          "Label": {
            "en": "リージョン ID",
            "zh-cn": "リージョン ID"
          },
          "AssociationProperty": "RegionId",
          "Default": "{{ ACS::RegionId }}"
        },
        "Targets": {
          "Type": "Json",
          "Label": {
            "en": "ターゲットインスタンス",
            "zh-cn": "ターゲットインスタンス"
          },
          "AssociationProperty": "Targets",
          "AssociationPropertyMetadata": {
            "ResourceType": "ALIYUN::ComputeNestSupplier::Instance",
            "RegionId": "RegionId"
          }
        },
        "RateControl": {
          "Label": {
            "en": "レート制御",
            "zh-cn": "タスク実行の同時実行率"
          },
          "Type": "Json",
          "AssociationProperty": "RateControl",
          "Default": {
            "Mode": "Concurrency",
            "MaxErrors": 0,
            "Concurrency": 1
          }
        },
        "OOSAssumeRole": {
          "Label": {
            "en": "OOSAssumeRole",
            "zh-cn": "OOS が引き受ける RAM ロール"
          },
          "Type": "String"
        }
      },
      "RamRole": "{{ OOSAssumeRole }}",
      "Tasks": [
        {
          "Name": "GetServiceInstance",
          "Description": {
            "en": "Compute Nest サプライヤーインスタンスを表示します",
            "zh-cn": "Compute Nest のサプライヤー側でサービスインスタンスを取得します"
          },
          "Action": "ACS::SelectTargets",
          "Properties": {
            "ResourceType": "ALIYUN::ComputeNestSupplier::Instance",
            "RegionId": "{{ RegionId }}",
            "Filters": [
              "{{ Targets }}"
            ]
          },
          "Outputs": {
            "InstanceIds": {
              "Type": "List",
              "ValueSelector": "ServiceInstances[].ServiceInstanceId"
            }
          }
        }
      ],
      "Metadata": {
        "ALIYUN::OOS::Interface": {
          "ParameterGroups": [
            {
              "Parameters": [
                "RegionId",
                "Targets"
              ],
              "Label": {
                "default": {
                  "zh-cn": "設定パラメーター",
                  "en": "パラメーターの設定"
                }
              }
            },
            {
              "Parameters": [
                "RateControl",
                "OOSAssumeRole"
              ],
              "Label": {
                "default": {
                  "zh-cn": "詳細オプション",
                  "en": "制御オプション"
                }
              }
            }
          ]
        }
      }
    }
  • 例:インスタンス ID によるパラメーターの選択

    targets:
      ResourceIds:
        - si-9b136xxxxxxxxxxxxxxx
        - si-f63edxxxxxxxxxxxxxxx
      RegionId: cn-hangzhou
      Type: ResourceIds
    {
      "targets": {
        "ResourceIds": [
          "si-9b1363ae63664f19a156",
          "si-f63ed519cc3445eebdcd"
        ],
        "RegionId": "cn-hangzhou",
        "Type": "ResourceIds"
      }
    }
  • 中国 (杭州) リージョンにデプロイされ、サービス ID が service-xxxx 形式で、サービスバージョンが 4 であるすべてのサービスインスタンスを選択します。

    targets:
      Type: All
      RegionId: cn-hangzhou
      Parameters:
        Filter:
          - Name: Status
            Value:
              - Deployed
          - Name: 'Version '
            Value:
              - '4'
          - Name: ServiceId
            Value:
              - ervice-ea89c844c3e9430a9b9c
        RegionId: cn-hangzhou
    {
    	"targets": {
    		"Type": "All",
    		"RegionId": "cn-hangzhou",
    		"Parameters": {
    			"Filter": [{
    					"Name": "Status",
    					"Value": [
    						"Deployed"
    					]
    				},
    				{
    					"Name": "Version ",
    					"Value": ["4"]
    				},
    				{
    					"Name": "ServiceId",
    					"Value": ["ervice-ea89c844c3e9430a9b9c"]
    				}
    			],
    			"RegionId": "cn-hangzhou"
    		}
    	}
    }
  • タグで ECS インスタンスを選択し、コマンドテンプレートを実行します。

    FormatVersion: OOS-2019-06-01
    Description:
      en: タグを使用してインスタンスをクエリし、コマンドを実行します。
      zh-cn: タグを使用してインスタンスをクエリし、コマンドを実行します。
      name-en: コマンドの実行
      name-zh-cn: コマンドの実行
      categories:
        - run_command
        - application_manage
        - computenest
        - tag_operate_resource
    Parameters:
      regionId:
        Type: String
        Label:
          en: リージョン ID
          zh-cn: リージョン ID
        AssociationProperty: RegionId
        Default: '{{ ACS::RegionId }}'
      tags:
        Description:
          name-en: タグ
          name-zh-cn: タグ
          en: 'フォーマット: [{"Key":"k1","Value":"v1"},{"Key":"k2","Value":"v2"}....].'
          zh-cn: 'フォーマット: [{"Key":"k1","Value":"v1"},{"Key":"k2","Value":"v2"}....].'
        Type: Json
        AssociationProperty: Tags
      commandType:
        Label:
          en: コマンドタイプ
          zh-cn: コマンドタイプ
        AssociationPropertyMetadata:
          LocaleKey: ECSCommandType
        Type: String
        AllowedValues:
          - RunShellScript
          - RunPythonScript
          - RunPerlScript
          - RunBatScript
          - RunPowerShellScript
        Default: RunShellScript
      commandContent:
        Label:
          en: コマンド内容
          zh-cn: コマンド内容
        Type: String
        MaxLength: 16384
        AssociationProperty: ALIYUN::OOS::Command::CommandContent
        AssociationPropertyMetadata:
          CommandType: ${commandType}
      workingDir:
        Description:
          en: 'Linux インスタンスの場合、デフォルトの作業ディレクトリは管理者 (root ユーザー) のホームディレクトリである /root です。Windows インスタンスの場合、デフォルトの作業ディレクトリは、C:\Windows\System32 など、クラウドアシスタントクライアントプロセスが配置されているディレクトリです。有効なディレクトリを入力してください。'
          zh-cn: 'Linux インスタンスの場合、デフォルトの作業ディレクトリは管理者 (root ユーザー) のホームディレクトリである /root です。Windows インスタンスの場合、デフォルトの作業ディレクトリは、C:\Windows\System32 など、クラウドアシスタントクライアントプロセスが配置されているディレクトリです。有効なディレクトリを入力してください。'
        Label:
          en: 作業ディレクトリ
          zh-cn: 作業ディレクトリ
        Type: String
        Default: ''
        AssociationPropertyMetadata:
          Value:
            - Condition:
                Fn::Or:
                  - Fn::Equals:
                      - ${commandType}
                      - RunShellScript
                  - Fn::Equals:
                      - ${commandType}
                      - RunPythonScript
                  - Fn::Equals:
                      - ${commandType}
                      - RunPerlScript
              Value: /root
            - Condition:
                Fn::Or:
                  - Fn::Equals:
                      - ${commandType}
                      - RunBatScript
                  - Fn::Equals:
                      - ${commandType}
                      - RunPowerShellScript
              Value: C:\\Windows\\System32
      timeout:
        Label:
          en: タイムアウト
          zh-cn: タイムアウト
        Type: Number
        Default: 600
      enableParameter:
        Label:
          en: カスタムパラメーターまたは暗号化されたパラメーターの有効化
          zh-cn: カスタムパラメーターまたは暗号化されたパラメーターの有効化
        Type: Boolean
        Default: false
      username:
        Description:
          en: ECS インスタンスでコマンドを実行するために使用されるユーザー名。ユーザー名は最大 255 文字です。デフォルトでは、コマンドは Linux インスタンスでは root ユーザーとして、Windows インスタンスでは System ユーザーとして実行されます。入力したユーザー名が正しいことを確認してください。<a href="https://www.alibabacloud.com/help/doc-detail/203771.html" target="_blank">詳細はこちら</a>
          zh-cn: ECS インスタンスでコマンドを実行するために使用されるユーザー名。ユーザー名は最大 255 文字です。デフォルトでは、コマンドは Linux インスタンスでは root ユーザーとして、Windows インスタンスでは System ユーザーとして実行されます。入力したユーザー名が正しいことを確認してください。<a href="https://www.alibabacloud.com/help/doc-detail/203771.html" target="_blank">詳細はこちら</a>
        Label:
          en: ユーザー名
          zh-cn: ユーザー名
        Type: String
        Default: ''
      windowsPasswordName:
        Label:
          en: Windows ユーザーのパスワード名
          zh-cn: Windows ユーザーのパスワード名
        Type: String
        Default: ''
        AssociationProperty: ALIYUN::OOS::SecretParameter::Value
        AssociationPropertyMetadata:
          Visible:
            Condition:
              Fn::Or:
                - Fn::Equals:
                    - ${commandType}
                    - RunBatScript
                - Fn::Equals:
                    - ${commandType}
                    - RunPowerShellScript
      rateControl:
        Label:
          en: タスク実行の同時実行数
          zh-cn: タスク実行の同時実行数
        Type: Json
        AssociationProperty: RateControl
        Default:
          Mode: Concurrency
          MaxErrors: 0
          Concurrency: 10
      OOSAssumeRole:
        Label:
          en: OOS の RAM ロール
          zh-cn: OOS の RAM ロール
        Type: String
        Default: ''
    RamRole: '{{ OOSAssumeRole }}'
    Tasks:
      - Name: ListInstance
        Action: ACS::ExecuteAPI
        Description:
          en: タグを使用してインスタンスをクエリします。
          zh-cn: タグを使用してインスタンスをクエリします。
        Properties:
          Service: ECS
          API: ListTagResources
          Parameters:
            RegionId: '{{ regionId }}'
            ResourceType: instance
            Tag: '{{ tags }}'
        Outputs:
          instanceIds:
            Type: List
            ValueSelector: .TagResources.TagResource[].ResourceId
      - Name: runCommand
        Action: ACS::ECS::RunCommand
        Description:
          en: クラウドアシスタントコマンドを実行します。
          zh-cn: クラウドアシスタントコマンドを実行します。
        Properties:
          regionId: '{{ regionId }}'
          commandContent: '{{ commandContent }}'
          instanceId: '{{ ACS::TaskLoopItem }}'
          commandType: '{{ commandType }}'
          workingDir: '{{ workingDir }}'
          timeout: '{{ timeout }}'
          enableParameter: '{{ enableParameter }}'
          username: '{{ username }}'
          windowsPasswordName: '{{ windowsPasswordName }}'
          contentEncoding: PlainText
          parameters: {}
          maxRetryInterval: 300
        Outputs:
          commandOutput:
            Type: String
            ValueSelector: invocationOutput
        Loop:
          Items: '{{ ListInstance.instanceIds }}'
          RateControl: '{{ rateControl }}'
          Outputs:
            commandOutputs:
              AggregateType: Fn::ListJoin
              AggregateField: commandOutput
    Outputs:
      commandOutputs:
        Type: List
        Value: '{{ runCommand.commandOutputs }}'
    Metadata:
      ALIYUN::OOS::Interface:
        ParameterGroups:
          - Parameters:
              - commandType
              - commandContent
              - workingDir
              - timeout
              - enableParameter
              - username
              - windowsPasswordName
            Label:
              default:
                zh-cn: コマンド実行オプション
                en: コマンド実行オプション
          - Parameters:
              - regionId
              - tags
            Label:
              default:
                zh-cn: ECS インスタンスの選択
                en: ECS インスタンスの選択
          - Parameters:
              - rateControl
              - OOSAssumeRole
            Label:
              default:
                zh-cn: 詳細オプション
                en: 詳細オプション
    
    {
      "FormatVersion": "OOS-2019-06-01",
      "Description": {
        "en": "タグを介してインスタンスをクエリし、コマンドを実行します。",
        "zh-cn": "タグを使用してインスタンスをクエリし、コマンドを実行します。",
        "name-en": "コマンドの実行",
        "name-zh-cn": "コマンドの実行",
        "categories": [
          "run_command",
          "application_manage",
          "computenest",
          "tag_operate_resource"
        ]
      },
      "Parameters": {
        "regionId": {
          "Type": "String",
          "Label": {
            "en": "リージョン ID",
            "zh-cn": "リージョン ID"
          },
          "AssociationProperty": "RegionId",
          "Default": "{{ ACS::RegionId }}"
        },
        "tags": {
          "Description": {
            "name-en": "タグ",
            "name-zh-cn": "タグ",
            "en": "フォーマット:[{\"Key\":\"k1\",\"Value\":\"v1\"},{\"Key\":\"k2\",\"Value\":\"v2\"}....].",
            "zh-cn": "入力フォーマット: [{\"Key\":\"k1\",\"Value\":\"v1\"},{\"Key\":\"k2\",\"Value\":\"v2\"}....]"
          },
          "Type": "Json",
          "AssociationProperty": "Tags"
        },
        "commandType": {
          "Label": {
            "en": "コマンドタイプ",
            "zh-cn": "コマンドタイプ"
          },
          "AssociationPropertyMetadata": {
            "LocaleKey": "ECSCommandType"
          },
          "Type": "String",
          "AllowedValues": [
            "RunShellScript",
            "RunPythonScript",
            "RunPerlScript",
            "RunBatScript",
            "RunPowerShellScript"
          ],
          "Default": "RunShellScript"
        },
        "commandContent": {
          "Label": {
            "en": "コマンド内容",
            "zh-cn": "コマンド内容"
          },
          "Type": "String",
          "MaxLength": 16384,
          "AssociationProperty": "ALIYUN::OOS::Command::CommandContent",
          "AssociationPropertyMetadata": {
            "CommandType": "${commandType}"
          }
        },
        "workingDir": {
          "Description": {
            "en": "Linux インスタンス: 管理者 (root ユーザー) のホームディレクトリ配下: /root。Windows インスタンス: クラウドアシスタントクライアントのプロセスが配置されているディレクトリ配下、例: C:\\Windows\\System32。正しいディレクトリを入力してください。",
            "zh-cn": "Linux インスタンスの場合、デフォルトの作業ディレクトリは管理者 (root ユーザー) のホームディレクトリである /root です。Windows インスタンスの場合、デフォルトの作業ディレクトリは、C:\\Windows\\System32 など、クラウドアシスタントクライアントプロセスが配置されているディレクトリです。入力したディレクトリが正しいことを確認してください。"
          },
          "Label": {
            "en": "作業ディレクトリ",
            "zh-cn": "作業ディレクトリ"
          },
          "Type": "String",
          "Default": "",
          "AssociationPropertyMetadata": {
            "Value": [
              {
                "Condition": {
                  "Fn::Or": [
                    {
                      "Fn::Equals": [
                        "${commandType}",
                        "RunShellScript"
                      ]
                    },
                    {
                      "Fn::Equals": [
                        "${commandType}",
                        "RunPythonScript"
                      ]
                    },
                    {
                      "Fn::Equals": [
                        "${commandType}",
                        "RunPerlScript"
                      ]
                    }
                  ]
                },
                "Value": "/root"
              },
              {
                "Condition": {
                  "Fn::Or": [
                    {
                      "Fn::Equals": [
                        "${commandType}",
                        "RunBatScript"
                      ]
                    },
                    {
                      "Fn::Equals": [
                        "${commandType}",
                        "RunPowerShellScript"
                      ]
                    }
                  ]
                },
                "Value": "C:\\\\Windows\\\\System32"
              }
            ]
          }
        },
        "timeout": {
          "Label": {
            "en": "タイムアウト",
            "zh-cn": "タイムアウト"
          },
          "Type": "Number",
          "Default": 600
        },
        "enableParameter": {
          "Label": {
            "en": "EnableParameter",
            "zh-cn": "暗号化されたパラメーターまたはカスタムパラメーターを有効にする"
          },
          "Type": "Boolean",
          "Default": false
        },
        "username": {
          "Description": {
            "en": "ECS インスタンスでコマンドを実行するために使用されるユーザー名。長さは 255 文字を超えてはなりません。Linux システムの ECS インスタンスでは、デフォルトは root です。Windows システムの ECS インスタンスでは、デフォルトは System です。正しいユーザー名を入力してください。<a href=\"https://www.alibabacloud.com/help/doc-detail/203771.html\" target=\"_blank\">詳細はこちら</a>",
            "zh-cn": "ECS インスタンスでコマンドを実行するユーザーの名前。名前の長さは 255 文字までです。Linux インスタンスの場合、コマンドはデフォルトで root ユーザーによって実行されます。Windows インスタンスの場合、コマンドはデフォルトで System ユーザーによって実行されます。入力したユーザー名が正しいことを確認してください。<a href=\"https://www.alibabacloud.com/help/doc-detail/203771.html\" target=\"_blank\">詳細はこちら</a>"
          },
          "Label": {
            "en": "ユーザー名",
            "zh-cn": "ユーザー名"
          },
          "Type": "String",
          "Default": ""
        },
        "windowsPasswordName": {
          "Label": {
            "en": "WindowsPasswordName",
            "zh-cn": "Windows ユーザーのパスワード名"
          },
          "Type": "String",
          "Default": "",
          "AssociationProperty": "ALIYUN::OOS::SecretParameter::Value",
          "AssociationPropertyMetadata": {
            "Visible": {
              "Condition": {
                "Fn::Or": [
                  {
                    "Fn::Equals": [
                      "${commandType}",
                      "RunBatScript"
                    ]
                  },
                  {
                    "Fn::Equals": [
                      "${commandType}",
                      "RunPowerShellScript"
                    ]
                  }
                ]
              }
            }
          }
        },
        "rateControl": {
          "Label": {
            "en": "レート制御",
            "zh-cn": "タスク実行のレート制御"
          },
          "Type": "Json",
          "AssociationProperty": "RateControl",
          "Default": {
            "Mode": "Concurrency",
            "MaxErrors": 0,
            "Concurrency": 10
          }
        },
        "OOSAssumeRole": {
          "Label": {
            "en": "OOSAssumeRole",
            "zh-cn": "OOS が引き受ける RAM ロール"
          },
          "Type": "String",
          "Default": ""
        }
      },
      "RamRole": "{{ OOSAssumeRole }}",
      "Tasks": [
        {
          "Name": "ListInstance",
          "Action": "ACS::ExecuteAPI",
          "Description": {
            "en": "eip を一覧表示します。",
            "zh-cn": "タグを使用してインスタンスをクエリします。"
          },
          "Properties": {
            "Service": "ECS",
            "API": "ListTagResources",
            "Parameters": {
              "RegionId": "{{ regionId }}",
              "ResourceType": "instance",
              "Tag": "{{ tags }}"
            }
          },
          "Outputs": {
            "instanceIds": {
              "Type": "List",
              "ValueSelector": ".TagResources.TagResource[].ResourceId"
            }
          }
        },
        {
          "Name": "runCommand",
          "Action": "ACS::ECS::RunCommand",
          "Description": {
            "en": "クラウドアシスタントコマンドを実行します",
            "zh-cn": "クラウドアシスタントコマンドを実行します。"
          },
          "Properties": {
            "regionId": "{{ regionId }}",
            "commandContent": "{{ commandContent }}",
            "instanceId": "{{ ACS::TaskLoopItem }}",
            "commandType": "{{ commandType }}",
            "workingDir": "{{ workingDir }}",
            "timeout": "{{ timeout }}",
            "enableParameter": "{{ enableParameter }}",
            "username": "{{ username }}",
            "windowsPasswordName": "{{ windowsPasswordName }}",
            "contentEncoding": "PlainText",
            "parameters": {},
            "maxRetryInterval": 300
          },
          "Outputs": {
            "commandOutput": {
              "Type": "String",
              "ValueSelector": "invocationOutput"
            }
          },
          "Loop": {
            "Items": "{{ ListInstance.instanceIds }}",
            "RateControl": "{{ rateControl }}",
            "Outputs": {
              "commandOutputs": {
                "AggregateType": "Fn::ListJoin",
                "AggregateField": "commandOutput"
              }
            }
          }
        }
      ],
      "Outputs": {
        "commandOutputs": {
          "Type": "List",
          "Value": "{{ runCommand.commandOutputs }}"
        }
      },
      "Metadata": {
        "ALIYUN::OOS::Interface": {
          "ParameterGroups": [
            {
              "Parameters": [
                "commandType",
                "commandContent",
                "workingDir",
                "timeout",
                "enableParameter",
                "username",
                "windowsPasswordName"
              ],
              "Label": {
                "default": {
                  "zh-cn": "コマンド実行オプション",
                  "en": "コマンド実行オプション"
                }
              }
            },
            {
              "Parameters": [
                "regionId",
                "tags"
              ],
              "Label": {
                "default": {
                  "zh-cn": "インスタンスの選択",
                  "en": "ECS インスタンスの選択"
                }
              }
            },
            {
              "Parameters": [
                "rateControl",
                "OOSAssumeRole"
              ],
              "Label": {
                "default": {
                  "zh-cn": "詳細オプション",
                  "en": "制御オプション"
                }
              }
            }
          ]
        }
      }
    }