前のステップのデータに基づいて決定を下すには、switch ステートメントを使用します。
switch ステートメントで有効になるもの:
- 条件に基づいて決定木を作成する
- データ値に基づいてワークフロー実行をさまざまなステップにルーティングします
- 複数の条件を順番に評価する
- 条件が一致しない場合のデフォルトの動作を定義する
データを使った条件付きロジック
steps: - name: checkCPU type: action action: newrelic.nerdgraph.execute version: 1 # ... query configuration
- name: decideAction type: switch switch: - condition: "${{ .steps.checkCPU.outputs.data.actor.account.nrql.results[0].average > 90 }}" next: resizeInstance - condition: "${{ .steps.checkCPU.outputs.data.actor.account.nrql.results[0].average > 70 }}" next: sendWarning next: normalOperation
- name: resizeInstance type: action action: aws.ec2.modifyInstanceAttribute version: 1 # ... resize configuration
- name: sendWarning type: action action: slack.chat.postMessage version: 1 # ... warning message
- name: normalOperation type: action action: newrelic.ingest.sendLogs version: 1 # ... log normal status次のステップ
- 共通インテグレーション: 実際のインテグレーションにパターンを適用する
- 高度なワークフロー: 複雑な決定木