Skip to content

Commit 9d1d4dd

Browse files
STAC-25181: Suppression setting and api enpoint
1 parent 21a4b15 commit 9d1d4dd

4 files changed

Lines changed: 301 additions & 0 deletions

File tree

‎spec/monitors_check_status.api.yaml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ components:
162162
format: instant
163163
dummy:
164164
type: boolean
165+
userSuppression:
166+
$ref: "#/components/schemas/MonitorCheckStatusSuppression"
165167
required:
166168
- id
167169
- identifier
@@ -312,6 +314,23 @@ components:
312314
type: string
313315
required:
314316
- message
317+
MonitorCheckStatusUserSuppression:
318+
type: object
319+
description: "Configured user suppression on this check state id."
320+
properties:
321+
identifier:
322+
type: string
323+
description: "The unique identifier (URN) of the suppression."
324+
note:
325+
type: string
326+
description: "Human-readable reason for the suppression."
327+
expiryEpochS:
328+
type: integer
329+
format: int64
330+
description: "Unix epoch (seconds) at which the suppression expires."
331+
required:
332+
- identifier
333+
- note
315334
MonitorCheckStatusNotFoundError:
316335
type: object
317336
properties:

‎spec/openapi.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ paths:
5454
/monitor/checkStatus/{identifier}: { $ref: "monitors_check_status.api.yaml#/paths/%2Fmonitor%2FcheckStatus%2F%7Bidentifier%7D" }
5555
/monitor/checkStatus/{identifier}/relatedFailures: { $ref: "monitors_check_status.api.yaml#/paths/%2Fmonitor%2FcheckStatus%2F%7Bidentifier%7D%2FrelatedFailures" }
5656
/monitor/checkStatus/{identifier}/healthHistory: { $ref: "monitors_check_status.api.yaml#/paths/%2Fmonitor%2FcheckStatus%2F%7Bidentifier%7D%2FhealthHistory" }
57+
/suppressions: { $ref: "suppressions.api.yaml#/paths/%2Fsuppressions" }
58+
/suppressions/{suppressionIdentifier}: { $ref: "suppressions.api.yaml#/paths/%2Fsuppressions%2F%7BsuppressionIdentifier%7D" }
5759
/notifications/channels/slack/oauth-redirect: { $ref: "notification_channels.api.yaml#/paths/%2Fnotifications%2Fchannels%2Fslack%2Foauth-redirect" }
5860
/notifications/channels/slack/oauth-callback: { $ref: "notification_channels.api.yaml#/paths/%2Fnotifications%2Fchannels%2Fslack%2Foauth-callback" }
5961
/notifications/channels/slack/{channelId}: { $ref: "notification_channels.api.yaml#/paths/%2Fnotifications%2Fchannels%2Fslack%2F%7BchannelId%7D" }

