Skip to content

Commit

Permalink
Adding patch operation in 2019-03-01 API (#12190)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
napolish authored Jan 25, 2021
1 parent 2032fd0 commit 742d12e
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,55 @@
}
}
},
"patch": {
"tags": [
"SmartDetectorAlertRules"
],
"operationId": "SmartDetectorAlertRules_Patch",
"description": "Patch a specific Smart Detector alert rule.",
"parameters": [
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/AlertRuleNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"name": "parameters",
"description": "Parameters supplied to the operation.",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AlertRulePatchObject"
}
}
],
"responses": {
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/SmartDetectorErrorResponse"
}
},
"200": {
"description": "Successful request to patch Smart Detector alert rule.",
"schema": {
"$ref": "#/definitions/AlertRule"
}
}
},
"x-ms-examples": {
"Patch alert rules": {
"$ref": "./examples/SmartDetectorAlertRule_Patch.json"
}
}
},
"delete": {
"tags": [
"SmartDetectorAlertRules"
Expand Down Expand Up @@ -357,6 +406,36 @@
}
}
},
"AlertRulePatchObject": {
"properties": {
"id": {
"description": "The resource ID.",
"readOnly": true,
"type": "string"
},
"type": {
"type": "string",
"readOnly": true,
"description": "The resource type."
},
"name": {
"type": "string",
"readOnly": true,
"description": "The resource name."
},
"tags": {
"type": "object",
"description": "The resource tags."
},
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/AlertRulePatchProperties",
"description": "The properties of the alert rule.",
"minProperties": 1
}
},
"description": "The alert rule patch information"
},
"Detector": {
"properties": {
"id": {
Expand Down Expand Up @@ -465,6 +544,55 @@
"actionGroups"
],
"description": "The alert rule properties."
},
"AlertRulePatchProperties": {
"properties": {
"description": {
"description": "The alert rule description.",
"type": "string"
},
"state": {
"description": "The alert rule state.",
"type": "string",
"enum": [
"Enabled",
"Disabled"
],
"x-ms-enum": {
"name": "AlertRuleState",
"modelAsString": true
}
},
"severity": {
"description": "The alert rule severity.",
"type": "string",
"enum": [
"Sev0",
"Sev1",
"Sev2",
"Sev3",
"Sev4"
],
"x-ms-enum": {
"name": "Severity",
"modelAsString": true
}
},
"frequency": {
"description": "The alert rule frequency in ISO8601 format. The time granularity must be in minutes and minimum value is 5 minutes.",
"type": "string",
"format": "duration"
},
"actionGroups": {
"description": "The alert rule actions.",
"$ref": "#/definitions/ActionGroupsInformation"
},
"throttling": {
"description": "The alert rule throttling information.",
"$ref": "#/definitions/ThrottlingInformation"
}
},
"description": "The alert rule properties."
}
},
"parameters": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"parameters": {
"subscriptionId": "b368ca2f-e298-46b7-b0ab-012281956afa",
"resourceGroupName": "MyAlertRules",
"alertRuleName": "MyAlertRule",
"api-version": "2019-03-01",
"parameters": {
"tags": {
"newKey": "newVal"
},
"properties": {
"description": "New description for patching",
"frequency": "PT1M"
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyAlertRules/providers/microsoft.alertsManagement/smartDetectorAlertRules/MyAlertRule",
"type": "Microsoft.AlertsManagement/smartDetectorAlertRules",
"name": "MyAlertRule",
"properties": {
"description": "New description for patching",
"state": "Enabled",
"severity": "Sev3",
"frequency": "PT1M",
"detector": {
"id": "VMMemoryLeak"
},
"scope": [
"/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1"
],
"actionGroups": [
{
"actionGroupId": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup"
}
],
"throttling": {
"duration": "PT20M"
}
}
}
}
}
}

0 comments on commit 742d12e

Please sign in to comment.