Alerting: MuteTiming service return errutil + GetTiming by name (#79772)

* add get mute timing by name to MuteTimingService
* update get mute timing request handler to use the service method

* replace validation, uniqueness and used errors with errutils
* update mute timing methods return errutil responses
* use the term "time interval" in errors bevause mute timings are deprecated in Alertmanager and will be replaced by time intervals in the future.

* update create and update methods to return struct instead of pointer
This commit is contained in:
Yuri Tseretyan
2024-01-12 21:23:44 +02:00
committed by GitHub
parent 11662e18b3
commit 4479e7218d
12 changed files with 287 additions and 79 deletions
+15 -1
View File
@@ -1281,6 +1281,14 @@
"title": "Frames is a slice of Frame pointers.",
"type": "array"
},
"GenericPublicError": {
"properties": {
"body": {
"$ref": "#/definitions/PublicError"
}
},
"type": "object"
},
"GettableAlertmanagers": {
"properties": {
"data": {
@@ -4405,6 +4413,7 @@
"type": "object"
},
"alertGroup": {
"description": "AlertGroup alert group",
"properties": {
"alerts": {
"description": "alerts",
@@ -4533,7 +4542,6 @@
"type": "object"
},
"gettableAlert": {
"description": "GettableAlert gettable alert",
"properties": {
"annotations": {
"$ref": "#/definitions/labelSet"
@@ -5641,6 +5649,12 @@
"responses": {
"204": {
"description": " The mute timing was deleted successfully."
},
"409": {
"description": "GenericPublicError",
"schema": {
"$ref": "#/definitions/GenericPublicError"
}
}
},
"summary": "Delete a mute timing.",
@@ -63,6 +63,7 @@ import (
//
// Responses:
// 204: description: The mute timing was deleted successfully.
// 409: GenericPublicError
// swagger:route
@@ -20,3 +20,10 @@ type ForbiddenError struct {
// in: body
Body errutil.PublicError `json:"body"`
}
// swagger:model
type GenericPublicError struct {
// The response message
// in: body
Body errutil.PublicError `json:"body"`
}
+15 -1
View File
@@ -1281,6 +1281,14 @@
"title": "Frames is a slice of Frame pointers.",
"type": "array"
},
"GenericPublicError": {
"properties": {
"body": {
"$ref": "#/definitions/PublicError"
}
},
"type": "object"
},
"GettableAlertmanagers": {
"properties": {
"data": {
@@ -4590,13 +4598,13 @@
"type": "object"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"items": {
"$ref": "#/definitions/gettableAlert"
},
"type": "array"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"properties": {
"comment": {
"description": "comment",
@@ -7624,6 +7632,12 @@
"responses": {
"204": {
"description": " The mute timing was deleted successfully."
},
"409": {
"description": "GenericPublicError",
"schema": {
"$ref": "#/definitions/GenericPublicError"
}
}
},
"summary": "Delete a mute timing.",
+15 -1
View File
@@ -2785,6 +2785,12 @@
"responses": {
"204": {
"description": " The mute timing was deleted successfully."
},
"409": {
"description": "GenericPublicError",
"schema": {
"$ref": "#/definitions/GenericPublicError"
}
}
}
}
@@ -4688,6 +4694,14 @@
"$ref": "#/definitions/Frame"
}
},
"GenericPublicError": {
"type": "object",
"properties": {
"body": {
"$ref": "#/definitions/PublicError"
}
}
},
"GettableAlertmanagers": {
"type": "object",
"properties": {
@@ -8001,6 +8015,7 @@
"$ref": "#/definitions/gettableAlert"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"type": "array",
"items": {
"$ref": "#/definitions/gettableAlert"
@@ -8008,7 +8023,6 @@
"$ref": "#/definitions/gettableAlerts"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"type": "object",
"required": [
"comment",