From 14fb4ff779df5b79495a5cc894cf658d93fd8352 Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com> Date: Tue, 16 May 2023 18:28:18 +0300 Subject: [PATCH] API: Add deprecation notice for updating folder UID (#68543) * API: Add deprecation notice for updating folder UID --- docs/sources/developers/http_api/folder.md | 2 +- pkg/services/folder/model.go | 2 + public/api-merged.json | 192 +++++++++++++----- public/openapi3.json | 217 ++++++++++++++------- 4 files changed, 293 insertions(+), 120 deletions(-) diff --git a/docs/sources/developers/http_api/folder.md b/docs/sources/developers/http_api/folder.md index e4525e632d5..402829eb7ac 100644 --- a/docs/sources/developers/http_api/folder.md +++ b/docs/sources/developers/http_api/folder.md @@ -222,7 +222,7 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk JSON Body schema: -- **uid** – Provide another [unique identifier](/http_api/folder/#identifier-id-vs-unique-identifier-uid) than stored to change the unique identifier. +- **uid** – Provide another [unique identifier](/http_api/folder/#identifier-id-vs-unique-identifier-uid) than stored to change the unique identifier. Starting with 10.0, this is **deprecated**. It will be removed in a future release. Please avoid using it because it can result in folder losing its permissions. - **title** – The title of the folder. - **version** – Provide the current version to be able to update the folder. Not needed if `overwrite=true`. - **overwrite** – Set to true if you want to overwrite existing folder with newer version. diff --git a/pkg/services/folder/model.go b/pkg/services/folder/model.go index 21e021cd39d..d112ad34697 100644 --- a/pkg/services/folder/model.go +++ b/pkg/services/folder/model.go @@ -90,6 +90,8 @@ type UpdateFolderCommand struct { UID string `json:"-"` OrgID int64 `json:"-"` // NewUID it's an optional parameter used for overriding the existing folder UID + // Starting with 10.0, this is deprecated. It will be removed in a future release. + // Please avoid using it because it can result in folder loosing its permissions. NewUID *string `json:"uid"` // keep same json tag with the legacy command for not breaking the existing APIs // NewTitle it's an optional parameter used for overriding the existing folder title NewTitle *string `json:"title"` // keep same json tag with the legacy command for not breaking the existing APIs diff --git a/public/api-merged.json b/public/api-merged.json index 3510557e8e7..9b47c7b0557 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -11570,9 +11570,13 @@ "type", "state", "annotations", - "alerts" + "activeAt" ], "properties": { + "activeAt": { + "type": "string", + "format": "date-time" + }, "alerts": { "type": "array", "items": { @@ -11613,6 +11617,20 @@ "description": "State can be \"pending\", \"firing\", \"inactive\".", "type": "string" }, + "totals": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + }, + "totalsFiltered": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + }, "type": { "$ref": "#/definitions/RuleType" } @@ -15639,15 +15657,12 @@ "format": "int64" }, "interval": { - "description": "Interval sets the time between switching views in a playlist.\nFIXME: Is this based on a standardized format or what options are available? Can datemath be used?", "type": "string" }, "name": { - "description": "Name of the playlist.", "type": "string" }, "uid": { - "description": "Unique playlist identifier. Generated on creation, either by the\ncreator of the playlist of by the application.", "type": "string" } } @@ -16059,35 +16074,6 @@ } } }, - "Preferences": { - "type": "object", - "title": "Preferences defines model for Preferences.", - "properties": { - "homeDashboardUID": { - "description": "UID for the home dashboard", - "type": "string" - }, - "language": { - "description": "Selected language (beta)", - "type": "string" - }, - "queryHistory": { - "$ref": "#/definitions/QueryHistoryPreference" - }, - "theme": { - "description": "Theme light, dark, empty is default", - "type": "string" - }, - "timezone": { - "description": "The timezone selection\nTODO: this should use the timezone defined in common", - "type": "string" - }, - "weekStart": { - "description": "WeekStart day of the week (sunday, monday, etc)", - "type": "string" - } - } - }, "PrometheusRemoteWriteTargetJSON": { "type": "object", "properties": { @@ -16911,6 +16897,13 @@ "items": { "$ref": "#/definitions/RuleGroup" } + }, + "totals": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } } } }, @@ -16947,6 +16940,13 @@ "items": { "$ref": "#/definitions/AlertingRule" } + }, + "totals": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } } } }, @@ -17629,6 +17629,35 @@ "SmtpNotEnabled": { "$ref": "#/definitions/ResponseDetails" }, + "Spec": { + "type": "object", + "title": "Spec defines model for Spec.", + "properties": { + "homeDashboardUID": { + "description": "UID for the home dashboard", + "type": "string" + }, + "language": { + "description": "Selected language (beta)", + "type": "string" + }, + "queryHistory": { + "$ref": "#/definitions/QueryHistoryPreference" + }, + "theme": { + "description": "Theme light, dark, empty is default", + "type": "string" + }, + "timezone": { + "description": "The timezone selection\nTODO: this should use the timezone defined in common", + "type": "string" + }, + "weekStart": { + "description": "WeekStart day of the week (sunday, monday, etc)", + "type": "string" + } + } + }, "State": { "type": "string" }, @@ -17764,6 +17793,9 @@ }, "permission": { "$ref": "#/definitions/PermissionType" + }, + "uid": { + "type": "string" } } }, @@ -17826,6 +17858,9 @@ "type": "integer", "format": "int64" }, + "teamUID": { + "type": "string" + }, "userId": { "type": "integer", "format": "int64" @@ -18019,6 +18054,77 @@ } } }, + "TestTemplatesConfigBodyParams": { + "type": "object", + "properties": { + "alerts": { + "description": "Alerts to use as data when testing the template.", + "type": "array", + "items": { + "$ref": "#/definitions/postableAlert" + } + }, + "name": { + "description": "Name of the template file.", + "type": "string" + }, + "template": { + "description": "Template string to test.", + "type": "string" + } + } + }, + "TestTemplatesErrorResult": { + "type": "object", + "properties": { + "kind": { + "description": "Kind of template error that occurred.", + "type": "string", + "enum": [ + "invalid_template", + "execution_error" + ] + }, + "message": { + "description": "Error message.", + "type": "string" + }, + "name": { + "description": "Name of the associated template for this error. Will be empty if the Kind is \"invalid_template\".", + "type": "string" + } + } + }, + "TestTemplatesResult": { + "type": "object", + "properties": { + "name": { + "description": "Name of the associated template definition for this result.", + "type": "string" + }, + "text": { + "description": "Interpolated value of the template.", + "type": "string" + } + } + }, + "TestTemplatesResults": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/definitions/TestTemplatesErrorResult" + } + }, + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/TestTemplatesResult" + } + } + } + }, "Threshold": { "description": "Threshold a single step on the threshold list", "type": "object", @@ -18556,7 +18662,7 @@ "type": "string" }, "uid": { - "description": "NewUID it's an optional parameter used for overriding the existing folder UID", + "description": "NewUID it's an optional parameter used for overriding the existing folder UID\nStarting with 10.0, this is deprecated. It will be removed in a future release.\nPlease avoid using it because it can result in folder loosing its permissions.", "type": "string" }, "version": { @@ -19143,7 +19249,6 @@ } }, "alertGroup": { - "description": "AlertGroup alert group", "type": "object", "required": [ "alerts", @@ -19328,13 +19433,13 @@ } }, "gettableAlerts": { + "description": "GettableAlerts gettable alerts", "type": "array", "items": { "$ref": "#/definitions/gettableAlert" } }, "gettableSilence": { - "description": "GettableSilence gettable silence", "type": "object", "required": [ "comment", @@ -19390,7 +19495,6 @@ } }, "integration": { - "description": "Integration integration", "type": "object", "required": [ "name", @@ -19534,7 +19638,6 @@ } }, "postableSilence": { - "description": "PostableSilence postable silence", "type": "object", "required": [ "comment", @@ -19572,6 +19675,7 @@ } }, "receiver": { + "description": "Receiver receiver", "type": "object", "required": [ "active", @@ -20377,13 +20481,13 @@ "getPlaylistResponse": { "description": "(empty)", "schema": { - "$ref": "#/definitions/Playlist" + "$ref": "#/definitions/Spec" } }, "getPreferencesResponse": { "description": "(empty)", "schema": { - "$ref": "#/definitions/Preferences" + "$ref": "#/definitions/Spec" } }, "getQueryHistoryDeleteQueryResponse": { @@ -20392,12 +20496,6 @@ "$ref": "#/definitions/QueryHistoryDeleteQueryResponse" } }, - "getQueryHistoryMigrationResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/QueryHistoryMigrationResponse" - } - }, "getQueryHistoryResponse": { "description": "(empty)", "schema": { @@ -20911,7 +21009,7 @@ "updatePlaylistResponse": { "description": "(empty)", "schema": { - "$ref": "#/definitions/Playlist" + "$ref": "#/definitions/Spec" } }, "updateServiceAccountResponse": { diff --git a/public/openapi3.json b/public/openapi3.json index e57890b10b5..51abfa9780a 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -977,7 +977,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Playlist" + "$ref": "#/components/schemas/Spec" } } }, @@ -987,7 +987,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Preferences" + "$ref": "#/components/schemas/Spec" } } }, @@ -1003,16 +1003,6 @@ }, "description": "(empty)" }, - "getQueryHistoryMigrationResponse": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryHistoryMigrationResponse" - } - } - }, - "description": "(empty)" - }, "getQueryHistoryResponse": { "content": { "application/json": { @@ -1747,7 +1737,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Playlist" + "$ref": "#/components/schemas/Spec" } } }, @@ -2664,6 +2654,10 @@ "AlertingRule": { "description": "adapted from cortex", "properties": { + "activeAt": { + "format": "date-time", + "type": "string" + }, "alerts": { "items": { "$ref": "#/components/schemas/Alert" @@ -2704,6 +2698,20 @@ "description": "State can be \"pending\", \"firing\", \"inactive\".", "type": "string" }, + "totals": { + "additionalProperties": { + "format": "int64", + "type": "integer" + }, + "type": "object" + }, + "totalsFiltered": { + "additionalProperties": { + "format": "int64", + "type": "integer" + }, + "type": "object" + }, "type": { "$ref": "#/components/schemas/RuleType" } @@ -2715,7 +2723,7 @@ "type", "state", "annotations", - "alerts" + "activeAt" ], "type": "object" }, @@ -6738,15 +6746,12 @@ "type": "integer" }, "interval": { - "description": "Interval sets the time between switching views in a playlist.\nFIXME: Is this based on a standardized format or what options are available? Can datemath be used?", "type": "string" }, "name": { - "description": "Name of the playlist.", "type": "string" }, "uid": { - "description": "Unique playlist identifier. Generated on creation, either by the\ncreator of the playlist of by the application.", "type": "string" } }, @@ -7159,35 +7164,6 @@ }, "type": "object" }, - "Preferences": { - "properties": { - "homeDashboardUID": { - "description": "UID for the home dashboard", - "type": "string" - }, - "language": { - "description": "Selected language (beta)", - "type": "string" - }, - "queryHistory": { - "$ref": "#/components/schemas/QueryHistoryPreference" - }, - "theme": { - "description": "Theme light, dark, empty is default", - "type": "string" - }, - "timezone": { - "description": "The timezone selection\nTODO: this should use the timezone defined in common", - "type": "string" - }, - "weekStart": { - "description": "WeekStart day of the week (sunday, monday, etc)", - "type": "string" - } - }, - "title": "Preferences defines model for Preferences.", - "type": "object" - }, "PrometheusRemoteWriteTargetJSON": { "properties": { "data_source_uid": { @@ -7591,27 +7567,6 @@ "title": "QueryStat is used for storing arbitrary statistics metadata related to a query and its result, e.g. total request time, data processing time.", "type": "object" }, - "QueryToMigrate": { - "properties": { - "comment": { - "type": "string" - }, - "createdAt": { - "format": "int64", - "type": "integer" - }, - "datasourceUid": { - "type": "string" - }, - "queries": { - "$ref": "#/components/schemas/Json" - }, - "starred": { - "type": "boolean" - } - }, - "type": "object" - }, "QuotaDTO": { "properties": { "limit": { @@ -8028,6 +7983,13 @@ "$ref": "#/components/schemas/RuleGroup" }, "type": "array" + }, + "totals": { + "additionalProperties": { + "format": "int64", + "type": "integer" + }, + "type": "object" } }, "required": [ @@ -8061,6 +8023,13 @@ "$ref": "#/components/schemas/AlertingRule" }, "type": "array" + }, + "totals": { + "additionalProperties": { + "format": "int64", + "type": "integer" + }, + "type": "object" } }, "required": [ @@ -8749,6 +8718,35 @@ "SmtpNotEnabled": { "$ref": "#/components/schemas/ResponseDetails" }, + "Spec": { + "properties": { + "homeDashboardUID": { + "description": "UID for the home dashboard", + "type": "string" + }, + "language": { + "description": "Selected language (beta)", + "type": "string" + }, + "queryHistory": { + "$ref": "#/components/schemas/QueryHistoryPreference" + }, + "theme": { + "description": "Theme light, dark, empty is default", + "type": "string" + }, + "timezone": { + "description": "The timezone selection\nTODO: this should use the timezone defined in common", + "type": "string" + }, + "weekStart": { + "description": "WeekStart day of the week (sunday, monday, etc)", + "type": "string" + } + }, + "title": "Spec defines model for Spec.", + "type": "object" + }, "State": { "type": "string" }, @@ -8883,6 +8881,9 @@ }, "permission": { "$ref": "#/components/schemas/PermissionType" + }, + "uid": { + "type": "string" } }, "type": "object" @@ -8945,6 +8946,9 @@ "format": "int64", "type": "integer" }, + "teamUID": { + "type": "string" + }, "userId": { "format": "int64", "type": "integer" @@ -9139,6 +9143,77 @@ }, "type": "object" }, + "TestTemplatesConfigBodyParams": { + "properties": { + "alerts": { + "description": "Alerts to use as data when testing the template.", + "items": { + "$ref": "#/components/schemas/postableAlert" + }, + "type": "array" + }, + "name": { + "description": "Name of the template file.", + "type": "string" + }, + "template": { + "description": "Template string to test.", + "type": "string" + } + }, + "type": "object" + }, + "TestTemplatesErrorResult": { + "properties": { + "kind": { + "description": "Kind of template error that occurred.", + "enum": [ + "invalid_template", + "execution_error" + ], + "type": "string" + }, + "message": { + "description": "Error message.", + "type": "string" + }, + "name": { + "description": "Name of the associated template for this error. Will be empty if the Kind is \"invalid_template\".", + "type": "string" + } + }, + "type": "object" + }, + "TestTemplatesResult": { + "properties": { + "name": { + "description": "Name of the associated template definition for this result.", + "type": "string" + }, + "text": { + "description": "Interpolated value of the template.", + "type": "string" + } + }, + "type": "object" + }, + "TestTemplatesResults": { + "properties": { + "errors": { + "items": { + "$ref": "#/components/schemas/TestTemplatesErrorResult" + }, + "type": "array" + }, + "results": { + "items": { + "$ref": "#/components/schemas/TestTemplatesResult" + }, + "type": "array" + } + }, + "type": "object" + }, "Threshold": { "description": "Threshold a single step on the threshold list", "properties": { @@ -9675,7 +9750,7 @@ "type": "string" }, "uid": { - "description": "NewUID it's an optional parameter used for overriding the existing folder UID", + "description": "NewUID it's an optional parameter used for overriding the existing folder UID\nStarting with 10.0, this is deprecated. It will be removed in a future release.\nPlease avoid using it because it can result in folder loosing its permissions.", "type": "string" }, "version": { @@ -10263,7 +10338,6 @@ "type": "object" }, "alertGroup": { - "description": "AlertGroup alert group", "properties": { "alerts": { "description": "alerts", @@ -10448,13 +10522,13 @@ "type": "object" }, "gettableAlerts": { + "description": "GettableAlerts gettable alerts", "items": { "$ref": "#/components/schemas/gettableAlert" }, "type": "array" }, "gettableSilence": { - "description": "GettableSilence gettable silence", "properties": { "comment": { "description": "comment", @@ -10510,7 +10584,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", @@ -10654,7 +10727,6 @@ "type": "array" }, "postableSilence": { - "description": "PostableSilence postable silence", "properties": { "comment": { "description": "comment", @@ -10692,6 +10764,7 @@ "type": "object" }, "receiver": { + "description": "Receiver receiver", "properties": { "active": { "description": "active",