Skip to content

Commit 2b91477

Browse files
orkayamOrel Kayam
authored andcommitted
Add alert update operation (Azure#14840)
* add new resources * Add resources to markdown * Modify routes * Add systemData * Add systemData to defenderSettings * Add missing parameter * Add more systemData * Fix example * Add new API version * Remove redundant change * update markdown * Add operations to new API version * Update list filters * update description * update examples * Update examples * Add missing properties * Add missing properties * Rename property * Add alert editing * Update editable properties * Update example * update put to patch * Separate patch request to a different model * Share enum * update example * update patch model * Undo break change * small update Co-authored-by: Orel Kayam <orkayam@microsoft.com>
1 parent 8de7115 commit 2b91477

File tree

4 files changed

+189
-28
lines changed

4 files changed

+189
-28
lines changed

specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-07-01-preview/alerts.json

Lines changed: 128 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,52 @@
129129
}
130130
}
131131
}
132+
},
133+
"patch": {
134+
"x-ms-examples": {
135+
"Update IoT Alert": {
136+
"$ref": "./examples/Alerts/PatchAlert.json"
137+
}
138+
},
139+
"tags": [
140+
"IoT Security Alerts"
141+
],
142+
"operationId": "IotAlerts_Patch",
143+
"description": "Update an existing alert",
144+
"parameters": [
145+
{
146+
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
147+
},
148+
{
149+
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter"
150+
},
151+
{
152+
"$ref": "../../../common/1.0/types.json#/parameters/IotDefenderLocation"
153+
},
154+
{
155+
"$ref": "#/parameters/DeviceGroupName"
156+
},
157+
{
158+
"$ref": "#/parameters/AlertId"
159+
},
160+
{
161+
"$ref": "#/parameters/AlertPatchModel"
162+
}
163+
],
164+
"responses": {
165+
"200": {
166+
"description": "IoT alert",
167+
"schema": {
168+
"$ref": "#/definitions/AlertModel"
169+
}
170+
},
171+
"default": {
172+
"description": "Error response describing why the operation failed.",
173+
"schema": {
174+
"$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
175+
}
176+
}
177+
}
132178
}
133179
}
134180
},
@@ -174,6 +220,46 @@
174220
}
175221
]
176222
},
223+
"AlertSeverity": {
224+
"type": "string",
225+
"readOnly": false,
226+
"description": "Alert Severity",
227+
"enum": [
228+
"Informational",
229+
"Low",
230+
"Medium",
231+
"High"
232+
],
233+
"x-ms-enum": {
234+
"name": "alertSeverity",
235+
"modelAsString": true
236+
}
237+
},
238+
"AlertStatus": {
239+
"type": "string",
240+
"readOnly": false,
241+
"description": "Alert Status",
242+
"enum": [
243+
"New",
244+
"InProgress",
245+
"Closed"
246+
],
247+
"x-ms-enum": {
248+
"name": "alertStatus",
249+
"modelAsString": true,
250+
"values": [
251+
{
252+
"value": "New"
253+
},
254+
{
255+
"value": "InProgress"
256+
},
257+
{
258+
"value": "Closed"
259+
}
260+
]
261+
}
262+
},
177263
"AlertPropertiesModel": {
178264
"type": "object",
179265
"description": "IoT alert properties",
@@ -234,34 +320,10 @@
234320
}
235321
},
236322
"severity": {
237-
"readOnly": true,
238323
"type": "string",
239324
"example": "Medium",
240-
"description": "The severity of the alert",
241-
"enum": [
242-
"Informational",
243-
"Low",
244-
"Medium",
245-
"High"
246-
],
247-
"x-ms-enum": {
248-
"name": "alertSeverity",
249-
"modelAsString": true,
250-
"values": [
251-
{
252-
"value": "Informational"
253-
},
254-
{
255-
"value": "Low"
256-
},
257-
{
258-
"value": "Medium"
259-
},
260-
{
261-
"value": "High"
262-
}
263-
]
264-
}
325+
"$ref": "#/definitions/AlertSeverity",
326+
"description": "The severity of the alert"
265327
},
266328
"intent": {
267329
"readOnly": true,
@@ -346,6 +408,36 @@
346408
"type": "string",
347409
"example": "IoT Hub",
348410
"description": "The name of a component inside the product which generated the alert"
411+
},
412+
"status": {
413+
"type": "string",
414+
"example": "New",
415+
"description": "The status of the alert",
416+
"$ref": "#/definitions/AlertStatus"
417+
}
418+
}
419+
},
420+
"AlertPatchPropertiesModel": {
421+
"type": "object",
422+
"description": "IoT alert properties",
423+
"properties": {
424+
"properties": {
425+
"type": "object",
426+
"description": "IoT alert properties",
427+
"properties": {
428+
"severity": {
429+
"type": "string",
430+
"example": "Medium",
431+
"description": "The severity of the alert",
432+
"$ref": "#/definitions/AlertSeverity"
433+
},
434+
"status": {
435+
"type": "string",
436+
"example": "New",
437+
"description": "The status of the alert",
438+
"$ref": "#/definitions/AlertStatus"
439+
}
440+
}
349441
}
350442
}
351443
}
@@ -366,6 +458,16 @@
366458
"description": "Alert Id",
367459
"type": "string",
368460
"x-ms-parameter-location": "method"
461+
},
462+
"AlertPatchModel": {
463+
"name": "alertPatchModel",
464+
"in": "body",
465+
"required": true,
466+
"description": "IoT alert",
467+
"schema": {
468+
"$ref": "#/definitions/AlertPatchPropertiesModel"
469+
},
470+
"x-ms-parameter-location": "method"
369471
}
370472
}
371473
}

specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-07-01-preview/examples/Alerts/GetAlert.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
},
3535
"severity": "Medium",
3636
"intent": "PreAttack",
37-
"productComponentName": "IoT Hub"
37+
"productComponentName": "IoT Hub",
38+
"status": "New"
3839
},
3940
"systemData": {
4041
"createdBy": "string",

specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-07-01-preview/examples/Alerts/GetAlertList.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
},
3636
"severity": "Medium",
3737
"intent": "PreAttack",
38-
"productComponentName": "IoT Hub"
38+
"productComponentName": "IoT Hub",
39+
"status": "New"
3940
},
4041
"systemData": {
4142
"createdBy": "string",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"parameters": {
3+
"api-version": "2021-07-01-preview",
4+
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23",
5+
"iotDefenderLocation": "eastus",
6+
"deviceGroupName": "default",
7+
"alertId": "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
8+
"alertPatchModel": {
9+
"properties": {
10+
"severity": "Medium",
11+
"status": "InProgress"
12+
}
13+
}
14+
},
15+
"responses": {
16+
"200": {
17+
"body": {
18+
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/default/alerts/903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
19+
"name": "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
20+
"type": "Microsoft.IoTSecurity/alerts",
21+
"properties": {
22+
"systemAlertId": "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
23+
"azureResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/default/devices/device-1",
24+
"alertType": "IoT_PrivilegedContainer",
25+
"startTimeUtc": "2020-05-13T06:32:25Z",
26+
"endTimeUtc": "2020-05-13T06:32:25Z",
27+
"entities": [
28+
{
29+
"$id": "1",
30+
"CommandLine": "docker run --privileged",
31+
"Type": "process"
32+
}
33+
],
34+
"extendedProperties": {
35+
"CommandLine": "docker run --privileged",
36+
"User Name": "aUser",
37+
"UserId": "",
38+
"ParentProcessId": 1593,
39+
"DeviceId": "device-1"
40+
},
41+
"severity": "Medium",
42+
"intent": "PreAttack",
43+
"productComponentName": "IoT Hub",
44+
"status": "InProgress"
45+
},
46+
"systemData": {
47+
"createdBy": "string",
48+
"createdByType": "User",
49+
"createdAt": "2020-04-27T21:53:29.0928001Z",
50+
"lastModifiedBy": "string",
51+
"lastModifiedByType": "User",
52+
"lastModifiedAt": "2020-04-27T21:53:29.0928001Z"
53+
}
54+
}
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)