Automation Assembler の単純な条件リストの代わりに詳細エディタを使用して、より複雑な条件式を構成し、アクションを使用できるタイミングを制御することができます。
新しいリソース アクションを作成する場合は、[条件が必要] および [詳細エディタの使用] を選択します。次に、必要な条件式を入力します。
式は、それぞれが key-operator-value (キー-演算子-値) の形式になっている 1 つの句または句のリストで表されます。前の図に、ターゲットがパワーオン状態であること、および存在することを要件とする基準を示します。
句
| 句 | 説明 | 例 |
|---|---|---|
| および | 式の結果が true になるには、すべてのサブ句が true になる必要があります。 | properties.powerState が ON であり、かつ syncStatus が MISSING でない場合のみ、true と評価されます。 matchExpression:
- and:
- key: properties.powerState
operator: eq
value: ON
- key: syncStatus
operator: notEq
value: MISSING
|
| または | 式の結果が true になるには、1 つ以上のサブ句が true になる必要があります。 | properties.powerState が ON または OFF の場合に、true と評価されます。 matchExpression:
- or:
- key: properties.powerState
operator: eq
value: ON
- key: properties.powerState
operator: eq
value: OFF
|
演算子
| 演算子 | 説明 | 例 |
|---|---|---|
| eq | 等しい。完全一致を検索します。 | properties.powerState が ON の場合に、true と評価されます。 matchExpression:
- and:
- key: properties.powerState
operator: eq
value: ON
|
| notEq | 等しくない。完全一致を除外します。 | properties.powerState が OFF の場合に、true と評価されます。 matchExpression:
- and:
- key: properties.powerState
operator: notEq
value: OFF
|
| hasAny | オブジェクトのコレクション内で一致を検索します。 | storage.disks 配列に 1 つの 100 IOPS EBS オブジェクトが含まれている場合に、true と評価されます。 matchExpression:
- key: storage.disks
operator: hasAny
value:
matchExpression:
- and:
- key: iops
operator: eq
value: 100
- key: service
operator: eq
value: ebs
|
| in | 一連の値内で一致を検索します。 | properties.powerState が OFF または SUSPEND のいずれかである場合に、true と評価されます。 matchExpression:
- and:
- key: properties.powerState
operator: in
value: OFF, SUSPEND
|
| notIn | 一連の値との一致を除外します。 | properties.powerState が OFF と SUSPEND のいずれでもない場合に、true と評価されます。 matchExpression:
- and:
- key: properties.powerState
operator: notIn
value: OFF, SUSPEND
|
| greaterThan | 指定したしきい値を超える一致を検索します。数値にのみ適用されます。 | storage.disks 配列内の最初のオブジェクトの IOPS が 50 を超えている場合に、true と評価されます。 matchExpression:
- and:
- key: storage.disks[0].iops
operator: greaterThan
value: 50
|
| lessThan | 指定したしきい値を下回る一致を検索します。数値にのみ適用されます。 | storage.disks 配列内の最初のオブジェクトの IOPS が 200 未満の場合に、true と評価されます。 matchExpression:
- and:
- key: storage.disks[0].iops
operator: lessThan
value: 200
|
| greaterThanEquals | 指定したしきい値以上となる一致を検索します。数値にのみ適用されます。 | storage.disks 配列内の最初のオブジェクトの IOPS が 100 以上の場合に、true と評価されます。 matchExpression:
- and:
- key: storage.disks[0].iops
operator: greaterThanEquals
value: 100
|
| lessThanEquals | 指定したしきい値以下となる一致を検索します。数値にのみ適用されます。 | storage.disks 配列内の最初のオブジェクトの IOPS が 100 以下の場合に、true と評価されます。 matchExpression:
- and:
- key: storage.disks[0].iops
operator: lessThanEquals
value: 100
|
| matchesRegex | 正規表現を使用して一致を検索します。 | properties.zone が us-east-1a または us-east-1c の場合に、true と評価されます。 matchExpression:
- and:
- key: properties.zone
operator: matchesRegex
value: (us-east-1)+(a|c){1,2}
|
例
次の基準式は、properties.tags に、キーが key1、値が value1 のタグが含まれている場合に、true と評価されます。
properties.tags が配列であるため、外側の式には hasAny が使用されます。配列内のすべてのキーと値ペアが key1=value1 になる場合に、true と評価されるようにすることができます。
内側の式には、キー フィールド用と値フィールド用の 2 つの句があります。Properties. tags 配列には、キーと値のタグ付けペアが保持されていて、キー フィールドと値フィールドの両方と一致する必要があります。
matchExpression:
- key: properties.tags
operator: hasAny
value:
matchExpression:
- and:
- key: key
operator: eq
value: key1
- key: value
operator: eq
value: value1
次の条件式は前の例と似ていますが、properties.tags に key1=value1 または key2=value2 となるタグが含まれている場合に、true と評価されます。
matchExpression:
- or:
- key: properties.tags
operator: hasAny
value:
matchExpression:
- and:
- key: key
operator: eq
value: key1
- key: value
operator: eq
value: value1
- key: properties.tags
operator: hasAny
value:
matchExpression:
- and:
- key: key
operator: eq
value: key2
- key: value
operator: eq
value: value2