Skip to content

Commit ad24378

Browse files
abversqrannatisch
authored andcommitted
Adding patch support for SQR API (#3112)
* Added GA API version for Scheduled Query Rule Added GA API version for Scheduled Query Rule * Resolving Comments Resolving Comments * Made SKU as top level proprty and including generic error response format Couple of changes - 1. Made SKU as top level proprty as mentioned here - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md#put-resource 2. including generic error response format * Minor Changes to align implementation 1. Removed SKU - Billing Model is still under discussion, hence need not to be exposed to customers. 2. Enabled field ichanged to align with camel case. 3. 'throttleTillDate' in properties.action changed to 'throttlingInMin' to denote correct meaning and it’s data type changed to number instead of date. 4. 'status' to be removed in properties.action from examples. 5. 'severity' made a required field in properties.action. 6. Removed Examples from original spec json * Updated Example to reflect AI instances in tags and 'dataSourceId" Updated Example to reflect AI instances in tags and 'dataSourceId" * made 'tags' details more descriptive * Restore Tags Description Restore Tags Description * Fixed Exmaple Validation Fixed errores reported by running command "oav validate-example" * Added Default Response payload in all APIs Changes - 1. Added Default Response payload in all APIs 2. Made azNs description more clear * Updating descriptions + property name change Updating descriptions + property name change * Patch Support for SQR API * Updated description for queryType Updated description for queryType * Update scheduledQueryRule_API.json * Resolving multiple model issue Changes - 1. Renamed "MetricTrigger" to "LogMetricTrigger" 2. Aligned "Resources" to other specs
1 parent b29373c commit ad24378

File tree

2 files changed

+143
-8
lines changed

2 files changed

+143
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"parameters": {
3+
"api-version": "2018-04-16",
4+
"subscriptionId": "subid",
5+
"resourceGroupName": "my-resource-group",
6+
"ruleName": "logalertfoo",
7+
"parameters": {
8+
"properties": {
9+
"enabled": "true"
10+
}
11+
}
12+
},
13+
"responses": {
14+
"200": {
15+
"headers": {},
16+
"body": {
17+
"id": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/scheduledQueryRules/logalertfoo",
18+
"name": "logalertfoo",
19+
"type": "Microsoft.Insights/scheduledQueryRules",
20+
"location": "West US",
21+
"tags": {
22+
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI": "Resource"
23+
},
24+
"properties": {
25+
"description": "log alert description",
26+
"enabled": "true",
27+
"lastUpdatedTime": "2017-06-23T21:23:52.0221265Z",
28+
"provisioningState": "Succeeded",
29+
"source": {
30+
"query": "requests",
31+
"dataSourceId": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
32+
"queryType": "ResultCount"
33+
},
34+
"schedule": {
35+
"frequencyInMinutes": 15,
36+
"timeWindowInMinutes": 15
37+
},
38+
"action": {
39+
"odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
40+
"severity": "1",
41+
"aznsAction": {
42+
"actionGroup": [],
43+
"emailSubject": "Email Header",
44+
"customWebhookPayload": "{}"
45+
},
46+
"trigger": {
47+
"thresholdOperator": "GreaterThan",
48+
"threshold": 3,
49+
"metricTrigger": {
50+
"thresholdOperator": "GreaterThan",
51+
"threshold": 5,
52+
"metricTriggerType": "Consecutive",
53+
"metricColumn": "ColumnName"
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}

specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/scheduledQueryRule_API.json

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,43 @@
126126
"Get rule": { "$ref": "./examples/getScheduledQueryRules.json" }
127127
}
128128
},
129+
"patch": {
130+
"tags": [ "scheduledQueryRules" ],
131+
"description": "Update log search Rule.",
132+
"operationId": "scheduledQueryRules_Update",
133+
"parameters": [
134+
{ "$ref": "#/parameters/SubscriptionIdParameter" },
135+
{ "$ref": "#/parameters/ResourceGroupNameParameter" },
136+
{ "$ref": "#/parameters/RuleNameParameter" },
137+
{ "$ref": "#/parameters/ApiVersionParameter" },
138+
{
139+
"name": "parameters",
140+
"in": "body",
141+
"required": true,
142+
"schema": {
143+
"$ref": "#/definitions/LogSearchRuleResourcePatch"
144+
},
145+
"description": "The parameters of the rule to update."
146+
}
147+
],
148+
"responses": {
149+
"default": {
150+
"description": "Error response describing why the operation failed.",
151+
"schema": {
152+
"$ref": "#/definitions/ErrorResponse"
153+
}
154+
},
155+
"200": {
156+
"description": "Successful request to update an Log Search rule",
157+
"schema": {
158+
"$ref": "#/definitions/LogSearchRuleResource"
159+
}
160+
}
161+
},
162+
"x-ms-examples": {
163+
"Patch Log Search Rule": { "$ref": "./examples/patchScheduledQueryRules.json" }
164+
}
165+
},
129166
"delete": {
130167
"description": "Deletes a Log Search rule",
131168
"tags": [
@@ -252,7 +289,7 @@
252289
}
253290
},
254291
"definitions": {
255-
"Resource": {
292+
"Resource": {
256293
"properties": {
257294
"id": {
258295
"type": "string",
@@ -271,7 +308,11 @@
271308
},
272309
"location": {
273310
"type": "string",
274-
"description": "Resource location"
311+
"description": "Resource location",
312+
"x-ms-mutability": [
313+
"create",
314+
"read"
315+
]
275316
},
276317
"tags": {
277318
"additionalProperties": {
@@ -305,6 +346,22 @@
305346
},
306347
"description": "The Log Search Rule resource."
307348
},
349+
"LogSearchRuleResourcePatch": {
350+
"properties": {
351+
"tags": {
352+
"additionalProperties": {
353+
"type": "string"
354+
},
355+
"description": "Resource tags"
356+
},
357+
"properties": {
358+
"x-ms-client-flatten": true,
359+
"$ref": "#/definitions/LogSearchRulePatch",
360+
"description": "The log search rule properties of the resource."
361+
}
362+
},
363+
"description": "The log search rule resource for patch operations."
364+
},
308365
"LogSearchRuleResourceCollection": {
309366
"properties": {
310367
"value": {
@@ -338,7 +395,7 @@
338395
},
339396
"queryType": {
340397
"$ref": "#/definitions/QueryType",
341-
"description": "Set value to ResultCount if query should be returning search result count. Set it to Number if its a metric query."
398+
"description": "Set value to 'ResultCount' ."
342399
}
343400
},
344401
"required": [
@@ -379,7 +436,7 @@
379436
"type": "number"
380437
},
381438
"metricTrigger": {
382-
"$ref": "#/definitions/MetricTrigger",
439+
"$ref": "#/definitions/LogMetricTrigger",
383440
"description": "Trigger condition for metric query rule"
384441
}
385442
},
@@ -410,7 +467,7 @@
410467
},
411468
"description": "Azure action group"
412469
},
413-
"MetricTrigger": {
470+
"LogMetricTrigger": {
414471
"type": "object",
415472
"properties": {
416473
"thresholdOperator": {
@@ -480,7 +537,7 @@
480537
"name": "QueryType",
481538
"modelAsString": true
482539
},
483-
"description": "Output of query to be used"
540+
"description": "Set value to 'ResultAcount'"
484541
},
485542
"LogSearchRule": {
486543
"description": "Log Search Rule Definition",
@@ -541,6 +598,23 @@
541598
"action"
542599
]
543600
},
601+
"LogSearchRulePatch": {
602+
"description": "Log Search Rule Definition for Patching",
603+
"properties": {
604+
"enabled": {
605+
"type": "string",
606+
"description": "The flag which indicates whether the Log Search rule is enabled. Value should be true or false",
607+
"enum": [
608+
"true",
609+
"false"
610+
],
611+
"x-ms-enum": {
612+
"name": "enabled",
613+
"modelAsString": true
614+
}
615+
}
616+
}
617+
},
544618
"Action": {
545619
"type": "object",
546620
"discriminator": "odata.type",
@@ -588,7 +662,7 @@
588662
"severity"
589663
]
590664
},
591-
"ErrorResponse": {
665+
"ErrorResponse": {
592666
"description": "Describes the format of Error response.",
593667
"type": "object",
594668
"properties": {
@@ -643,4 +717,4 @@
643717
"x-ms-parameter-location": "method"
644718
}
645719
}
646-
}
720+
}

0 commit comments

Comments
 (0)