-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(openapi): Add basic openapi structure
Create basic openapi sctructure for future contributions Relates #44
- Loading branch information
litleleprikon
committed
Oct 18, 2019
1 parent
0a2df9b
commit 564560e
Showing
5 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
openapi: 3.0.0 | ||
info: | ||
description: "This is an API description for Moira Alert project. Please check https://github.com/moira-alert" | ||
version: "2.5.1" | ||
title: "Moira Alert" | ||
# contact: | ||
# link: "https://t.me/moira_alert" | ||
license: | ||
name: "MIT" | ||
servers: | ||
- url: http://localhost:8080/api | ||
description: Localhost server | ||
paths: | ||
/trigger: | ||
$ref: ./triggers/methods.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
put: | ||
summary: "Create new trigger" | ||
description: "" | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ./schemas/req_put.yml | ||
responses: | ||
$ref: ./responses/put.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
200: | ||
description: "Trigger created" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ../schemas/res_put.yml#/200 | ||
400: | ||
description: "Invalid input" | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ../schemas/res_put.yml#/400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
$schema: "http://json-schema.org/draft-04/schema#" | ||
properties: | ||
desc: | ||
type: string | ||
description: Trigger description | ||
example: Dice roll trigger | ||
error_value: | ||
type: number | ||
description: Target value at which error will be fired | ||
example: 7 | ||
expression: | ||
type: string | ||
description: Expression that will be evaluated | ||
example: "t1 > 6 ? ERROR : (t1 > 4)? WARN : OK" | ||
id: | ||
type: string | ||
is_remote: | ||
type: boolean | ||
description: Which storage to use local or remote | ||
example: false | ||
mute_new_metrics: | ||
type: boolean | ||
example: true | ||
name: | ||
type: string | ||
description: Trigger name | ||
example: Dice Roll | ||
patterns: | ||
items: | ||
type: string | ||
type: array | ||
example: | ||
- local.dice.roll | ||
description: Array of possible patterns to check values in simple mode | ||
sched: | ||
$schema: "http://json-schema.org/draft-04/schema#" | ||
$ref: "#/definitions/ScheduleData" | ||
tags: | ||
items: | ||
type: string | ||
type: array | ||
description: Array of tags associated with this trigger | ||
example: | ||
- test | ||
targets: | ||
items: | ||
type: string | ||
type: array | ||
description: Array of targets associated with this trigger | ||
throttling: | ||
type: integer | ||
description: Quantity of events before throttling will be enabled | ||
trigger_type: | ||
type: string | ||
enum: ["rising", "falling", "expression"] | ||
ttl: | ||
type: integer | ||
ttl_state: | ||
type: string | ||
warn_value: | ||
type: number | ||
description: Target value at which warning will be fired | ||
example: 5 | ||
additionalProperties: false | ||
type: object | ||
definitions: | ||
ScheduleData: | ||
properties: | ||
days: | ||
items: | ||
$schema: "http://json-schema.org/draft-04/schema#" | ||
$ref: "#/definitions/ScheduleDataDay" | ||
type: array | ||
endOffset: | ||
type: integer | ||
startOffset: | ||
type: integer | ||
tzOffset: | ||
type: integer | ||
additionalProperties: false | ||
type: object | ||
ScheduleDataDay: | ||
properties: | ||
enabled: | ||
type: boolean | ||
name: | ||
type: string | ||
additionalProperties: false | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
200: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
example: trigger_id | ||
message: | ||
type: string | ||
example: trigger created | ||
400: | ||
type: object | ||
properties: | ||
status: | ||
type: string | ||
example: Invalid request | ||
error: | ||
type: string | ||
example: error_value is equal to warn_value, please set exactly one value |