Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alert update operation #14840

Merged
merged 30 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": true,
"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"
}
}
}
}
}