‎spec/suppressions.api.yaml‎

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# OpenApi header is included in this file to support code highlighting in VSCode
2+
openapi: 3.0.3
3+
info:
4+
title: Suppressions API
5+
version: "1.0.0"
6+
paths:
7+
/suppressions:
8+
get:
9+
tags:
10+
- suppression
11+
summary: "List user suppressions"
12+
description: "List all active user suppressions"
13+
operationId: getAllUserSuppressions
14+
responses:
15+
"200":
16+
$ref: "#/components/responses/userSuppressions"
17+
"500":
18+
$ref: "#/components/responses/suppressionApiError"
19+
post:
20+
tags:
21+
- suppression
22+
summary: "Create a user suppression"
23+
description: "Create a new user suppression. Only one user suppression may be active per monitor check state."
24+
operationId: createUserSuppression
25+
requestBody:
26+
$ref: "#/components/requestBodies/createUserSuppression"
27+
responses:
28+
"200":
29+
$ref: "#/components/responses/userSuppression"
30+
"400":
31+
$ref: "#/components/responses/suppressionApiError"
32+
"409":
33+
$ref: "#/components/responses/suppressionConflictError"
34+
"500":
35+
$ref: "#/components/responses/suppressionApiError"
36+
37+
/suppressions/{suppressionIdentifier}:
38+
delete:
39+
tags:
40+
- suppression
41+
summary: "Delete a user suppression"
42+
description: "Remove a user suppression by its identifier."
43+
operationId: deleteUserSuppression
44+
parameters:
45+
- $ref: "#/components/parameters/suppressionIdentifier"
46+
responses:
47+
"204":
48+
description: "Suppression removed"
49+
"400":
50+
$ref: "#/components/responses/suppressionApiError"
51+
"404":
52+
$ref: "#/components/responses/suppressionNotFoundError"
53+
"500":
54+
$ref: "#/components/responses/suppressionApiError"
55+
56+
components:
57+
parameters:
58+
suppressionIdentifier:
59+
in: path
60+
name: suppressionIdentifier
61+
required: true
62+
schema:
63+
type: string
64+
description: "The unique identifier (URN) of the user suppression"
65+
66+
requestBodies:
67+
createUserSuppression:
68+
required: true
69+
content:
70+
application/json:
71+
schema:
72+
$ref: "#/components/schemas/CreateUserSuppression"
73+
74+
responses:
75+
userSuppression:
76+
description: "A user suppression"
77+
content:
78+
application/json:
79+
schema:
80+
$ref: "#/components/schemas/UserSuppressionStatus"
81+
userSuppressions:
82+
description: "List of user suppressions"
83+
content:
84+
application/json:
85+
schema:
86+
$ref: "#/components/schemas/UserSuppressionStatusList"
87+
suppressionApiError:
88+
description: "Error response"
89+
content:
90+
application/json:
91+
schema:
92+
$ref: "#/components/schemas/SuppressionApiError"
93+
suppressionNotFoundError:
94+
description: "Suppression not found"
95+
content:
96+
application/json:
97+
schema:
98+
$ref: "#/components/schemas/SuppressionNotFoundError"
99+
suppressionConflictError:
100+
description: "A user suppression already exists for the given monitor check state"
101+
content:
102+
application/json:
103+
schema:
104+
$ref: "#/components/schemas/SuppressionConflictError"
105+
106+
schemas:
107+
CreateUserSuppression:
108+
type: object
109+
description: "Request body for creating a user suppression"
110+
properties:
111+
note:
112+
type: string
113+
description: "Human-readable reason for the suppression."
114+
expiryEpochS:
115+
type: integer
116+
format: int64
117+
description: "Unix epoch (seconds) at which this suppression expires. Maximum is 6 hours from now."
118+
selector:
119+
$ref: "#/components/schemas/UserSuppressionSelector"
120+
required:
121+
- note
122+
- selector
123+
124+
UserSuppressionStatus:
125+
type: object
126+
description: "A user suppression as returned by the API"
127+
properties:
128+
identifier:
129+
type: string
130+
description: "Unique URN for this suppression."
131+
note:
132+
type: string
133+
expiryEpochS:
134+
type: integer
135+
format: int64
136+
selector:
137+
$ref: "#/components/schemas/UserSuppressionSelector"
138+
required:
139+
- identifier
140+
- note
141+
- selector
142+
143+
UserSuppressionSelector:
144+
type: object
145+
description: "Selects what to suppress. Discriminated by `type` to allow future selector variants."
146+
properties:
147+
type:
148+
type: string
149+
oneOf:
150+
- $ref: "#/components/schemas/MonitorCheckStateSelector"
151+
discriminator:
152+
propertyName: type
153+
required:
154+
- type
155+
156+
MonitorCheckStateSelector:
157+
type: object
158+
description: "Selects a single monitor check state identified by monitor + checkStateId."
159+
properties:
160+
type:
161+
type: string
162+
enum: [MonitorCheckStateSelector]
163+
monitorId:
164+
$ref: "common.api.yaml#/components/schemas/MonitorReferenceId"
165+
checkStateId:
166+
type: string
167+
description: "The check state id within the monitor's output."
168+
subStream:
169+
type: string
170+
description: "The sub-stream identifier (always absent for Monitors, present for ExternalMonitors)."
171+
required:
172+
- type
173+
- monitorId
174+
- checkStateId
175+
176+
UserSuppressionStatusList:
177+
type: object
178+
properties:
179+
suppressions:
180+
type: array
181+
items:
182+
$ref: "#/components/schemas/UserSuppressionStatus"
183+
required:
184+
- suppressions
185+
186+
SuppressionApiError:
187+
type: object
188+
properties:
189+
message:
190+
type: string
191+
required:
192+
- message
193+
194+
SuppressionNotFoundError:
195+
type: object
196+
properties:
197+
identifier:
198+
type: string
199+
_type:
200+
type: string
201+
enum:
202+
- SuppressionNotFoundError
203+
required:
204+
- identifier
205+
- _type
206+
207+
SuppressionConflictError:
208+
type: object
209+
properties:
210+
message:
211+
type: string
212+
existingIdentifier:
213+
type: string
214+
description: "The identifier of the already-active suppression."
215+
required:
216+
- message
217+
- existingIdentifier

