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

Adding patch support for SQR API #3112

Merged
merged 15 commits into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from 14 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
@@ -0,0 +1,61 @@
{
"parameters": {
"api-version": "2018-04-16",
"subscriptionId": "subid",
"resourceGroupName": "my-resource-group",
"ruleName": "logalertfoo",
"parameters": {
"properties": {
"enabled": "true"
}
}
},
"responses": {
"200": {
"headers": {},
"body": {
"id": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/scheduledQueryRules/logalertfoo",
"name": "logalertfoo",
"type": "Microsoft.Insights/scheduledQueryRules",
"location": "West US",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI": "Resource"
},
"properties": {
"description": "log alert description",
"enabled": "true",
"lastUpdatedTime": "2017-06-23T21:23:52.0221265Z",
"provisioningState": "Succeeded",
"source": {
"query": "requests",
"dataSourceId": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
"queryType": "ResultCount"
},
"schedule": {
"frequencyInMinutes": 15,
"timeWindowInMinutes": 15
},
"action": {
"odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
"severity": "1",
"aznsAction": {
"actionGroup": [],
"emailSubject": "Email Header",
"customWebhookPayload": "{}"
},
"trigger": {
"thresholdOperator": "GreaterThan",
"threshold": 3,
"metricTrigger": {
"thresholdOperator": "GreaterThan",
"threshold": 5,
"metricTriggerType": "Consecutive",
"metricColumn": "ColumnName"
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,43 @@
"Get rule": { "$ref": "./examples/getScheduledQueryRules.json" }
}
},
"patch": {
"tags": [ "scheduledQueryRules" ],
"description": "Update log search Rule.",
"operationId": "scheduledQueryRules_Update",
"parameters": [
{ "$ref": "#/parameters/SubscriptionIdParameter" },
{ "$ref": "#/parameters/ResourceGroupNameParameter" },
{ "$ref": "#/parameters/RuleNameParameter" },
{ "$ref": "#/parameters/ApiVersionParameter" },
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/LogSearchRuleResourcePatch"
},
"description": "The parameters of the rule to update."
}
],
"responses": {
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"200": {
"description": "Successful request to update an Log Search rule",
"schema": {
"$ref": "#/definitions/LogSearchRuleResource"
}
}
},
"x-ms-examples": {
"Patch Log Search Rule": { "$ref": "./examples/patchScheduledQueryRules.json" }
}
},
"delete": {
"description": "Deletes a Log Search rule",
"tags": [
Expand Down Expand Up @@ -305,6 +342,22 @@
},
"description": "The Log Search Rule resource."
},
"LogSearchRuleResourcePatch": {
"properties": {
"tags": {
"additionalProperties": {
"type": "string"
},
"description": "Resource tags"
},
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/LogSearchRulePatch",
"description": "The log search rule properties of the resource."
}
},
"description": "The log search rule resource for patch operations."
},
"LogSearchRuleResourceCollection": {
"properties": {
"value": {
Expand Down Expand Up @@ -338,7 +391,7 @@
},
"queryType": {
"$ref": "#/definitions/QueryType",
"description": "Set value to ResultCount if query should be returning search result count. Set it to Number if its a metric query."
"description": "Set value to 'ResultCount' ."
}
},
"required": [
Expand Down Expand Up @@ -480,7 +533,7 @@
"name": "QueryType",
"modelAsString": true
},
"description": "Output of query to be used"
"description": "Set value to 'ResultAcount'"
},
"LogSearchRule": {
"description": "Log Search Rule Definition",
Expand Down Expand Up @@ -541,6 +594,23 @@
"action"
]
},
"LogSearchRulePatch": {
"description": "Log Search Rule Definition for Patching",
"properties": {
"enabled": {
"type": "string",
"description": "The flag which indicates whether the Log Search rule is enabled. Value should be true or false",
"enum": [
"true",
"false"
],
"x-ms-enum": {
"name": "enabled",
"modelAsString": true
}
}
}
},
"Action": {
"type": "object",
"discriminator": "odata.type",
Expand Down Expand Up @@ -588,7 +658,7 @@
"severity"
]
},
"ErrorResponse": {
"ErrorResponse": {
"description": "Describes the format of Error response.",
"type": "object",
"properties": {
Expand Down Expand Up @@ -643,4 +713,4 @@
"x-ms-parameter-location": "method"
}
}
}
}