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 operation in 2019-03-01 API #12190

Merged
merged 5 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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"
Copy link
Contributor

@akning-ms akning-ms Dec 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error response is different from ARM's guideline. so that is why cause Linter error R4007,
But if your service already implement error response like what your define in SmartDetectorErrorResponse. to keep consistent, we can suppress it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep the error response consistent , can you please suppress this error? @akning-ms

}
},
"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"
}
}
}
}
}
}