mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 07:12:46 +01:00
111 lines
3.7 KiB
YAML
111 lines
3.7 KiB
YAML
swagger: "2.0"
|
|
info: { version: "", title: "" }
|
|
|
|
paths:
|
|
/rules:
|
|
get:
|
|
tags: [ "rules" ]
|
|
summary: "List rules"
|
|
operationId: "listRules"
|
|
responses:
|
|
"200":
|
|
description: "successful operation"
|
|
schema: { type: array, items: { $ref: "#/definitions/RuleResponse" } }
|
|
examples:
|
|
test:
|
|
- id: ignore-alerts
|
|
name: Ignore Alerts
|
|
condition: "type == 'alert'"
|
|
update: { "status": "closed" }
|
|
security: [ { roles: [ "rule:read" ] } ]
|
|
post:
|
|
tags: [ "rules" ]
|
|
summary: "Create a rule"
|
|
operationId: "createRule"
|
|
parameters:
|
|
- { name: "rule", in: "body", description: "New rule", required: true, schema: { $ref: "#/definitions/RuleForm" }, x-example: { name: "Ignore all Alerts", condition: "type == 'alert'", update: { "status": "closed" } } }
|
|
responses:
|
|
"200":
|
|
description: "successful operation"
|
|
schema: { type: array, items: { $ref: "#/definitions/RuleResponse" } }
|
|
examples:
|
|
test:
|
|
id: ignore-all-alerts
|
|
name: Ignore all Alerts
|
|
condition: "type == 'alert'"
|
|
update: { "status": "closed" }
|
|
security: [ { roles: [ "rule:write" ] } ]
|
|
|
|
/rules/{id}:
|
|
get:
|
|
tags: [ "rules" ]
|
|
summary: "Get a single rule"
|
|
operationId: "getRule"
|
|
parameters:
|
|
- { name: "id", in: "path", description: "Rule name", required: true, type: string, x-example: "ignore-alerts" }
|
|
responses:
|
|
"200":
|
|
description: "successful operation"
|
|
schema: { $ref: "#/definitions/RuleResponse" }
|
|
examples:
|
|
test:
|
|
id: ignore-alerts
|
|
name: Ignore Alerts
|
|
condition: "type == 'alert'"
|
|
update: { "status": "closed" }
|
|
security: [ { roles: [ "rule:read" ] } ]
|
|
put:
|
|
tags: [ "rules" ]
|
|
summary: "Update an existing ticket rule"
|
|
operationId: "updateRule"
|
|
parameters:
|
|
- { name: "id", in: "path", description: "Rule ID", required: true, type: string, x-example: "ignore-alerts" }
|
|
- { name: "rule", in: "body", description: "Updated rule", required: true, schema: { $ref: "#/definitions/RuleForm" }, x-example: { name: "Ignore Alerts", condition: "type == 'alert'", update: { "status": "invalid" } } }
|
|
responses:
|
|
"200":
|
|
description: "successful operation"
|
|
schema: { $ref: "#/definitions/RuleResponse" }
|
|
examples:
|
|
test:
|
|
id: ignore-alerts
|
|
name: Ignore Alerts
|
|
condition: "type == 'alert'"
|
|
update: { "status": "invalid" }
|
|
security: [ { roles: [ "rule:write" ] } ]
|
|
delete:
|
|
tags: [ "rules" ]
|
|
summary: "Delete a rule"
|
|
operationId: "deleteRule"
|
|
parameters:
|
|
- { name: "id", in: "path", description: "Rule name", required: true, type: string, x-example: "ignore-alerts" }
|
|
responses:
|
|
"204": { description: "successful operation" }
|
|
security: [ { roles: [ "rule:write" ] } ]
|
|
|
|
definitions:
|
|
RuleForm:
|
|
type: object
|
|
required: [ name, condition, update ]
|
|
properties:
|
|
id: { type: string }
|
|
name: { type: string }
|
|
condition: { type: string }
|
|
update: { type: object }
|
|
|
|
Rule:
|
|
type: object
|
|
required: [ name, condition, update ]
|
|
properties:
|
|
name: { type: string }
|
|
condition: { type: string }
|
|
update: { type: object }
|
|
|
|
RuleResponse:
|
|
type: object
|
|
required: [ id, name, condition, update ]
|
|
properties:
|
|
id: { type: string }
|
|
name: { type: string }
|
|
condition: { type: string }
|
|
update: { type: object }
|