Alerting: Add notification policy provisioning file export (#70009)

* Alerting: Add notification policy provisioning file export

- Add provisioning API endpoint for exporting notification policies.
- Add option in notification policy view ellipsis dropdown for exporting.
- Update various provisioning documentation.
This commit is contained in:
Matthew Jacobson
2023-07-24 17:56:53 -04:00
committed by GitHub
parent 4c42632ab8
commit cfb1656968
16 changed files with 731 additions and 71 deletions
+102 -2
View File
@@ -297,6 +297,12 @@
"$ref": "#/definitions/AlertRuleGroupExport"
},
"type": "array"
},
"policies": {
"items": {
"$ref": "#/definitions/NotificationPolicyExport"
},
"type": "array"
}
},
"title": "AlertingFileExport is the full provisioned file export.",
@@ -1097,6 +1103,10 @@
"description": "PathSeparator defines the separator pattern to decode a hierarchy. The default separator is '/'.",
"type": "string"
},
"preferredVisualisationPluginId": {
"description": "PreferredVisualizationPluginId sets the panel plugin id to use to render the data when using Explore. If\nthe plugin cannot be found will fall back to PreferredVisualization.",
"type": "string"
},
"preferredVisualisationType": {
"$ref": "#/definitions/VisType"
},
@@ -1897,6 +1907,19 @@
"title": "NoticeSeverity is a type for the Severity property of a Notice.",
"type": "integer"
},
"NotificationPolicyExport": {
"properties": {
"Policy": {
"$ref": "#/definitions/RouteExport"
},
"orgId": {
"format": "int64",
"type": "integer"
}
},
"title": "NotificationPolicyExport is the provisioned file export of alerting.NotificiationPolicyV1.",
"type": "object"
},
"NotificationTemplate": {
"properties": {
"name": {
@@ -2882,7 +2905,7 @@
"type": "boolean"
},
"settings": {
"$ref": "#/definitions/Json"
"$ref": "#/definitions/RawMessage"
},
"type": {
"type": "string"
@@ -2985,6 +3008,61 @@
},
"type": "object"
},
"RouteExport": {
"description": "RouteExport is the provisioned file export of definitions.Route. This is needed to hide fields that aren't useable in\nprovisioning file format. An alternative would be to define a custom MarshalJSON and MarshalYAML that excludes them.",
"properties": {
"continue": {
"type": "boolean"
},
"group_by": {
"items": {
"type": "string"
},
"type": "array"
},
"group_interval": {
"type": "string"
},
"group_wait": {
"type": "string"
},
"match": {
"additionalProperties": {
"type": "string"
},
"description": "Deprecated. Remove before v1.0 release.",
"type": "object"
},
"match_re": {
"$ref": "#/definitions/MatchRegexps"
},
"matchers": {
"$ref": "#/definitions/Matchers"
},
"mute_time_intervals": {
"items": {
"type": "string"
},
"type": "array"
},
"object_matchers": {
"$ref": "#/definitions/ObjectMatchers"
},
"receiver": {
"type": "string"
},
"repeat_interval": {
"type": "string"
},
"routes": {
"items": {
"$ref": "#/definitions/RouteExport"
},
"type": "array"
}
},
"type": "object"
},
"Rule": {
"description": "adapted from cortex",
"properties": {
@@ -4185,7 +4263,6 @@
"type": "array"
},
"integration": {
"description": "Integration integration",
"properties": {
"lastNotifyAttempt": {
"description": "A timestamp indicating the last attempt to deliver a notification regardless of the outcome.\nFormat: date-time",
@@ -5237,6 +5314,29 @@
]
}
},
"/api/v1/provisioning/policies/export": {
"get": {
"operationId": "RouteGetPolicyTreeExport",
"responses": {
"200": {
"description": "AlertingFileExport",
"schema": {
"$ref": "#/definitions/AlertingFileExport"
}
},
"404": {
"description": "NotFound",
"schema": {
"$ref": "#/definitions/NotFound"
}
}
},
"summary": "Export the notification policy tree in provisioning file format.",
"tags": [
"provisioning"
]
}
},
"/api/v1/provisioning/templates": {
"get": {
"operationId": "RouteGetTemplates",