Skip to content

Commit

Permalink
Add alert update operation (#14840)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
orkayam and Orel Kayam authored Jun 18, 2021
1 parent 3b2879c commit 677f244
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,52 @@
}
}
}
},
"patch": {
"x-ms-examples": {
"Update IoT Alert": {
"$ref": "./examples/Alerts/PatchAlert.json"
}
},
"tags": [
"IoT Security Alerts"
],
"operationId": "IotAlerts_Patch",
"description": "Update an existing alert",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../common/1.0/types.json#/parameters/IotDefenderLocation"
},
{
"$ref": "#/parameters/DeviceGroupName"
},
{
"$ref": "#/parameters/AlertId"
},
{
"$ref": "#/parameters/AlertPatchModel"
}
],
"responses": {
"200": {
"description": "IoT alert",
"schema": {
"$ref": "#/definitions/AlertModel"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/ErrorResponse"
}
}
}
}
}
},
Expand Down Expand Up @@ -174,6 +220,46 @@
}
]
},
"AlertSeverity": {
"type": "string",
"readOnly": false,
"description": "Alert Severity",
"enum": [
"Informational",
"Low",
"Medium",
"High"
],
"x-ms-enum": {
"name": "alertSeverity",
"modelAsString": true
}
},
"AlertStatus": {
"type": "string",
"readOnly": false,
"description": "Alert Status",
"enum": [
"New",
"InProgress",
"Closed"
],
"x-ms-enum": {
"name": "alertStatus",
"modelAsString": true,
"values": [
{
"value": "New"
},
{
"value": "InProgress"
},
{
"value": "Closed"
}
]
}
},
"AlertPropertiesModel": {
"type": "object",
"description": "IoT alert properties",
Expand Down Expand Up @@ -234,34 +320,10 @@
}
},
"severity": {
"readOnly": true,
"type": "string",
"example": "Medium",
"description": "The severity of the alert",
"enum": [
"Informational",
"Low",
"Medium",
"High"
],
"x-ms-enum": {
"name": "alertSeverity",
"modelAsString": true,
"values": [
{
"value": "Informational"
},
{
"value": "Low"
},
{
"value": "Medium"
},
{
"value": "High"
}
]
}
"$ref": "#/definitions/AlertSeverity",
"description": "The severity of the alert"
},
"intent": {
"readOnly": true,
Expand Down Expand Up @@ -346,6 +408,36 @@
"type": "string",
"example": "IoT Hub",
"description": "The name of a component inside the product which generated the alert"
},
"status": {
"type": "string",
"example": "New",
"description": "The status of the alert",
"$ref": "#/definitions/AlertStatus"
}
}
},
"AlertPatchPropertiesModel": {
"type": "object",
"description": "IoT alert properties",
"properties": {
"properties": {
"type": "object",
"description": "IoT alert properties",
"properties": {
"severity": {
"type": "string",
"example": "Medium",
"description": "The severity of the alert",
"$ref": "#/definitions/AlertSeverity"
},
"status": {
"type": "string",
"example": "New",
"description": "The status of the alert",
"$ref": "#/definitions/AlertStatus"
}
}
}
}
}
Expand All @@ -366,6 +458,16 @@
"description": "Alert Id",
"type": "string",
"x-ms-parameter-location": "method"
},
"AlertPatchModel": {
"name": "alertPatchModel",
"in": "body",
"required": true,
"description": "IoT alert",
"schema": {
"$ref": "#/definitions/AlertPatchPropertiesModel"
},
"x-ms-parameter-location": "method"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
},
"severity": "Medium",
"intent": "PreAttack",
"productComponentName": "IoT Hub"
"productComponentName": "IoT Hub",
"status": "New"
},
"systemData": {
"createdBy": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
},
"severity": "Medium",
"intent": "PreAttack",
"productComponentName": "IoT Hub"
"productComponentName": "IoT Hub",
"status": "New"
},
"systemData": {
"createdBy": "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"parameters": {
"api-version": "2021-07-01-preview",
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23",
"iotDefenderLocation": "eastus",
"deviceGroupName": "default",
"alertId": "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
"alertPatchModel": {
"properties": {
"severity": "Medium",
"status": "InProgress"
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/default/alerts/903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
"name": "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
"type": "Microsoft.IoTSecurity/alerts",
"properties": {
"systemAlertId": "903e76ff-17eb-4bac-ac8a-2bc31ab68fd8",
"azureResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/default/devices/device-1",
"alertType": "IoT_PrivilegedContainer",
"startTimeUtc": "2020-05-13T06:32:25Z",
"endTimeUtc": "2020-05-13T06:32:25Z",
"entities": [
{
"$id": "1",
"CommandLine": "docker run --privileged",
"Type": "process"
}
],
"extendedProperties": {
"CommandLine": "docker run --privileged",
"User Name": "aUser",
"UserId": "",
"ParentProcessId": 1593,
"DeviceId": "device-1"
},
"severity": "Medium",
"intent": "PreAttack",
"productComponentName": "IoT Hub",
"status": "InProgress"
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-04-27T21:53:29.0928001Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-04-27T21:53:29.0928001Z"
}
}
}
}
}

0 comments on commit 677f244

Please sign in to comment.