Alerting: Support for optimistic concurrency in priovisioning Tempate API (#91195)
* support optimistic concurrency in template service * update request handler to get version from query parameter * return not found if a new template is set with version * update PUT api to set version * update documentation + for mute timings --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
This commit is contained in:
co-authored by
brendamuir
parent
d20510a1db
commit
1108a00668
@@ -2264,6 +2264,9 @@
|
||||
},
|
||||
"template": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@@ -2272,6 +2275,9 @@
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@@ -6183,16 +6189,28 @@
|
||||
"operationId": "RouteDeleteTemplate",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Template Name",
|
||||
"description": "Template name",
|
||||
"in": "path",
|
||||
"name": "name",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "Version of template to use for optimistic concurrency. Leave empty to disable validation",
|
||||
"in": "query",
|
||||
"name": "version",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": " The template was deleted successfully."
|
||||
},
|
||||
"409": {
|
||||
"description": "GenericPublicError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenericPublicError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "Delete a template.",
|
||||
@@ -6265,6 +6283,12 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "GenericPublicError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenericPublicError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "Updates an existing notification template.",
|
||||
|
||||
@@ -26,6 +26,7 @@ package definitions
|
||||
// Responses:
|
||||
// 202: NotificationTemplate
|
||||
// 400: ValidationError
|
||||
// 409: GenericPublicError
|
||||
|
||||
// swagger:route DELETE /v1/provisioning/templates/{name} provisioning stable RouteDeleteTemplate
|
||||
//
|
||||
@@ -33,6 +34,7 @@ package definitions
|
||||
//
|
||||
// Responses:
|
||||
// 204: description: The template was deleted successfully.
|
||||
// 409: GenericPublicError
|
||||
|
||||
// swagger:parameters RouteGetTemplate RoutePutTemplate RouteDeleteTemplate
|
||||
type RouteGetTemplateParam struct {
|
||||
@@ -41,18 +43,31 @@ type RouteGetTemplateParam struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// swagger:parameters stable RouteDeleteTemplate
|
||||
type RouteDeleteTemplateParam struct {
|
||||
// Template name
|
||||
// in:path
|
||||
Name string `json:"name"`
|
||||
|
||||
// Version of template to use for optimistic concurrency. Leave empty to disable validation
|
||||
// in:query
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
type NotificationTemplate struct {
|
||||
Name string `json:"name"`
|
||||
Template string `json:"template"`
|
||||
Provenance Provenance `json:"provenance,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Template string `json:"template"`
|
||||
Provenance Provenance `json:"provenance,omitempty"`
|
||||
ResourceVersion string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
type NotificationTemplates []NotificationTemplate
|
||||
|
||||
type NotificationTemplateContent struct {
|
||||
Template string `json:"template"`
|
||||
Template string `json:"template"`
|
||||
ResourceVersion string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// swagger:parameters RoutePutTemplate
|
||||
|
||||
@@ -2264,6 +2264,9 @@
|
||||
},
|
||||
"template": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@@ -2272,6 +2275,9 @@
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@@ -8395,16 +8401,28 @@
|
||||
"operationId": "RouteDeleteTemplate",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Template Name",
|
||||
"description": "Template name",
|
||||
"in": "path",
|
||||
"name": "name",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "Version of template to use for optimistic concurrency. Leave empty to disable validation",
|
||||
"in": "query",
|
||||
"name": "version",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": " The template was deleted successfully."
|
||||
},
|
||||
"409": {
|
||||
"description": "GenericPublicError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenericPublicError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "Delete a template.",
|
||||
@@ -8477,6 +8495,12 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "GenericPublicError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenericPublicError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "Updates an existing notification template.",
|
||||
|
||||
@@ -3393,6 +3393,12 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "GenericPublicError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenericPublicError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3406,15 +3412,27 @@
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Template Name",
|
||||
"description": "Template name",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Version of template to use for optimistic concurrency. Leave empty to disable validation",
|
||||
"name": "version",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": " The template was deleted successfully."
|
||||
},
|
||||
"409": {
|
||||
"description": "GenericPublicError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenericPublicError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5880,6 +5898,9 @@
|
||||
},
|
||||
"template": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -5888,6 +5909,9 @@
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user