{
  "components": {
    "parameters": {
      "resourceIdPathParam": {
        "description": "リソースID",
        "in": "path",
        "name": "id",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "CommonServiceItem": {
        "properties": {
          "Availability": {
            "type": "string"
          },
          "CreatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "Description": {
            "nullable": true,
            "type": "string"
          },
          "ID": {
            "description": "リソースID",
            "type": "string"
          },
          "Icon": {
            "$ref": "#/components/schemas/Icon"
          },
          "ModifiedAt": {
            "format": "date-time",
            "type": "string"
          },
          "Name": {
            "description": "リソース名",
            "type": "string"
          },
          "Provider": {
            "$ref": "#/components/schemas/Provider"
          },
          "ServiceClass": {
            "nullable": true,
            "type": "string"
          },
          "Settings": {
            "$ref": "#/components/schemas/Settings"
          },
          "SettingsHash": {
            "type": "string"
          },
          "Status": {
            "$ref": "#/components/schemas/Status"
          },
          "Tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "ID",
          "Name",
          "Settings",
          "SettingsHash",
          "Availability",
          "CreatedAt",
          "ModifiedAt",
          "Provider",
          "Tags"
        ],
        "type": "object"
      },
      "CreateCommonServiceItemRequest": {
        "properties": {
          "CommonServiceItem": {
            "properties": {
              "Description": {
                "nullable": true,
                "type": "string"
              },
              "Icon": {
                "$ref": "#/components/schemas/Icon"
              },
              "Name": {
                "description": "リソース名",
                "type": "string"
              },
              "Provider": {
                "$ref": "#/components/schemas/Provider"
              },
              "Settings": {
                "$ref": "#/components/schemas/Settings"
              },
              "Tags": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "Name",
              "Settings",
              "Provider"
            ],
            "type": "object"
          }
        },
        "required": [
          "CommonServiceItem"
        ],
        "type": "object"
      },
      "Error": {
        "properties": {
          "error_code": {
            "type": "string"
          },
          "error_msg": {
            "type": "string"
          },
          "is_fatal": {
            "type": "boolean"
          },
          "serial": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Icon": {
        "nullable": true,
        "properties": {
          "ID": {
            "type": "string"
          },
          "Name": {
            "type": "string"
          },
          "Scope": {
            "type": "string"
          },
          "Tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "URL": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ProcessConfigurationSettings": {
        "properties": {
          "Destination": {
            "description": "ジョブの宛先（simplenotification/simplemq/autoscale）",
            "enum": [
              "simplenotification",
              "simplemq",
              "autoscale"
            ],
            "type": "string"
          },
          "Parameters": {
            "description": "Destinationごとのパラメータ（group_id, message, queue_name, content等）",
            "type": "string"
          }
        },
        "required": [
          "Destination",
          "Parameters"
        ],
        "type": "object"
      },
      "Provider": {
        "properties": {
          "Class": {
            "enum": [
              "eventbusprocessconfiguration",
              "eventbusschedule",
              "eventbustrigger"
            ],
            "type": "string"
          },
          "ID": {
            "type": "integer"
          },
          "Name": {
            "type": "string"
          },
          "ServiceClass": {
            "type": "string"
          }
        },
        "required": [
          "Class"
        ],
        "type": "object"
      },
      "SacloudAPISecret": {
        "example": {
          "AccessToken": "アクセストークン",
          "AccessTokenSecret": "アクセストークンシークレット"
        },
        "properties": {
          "AccessToken": {
            "description": "さくらのクラウドのアクセストークン",
            "type": "string"
          },
          "AccessTokenSecret": {
            "description": "さくらのクラウドのアクセストークンシークレット",
            "type": "string"
          }
        },
        "required": [
          "AccessToken",
          "AccessTokenSecret"
        ],
        "type": "object"
      },
      "ScheduleSettings": {
        "properties": {
          "Crontab": {
            "description": "crontab形式",
            "type": "string"
          },
          "ProcessConfigurationID": {
            "description": "実行設定ID",
            "type": "string"
          },
          "RecurringStep": {
            "description": "実行間隔",
            "type": "integer"
          },
          "RecurringUnit": {
            "description": "実行間隔単位",
            "enum": [
              "min",
              "hour",
              "day"
            ],
            "type": "string"
          },
          "StartsAt": {
            "description": "スケジュール開始時刻（エポックミリ秒）\nリクエスト時はintegerで指定する必要があります。\nレスポンスはstringで返却されます。",
            "oneOf": [
              {
                "format": "int64",
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          }
        },
        "required": [
          "ProcessConfigurationID",
          "StartsAt"
        ],
        "type": "object"
      },
      "SetSecretRequest": {
        "properties": {
          "Secret": {
            "description": "設定するシークレット値",
            "oneOf": [
              {
                "$ref": "#/components/schemas/SacloudAPISecret"
              },
              {
                "$ref": "#/components/schemas/SimpleMQSecret"
              }
            ]
          }
        },
        "required": [
          "Secret"
        ],
        "type": "object"
      },
      "Settings": {
        "description": "実行設定(ProcessConfiguration)、トリガー(Trigger)またはスケジュール(Schedule)用設定",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ProcessConfigurationSettings"
          },
          {
            "$ref": "#/components/schemas/ScheduleSettings"
          },
          {
            "$ref": "#/components/schemas/TriggerSettings"
          }
        ]
      },
      "SimpleMQSecret": {
        "properties": {
          "APIKey": {
            "description": "SimpleMQのキューのAPIキー",
            "type": "string"
          }
        },
        "required": [
          "APIKey"
        ],
        "type": "object"
      },
      "Status": {
        "nullable": true,
        "properties": {
          "Message": {
            "type": "string"
          },
          "Success": {
            "type": "boolean"
          },
          "UpdatedAt": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "TriggerConditionEq": {
        "properties": {
          "Key": {
            "pattern": "^(?!data$)[a-z0-9]{1,20}$",
            "type": "string"
          },
          "Op": {
            "enum": [
              "eq"
            ],
            "type": "string"
          },
          "Values": {
            "items": {
              "type": "string"
            },
            "maxItems": 1,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "Key",
          "Op",
          "Values"
        ],
        "type": "object"
      },
      "TriggerConditionIn": {
        "properties": {
          "Key": {
            "pattern": "^(?!data$)[a-z0-9]{1,20}$",
            "type": "string"
          },
          "Op": {
            "enum": [
              "in"
            ],
            "type": "string"
          },
          "Values": {
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "Key",
          "Op",
          "Values"
        ],
        "type": "object"
      },
      "TriggerSettings": {
        "properties": {
          "Conditions": {
            "items": {
              "discriminator": {
                "mapping": {
                  "eq": "#/components/schemas/TriggerConditionEq",
                  "in": "#/components/schemas/TriggerConditionIn"
                },
                "propertyName": "Op"
              },
              "oneOf": [
                {
                  "$ref": "#/components/schemas/TriggerConditionEq"
                },
                {
                  "$ref": "#/components/schemas/TriggerConditionIn"
                }
              ]
            },
            "nullable": true,
            "type": "array"
          },
          "ProcessConfigurationID": {
            "type": "string"
          },
          "Source": {
            "type": "string"
          },
          "Types": {
            "items": {
              "type": "string"
            },
            "nullable": true,
            "type": "array"
          }
        },
        "required": [
          "Source",
          "ProcessConfigurationID"
        ],
        "type": "object"
      },
      "UpdateCommonServiceItemRequest": {
        "properties": {
          "CommonServiceItem": {
            "properties": {
              "Description": {
                "nullable": true,
                "type": "string"
              },
              "Icon": {
                "$ref": "#/components/schemas/Icon"
              },
              "Name": {
                "description": "リソース名",
                "type": "string"
              },
              "Provider": {
                "$ref": "#/components/schemas/Provider"
              },
              "Settings": {
                "$ref": "#/components/schemas/Settings"
              },
              "Tags": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "type": "object"
          }
        },
        "required": [
          "CommonServiceItem"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "description": "APIキーを利用したBasic認証",
        "scheme": "basic",
        "type": "http"
      }
    }
  },
  "info": {
    "contact": {
      "url": "https://help.sakura.ad.jp/contact/"
    },
    "description": "---\nCopyright SAKURA internet Inc.\n\n# はじめに\n\n「EventBus」は、さくらのクラウド上でイベント駆動型の処理を実現するためのサービスです。\nEventBusのリソース（実行設定・スケジュール・トリガー）を作成・削除するには、さくらのクラウド コントロールパネルか下記APIを利用します。\n詳細は[EventBus クラウドマニュアル](https://manual.sakura.ad.jp/cloud/appliance/eventbus/index.html)を参照してください。\n\n# 基本的な使い方\n## APIキーの発行\nAPIを利用するためには、認証のための「APIキー」が必要です。事前にキーを発行しておきます。\nAPIキーは「ユーザーID」「パスワード」に相当する「トークン」と呼ばれる認証情報で構成されています。\n|   項目名   | APIキー発行時の項目名        | このドキュメント内での例             |\n|------------|------------------------------|--------------------------------------|\n| ユーザーID | アクセストークン(UUID)       | 01234567-89ab-cdef-0123-456789abcdef |\n| パスワード | アクセストークンシークレット | SAMPLETOKENSAMPLETOKENSAMPLETOKENSAM |\n\u003cdiv class=\"warning\"\u003e\n  \u003cb\u003e操作マニュアル\u003c/b\u003e\u003cbr /\u003e\n  \u003cul\u003e\u003cli\u003e\u003ca href=\"https://manual.sakura.ad.jp/cloud/api/apikey.html\"\u003eAPIキー | さくらのクラウド ドキュメント\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\u003c/div\u003e\n\n## APIエンドポイント\nhttps://secure.sakura.ad.jp/cloud/zone/is1a/api/cloud/1.1",
    "title": "EventBus さくらのクラウドAPI",
    "version": "1.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/commonserviceitem": {
      "get": {
        "description": "Provider.Classでeventbusschedule、eventbustriggerまたはeventbusprocessconfigurationを指定してフィルタ可能。\nクエリパラメータに下記のようにフィルタを設定することでスケジュール、トリガーまたは実行設定のリソースのみを取得できます\n`/commonserviceitem?{\"Filter\":{\"Provider.Class\":\"eventbusschedule\"}}`\n`/commonserviceitem?{\"Filter\":{\"Provider.Class\":\"eventbustrigger\"}}`\n`/commonserviceitem?{\"Filter\":{\"Provider.Class\":\"eventbusprocessconfiguration\"}}`\n",
        "operationId": "listCommonServiceItems",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "CommonServiceItems": {
                      "items": {
                        "$ref": "#/components/schemas/CommonServiceItem"
                      },
                      "type": "array"
                    },
                    "Count": {
                      "type": "integer"
                    },
                    "From": {
                      "type": "integer"
                    },
                    "Total": {
                      "type": "integer"
                    },
                    "is_ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "CommonServiceItems"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "成功"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "error_code": "bad_request",
                  "error_msg": "不適切な要求です。パラメータの指定誤り、入力規則違反です。入力内容をご確認ください。",
                  "is_fatal": true,
                  "serial": "749ad39e1eea340c4d75bf5a4dd4bd11",
                  "status": "400 Bad Request"
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "不正なリクエスト"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "error_code": "unauthorized",
                  "error_msg": "error-unauthorized",
                  "is_fatal": true,
                  "serial": "749ad39e1eea340c4d75bf5a4dd4bd11",
                  "status": "401 Unauthorized"
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "認証エラー"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "サーバーエラー"
          }
        },
        "summary": "実行設定・スケジュール・トリガーの一覧取得"
      },
      "post": {
        "operationId": "createCommonServiceItem",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommonServiceItemRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "CommonServiceItem": {
                      "$ref": "#/components/schemas/CommonServiceItem"
                    },
                    "Success": {
                      "type": "boolean"
                    },
                    "is_ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "CommonServiceItem"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "成功"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "error_code": "bad_request",
                  "error_msg": "不適切な要求です。パラメータの指定誤り、入力規則違反です。入力内容をご確認ください。",
                  "is_fatal": true,
                  "serial": "749ad39e1eea340c4d75bf5a4dd4bd11",
                  "status": "400 Bad Request"
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "不正なリクエスト"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "error_code": "unauthorized",
                  "error_msg": "error-unauthorized",
                  "is_fatal": true,
                  "serial": "749ad39e1eea340c4d75bf5a4dd4bd11",
                  "status": "401 Unauthorized"
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "認証エラー"
          },
          "409": {
            "content": {
              "application/json": {
                "example": {
                  "error_code": "limit_count_in_account",
                  "error_msg": "要求を受け付けできません。プロジェクトあたりのリソース数上限により、リソースの割り当てに失敗しました。",
                  "is_fatal": true,
                  "serial": "749ad39e1eea340c4d75bf5a4dd4bd11",
                  "status": "409 Conflict"
                },
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "リソース名の重複、及びリソース作成数上限の超過"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "サーバーエラー"
          }
        },
        "summary": "実行設定・スケジュール・トリガーの作成"
      }
    },
    "/commonserviceitem/{id}": {
      "delete": {
        "operationId": "deleteCommonServiceItem",
        "parameters": [
          {
            "$ref": "#/components/parameters/resourceIdPathParam"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "CommonServiceItem": {
                      "$ref": "#/components/schemas/CommonServiceItem"
                    },
                    "Success": {
                      "type": "boolean"
                    },
                    "is_ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "CommonServiceItem"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "成功"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "不正なリクエスト"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "認証エラー"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "リソースが存在しない"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "サーバーエラー"
          }
        },
        "summary": "実行設定・スケジュール・トリガーの削除"
      },
      "get": {
        "operationId": "readCommonServiceItem",
        "parameters": [
          {
            "$ref": "#/components/parameters/resourceIdPathParam"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "CommonServiceItem": {
                      "$ref": "#/components/schemas/CommonServiceItem"
                    },
                    "is_ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "CommonServiceItem"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "成功"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "不正なリクエスト"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "認証エラー"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "リソースが存在しない"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "サーバーエラー"
          }
        },
        "summary": "実行設定・スケジュール・トリガーの取得"
      },
      "put": {
        "operationId": "updateCommonServiceItem",
        "parameters": [
          {
            "$ref": "#/components/parameters/resourceIdPathParam"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCommonServiceItemRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "CommonServiceItem": {
                      "$ref": "#/components/schemas/CommonServiceItem"
                    },
                    "Success": {
                      "type": "boolean"
                    },
                    "is_ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "CommonServiceItem"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "成功"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "不正なリクエスト"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "認証エラー"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "リソースが存在しない"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "サーバーエラー"
          }
        },
        "summary": "実行設定・スケジュール・トリガーの更新"
      }
    },
    "/commonserviceitem/{id}/eventbus/processconfiguration/set-secret": {
      "put": {
        "operationId": "setProcessConfigurationSecret",
        "parameters": [
          {
            "$ref": "#/components/parameters/resourceIdPathParam"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSecretRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "is_ok": {
                      "type": "boolean"
                    },
                    "process": {
                      "properties": {
                        "result": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "成功"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "不正なリクエスト"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "認証エラー"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "リソースが存在しない"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "サーバーエラー"
          }
        },
        "summary": "実行設定のSecret設定"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "servers": [
    {
      "description": "さくらのクラウドAPIエンドポイント",
      "url": "https://secure.sakura.ad.jp/cloud/zone/is1a/api/cloud/1.1"
    }
  ]
}
