Skip to content

Commit 742d12e

Browse files
authored
Adding patch operation in 2019-03-01 API (#12190)
* Adding patch operation in 2019-03-01 API * Adding missing example file * Fixing api version in the example * Fixing parameter name * Removing properties that don't exist in AzureResource
1 parent 2032fd0 commit 742d12e

File tree

2 files changed

+174
-0
lines changed

2 files changed

+174
-0
lines changed

specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2019-03-01/SmartDetectorAlertRulesApi.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,55 @@
214214
}
215215
}
216216
},
217+
"patch": {
218+
"tags": [
219+
"SmartDetectorAlertRules"
220+
],
221+
"operationId": "SmartDetectorAlertRules_Patch",
222+
"description": "Patch a specific Smart Detector alert rule.",
223+
"parameters": [
224+
{
225+
"$ref": "#/parameters/SubscriptionIdParameter"
226+
},
227+
{
228+
"$ref": "#/parameters/ResourceGroupNameParameter"
229+
},
230+
{
231+
"$ref": "#/parameters/AlertRuleNameParameter"
232+
},
233+
{
234+
"$ref": "#/parameters/ApiVersionParameter"
235+
},
236+
{
237+
"name": "parameters",
238+
"description": "Parameters supplied to the operation.",
239+
"in": "body",
240+
"required": true,
241+
"schema": {
242+
"$ref": "#/definitions/AlertRulePatchObject"
243+
}
244+
}
245+
],
246+
"responses": {
247+
"default": {
248+
"description": "Error response describing why the operation failed.",
249+
"schema": {
250+
"$ref": "#/definitions/SmartDetectorErrorResponse"
251+
}
252+
},
253+
"200": {
254+
"description": "Successful request to patch Smart Detector alert rule.",
255+
"schema": {
256+
"$ref": "#/definitions/AlertRule"
257+
}
258+
}
259+
},
260+
"x-ms-examples": {
261+
"Patch alert rules": {
262+
"$ref": "./examples/SmartDetectorAlertRule_Patch.json"
263+
}
264+
}
265+
},
217266
"delete": {
218267
"tags": [
219268
"SmartDetectorAlertRules"
@@ -357,6 +406,36 @@
357406
}
358407
}
359408
},
409+
"AlertRulePatchObject": {
410+
"properties": {
411+
"id": {
412+
"description": "The resource ID.",
413+
"readOnly": true,
414+
"type": "string"
415+
},
416+
"type": {
417+
"type": "string",
418+
"readOnly": true,
419+
"description": "The resource type."
420+
},
421+
"name": {
422+
"type": "string",
423+
"readOnly": true,
424+
"description": "The resource name."
425+
},
426+
"tags": {
427+
"type": "object",
428+
"description": "The resource tags."
429+
},
430+
"properties": {
431+
"x-ms-client-flatten": true,
432+
"$ref": "#/definitions/AlertRulePatchProperties",
433+
"description": "The properties of the alert rule.",
434+
"minProperties": 1
435+
}
436+
},
437+
"description": "The alert rule patch information"
438+
},
360439
"Detector": {
361440
"properties": {
362441
"id": {
@@ -465,6 +544,55 @@
465544
"actionGroups"
466545
],
467546
"description": "The alert rule properties."
547+
},
548+
"AlertRulePatchProperties": {
549+
"properties": {
550+
"description": {
551+
"description": "The alert rule description.",
552+
"type": "string"
553+
},
554+
"state": {
555+
"description": "The alert rule state.",
556+
"type": "string",
557+
"enum": [
558+
"Enabled",
559+
"Disabled"
560+
],
561+
"x-ms-enum": {
562+
"name": "AlertRuleState",
563+
"modelAsString": true
564+
}
565+
},
566+
"severity": {
567+
"description": "The alert rule severity.",
568+
"type": "string",
569+
"enum": [
570+
"Sev0",
571+
"Sev1",
572+
"Sev2",
573+
"Sev3",
574+
"Sev4"
575+
],
576+
"x-ms-enum": {
577+
"name": "Severity",
578+
"modelAsString": true
579+
}
580+
},
581+
"frequency": {
582+
"description": "The alert rule frequency in ISO8601 format. The time granularity must be in minutes and minimum value is 5 minutes.",
583+
"type": "string",
584+
"format": "duration"
585+
},
586+
"actionGroups": {
587+
"description": "The alert rule actions.",
588+
"$ref": "#/definitions/ActionGroupsInformation"
589+
},
590+
"throttling": {
591+
"description": "The alert rule throttling information.",
592+
"$ref": "#/definitions/ThrottlingInformation"
593+
}
594+
},
595+
"description": "The alert rule properties."
468596
}
469597
},
470598
"parameters": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "b368ca2f-e298-46b7-b0ab-012281956afa",
4+
"resourceGroupName": "MyAlertRules",
5+
"alertRuleName": "MyAlertRule",
6+
"api-version": "2019-03-01",
7+
"parameters": {
8+
"tags": {
9+
"newKey": "newVal"
10+
},
11+
"properties": {
12+
"description": "New description for patching",
13+
"frequency": "PT1M"
14+
}
15+
}
16+
},
17+
"responses": {
18+
"200": {
19+
"body": {
20+
"id": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyAlertRules/providers/microsoft.alertsManagement/smartDetectorAlertRules/MyAlertRule",
21+
"type": "Microsoft.AlertsManagement/smartDetectorAlertRules",
22+
"name": "MyAlertRule",
23+
"properties": {
24+
"description": "New description for patching",
25+
"state": "Enabled",
26+
"severity": "Sev3",
27+
"frequency": "PT1M",
28+
"detector": {
29+
"id": "VMMemoryLeak"
30+
},
31+
"scope": [
32+
"/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1"
33+
],
34+
"actionGroups": [
35+
{
36+
"actionGroupId": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup"
37+
}
38+
],
39+
"throttling": {
40+
"duration": "PT20M"
41+
}
42+
}
43+
}
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)