{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/sakura-internet/main/json-schema/sakura-internet-automated-action-output-schema.json",
  "title": "AutomatedActionOutput",
  "description": "自動アクションの現在の状態を取得するためのレスポンスボディ。\n\n基本情報に加えて、識別子や作成日時など、システムによって付与される情報を含む。",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sakura-internet-security-control-openapi.yml#/components/schemas/AutomatedActionOutput",
  "type": "object",
  "required": [
    "automatedActionId",
    "name",
    "action",
    "executionCondition",
    "isEnabled",
    "createdAt"
  ],
  "properties": {
    "automatedActionId": {
      "allOf": [
        {
          "$ref": "#/$defs/AutomatedActionID"
        }
      ],
      "description": "自動アクションの一意な識別子。",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "description": "自動アクションの名称。"
    },
    "description": {
      "type": "string",
      "description": "自動アクションの説明。"
    },
    "action": {
      "allOf": [
        {
          "$ref": "#/$defs/ActionDefinition"
        }
      ],
      "description": "アクションの定義（アクションタイプごとに異なる）。"
    },
    "executionCondition": {
      "type": "string",
      "description": "どのような条件で自動アクションを実行するかの条件式。\nこの条件式を満たした場合にのみ、自動アクションが実行される。\nCEL（Common Expression Language）形式で記述する。"
    },
    "isEnabled": {
      "type": "boolean",
      "description": "自動アクションが有効かどうか。"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "自動アクションの作成日時。",
      "readOnly": true
    }
  },
  "$defs": {
    "ActionDefinition": {
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/$defs/ActionDefinitionSimpleNotification"
        },
        {
          "$ref": "#/$defs/ActionDefinitionWorkflows"
        }
      ]
    },
    "ActionDefinitionSimpleNotification": {
      "type": "object",
      "required": [
        "actionType",
        "actionParameter"
      ],
      "properties": {
        "actionType": {
          "type": "string",
          "enum": [
            "simpleNotification"
          ]
        },
        "actionParameter": {
          "$ref": "#/$defs/SakuraSimpleNotification"
        }
      }
    },
    "ActionDefinitionWorkflows": {
      "type": "object",
      "required": [
        "actionType",
        "actionParameter"
      ],
      "properties": {
        "actionType": {
          "type": "string",
          "enum": [
            "workflows"
          ]
        },
        "actionParameter": {
          "$ref": "#/$defs/SakuraWorkflows"
        }
      }
    },
    "AutomatedActionID": {
      "type": "string",
      "description": "自動アクションの一意な識別子。"
    },
    "SakuraSimpleNotification": {
      "type": "object",
      "required": [
        "servicePrincipalId",
        "notificationGroupId"
      ],
      "properties": {
        "servicePrincipalId": {
          "type": "string",
          "description": "さくらのクラウドの作成・削除権限を持つサービスプリンシパルID。\n\nこのサービスプリンシパルには `作成・削除` ロールが付与されている必要がある。\n付与されていない場合、自動アクションの実行に失敗する。"
        },
        "notificationGroupId": {
          "type": "string",
          "description": "通知先グループID"
        }
      }
    },
    "SakuraWorkflows": {
      "type": "object",
      "required": [
        "servicePrincipalId",
        "workflowId"
      ],
      "properties": {
        "servicePrincipalId": {
          "type": "string",
          "description": "さくらのクラウドの作成・削除権限を持つサービスプリンシパルID。\n\nこのサービスプリンシパルには `ワークフロー` ロールが付与されている必要がある。\n付与されていない場合、自動アクションの実行に失敗する。"
        },
        "workflowId": {
          "type": "string",
          "description": "ワークフローID"
        },
        "revisionId": {
          "type": "integer",
          "description": "実行したいワークフローのリビジョンID。\n指定しない場合は最新のリビジョンが使用される。"
        },
        "revisionAlias": {
          "type": "string",
          "description": "実行したいリビジョンのエイリアス。\n指定しない場合は最新のリビジョンが使用される。"
        },
        "args": {
          "type": "string",
          "description": "実行時にワークフローへ渡す引数（JSON文字列）。\n引数を要求するワークフローの場合は指定が必須。\n例: `{\\\"server_id\\\": 12345}`"
        },
        "name": {
          "type": "string",
          "description": "ワークフロー実行名。"
        }
      }
    }
  }
}