‎spec_settings/openapi.yaml‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ components:
101101
- Domain
102102
- MainMenuGroup
103103
- ViewType
104+
- UserSuppression
104105

105106
Setting:
106107
type: object
@@ -123,6 +124,7 @@ components:
123124
- $ref: "#/components/schemas/Domain"
124125
- $ref: "#/components/schemas/MainMenuGroup"
125126
- $ref: "#/components/schemas/ViewType"
127+
- $ref: "#/components/schemas/UserSuppression"
126128
discriminator:
127129
propertyName: type
128130
required:
@@ -1607,3 +1609,64 @@ components:
16071609
- overview
16081610
- flags
16091611
- filters
1612+
1613+
# User suppressions
1614+
UserSuppression:
1615+
allOf:
1616+
- $ref: "#/components/schemas/SettingBase"
1617+
- type: object
1618+
properties:
1619+
type:
1620+
type: string
1621+
enum: [UserSuppression]
1622+
description: The combination of type+id is a unique identification for a setting
1623+
identifier:
1624+
type: string
1625+
description: Unique URN for this suppression (defaults to urn://<vertexId>). Used as a unique index in StackGraph.
1626+
note:
1627+
type: string
1628+
description: Human-readable reason for the suppression.
1629+
expiryEpochS:
1630+
type: integer
1631+
format: int64
1632+
description: Unix epoch (seconds) at which this suppression expires. Maximum is 6 hours from creation time.
1633+
selector:
1634+
$ref: "#/components/schemas/UserSuppressionSelector"
1635+
required:
1636+
- type
1637+
- identifier
1638+
- note
1639+
- selector
1640+
1641+
UserSuppressionSelector:
1642+
type: object
1643+
description: Selects what to suppress. Discriminated by `type` to allow future selector variants.
1644+
properties:
1645+
type:
1646+
type: string
1647+
oneOf:
1648+
- $ref: "#/components/schemas/MonitorCheckStateSelector"
1649+
discriminator:
1650+
propertyName: type
1651+
required:
1652+
- type
1653+
1654+
MonitorCheckStateSelector:
1655+
type: object
1656+
description: Selects a single monitor check state identified by monitor + checkStateId.
1657+
properties:
1658+
type:
1659+
type: string
1660+
enum: [MonitorCheckStateSelector]
1661+
monitorId:
1662+
$ref: "#/components/schemas/MonitorPresentationId"
1663+
checkStateId:
1664+
type: string
1665+
description: The check state id within the monitor's output.
1666+
subStream:
1667+
type: string
1668+
description: The sub-stream identifier (always absent for Monitors, present for ExternalMonitors).
1669+
required:
1670+
- type
1671+
- monitorId
1672+
- checkStateId

0 commit comments

Comments
 (0)