Skip to content

Commit

Permalink
API: Add deprecation notice for updating folder UID (#68543)
Browse files Browse the repository at this point in the history
* API: Add deprecation notice for updating folder UID

(cherry picked from commit 14fb4ff)
  • Loading branch information
papagian authored and grafanabot committed May 16, 2023
1 parent 18ef15e commit 570f5cd
Show file tree
Hide file tree
Showing 4 changed files with 293 additions and 120 deletions.
2 changes: 1 addition & 1 deletion docs/sources/developers/http_api/folder.md
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions pkg/services/folder/model.go
Expand Up @@ -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
Expand Down
192 changes: 145 additions & 47 deletions public/api-merged.json
Expand Up @@ -11570,9 +11570,13 @@
"type",
"state",
"annotations",
"alerts"
"activeAt"
],
"properties": {
"activeAt": {
"type": "string",
"format": "date-time"
},
"alerts": {
"type": "array",
"items": {
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
}
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -16911,6 +16897,13 @@
"items": {
"$ref": "#/definitions/RuleGroup"
}
},
"totals": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}
}
}
},
Expand Down Expand Up @@ -16947,6 +16940,13 @@
"items": {
"$ref": "#/definitions/AlertingRule"
}
},
"totals": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}
}
}
},
Expand Down Expand Up @@ -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"
},
Expand Down Expand Up @@ -17764,6 +17793,9 @@
},
"permission": {
"$ref": "#/definitions/PermissionType"
},
"uid": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -17826,6 +17858,9 @@
"type": "integer",
"format": "int64"
},
"teamUID": {
"type": "string"
},
"userId": {
"type": "integer",
"format": "int64"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -19143,7 +19249,6 @@
}
},
"alertGroup": {
"description": "AlertGroup alert group",
"type": "object",
"required": [
"alerts",
Expand Down Expand Up @@ -19328,13 +19433,13 @@
}
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"type": "array",
"items": {
"$ref": "#/definitions/gettableAlert"
}
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"type": "object",
"required": [
"comment",
Expand Down Expand Up @@ -19390,7 +19495,6 @@
}
},
"integration": {
"description": "Integration integration",
"type": "object",
"required": [
"name",
Expand Down Expand Up @@ -19534,7 +19638,6 @@
}
},
"postableSilence": {
"description": "PostableSilence postable silence",
"type": "object",
"required": [
"comment",
Expand Down Expand Up @@ -19572,6 +19675,7 @@
}
},
"receiver": {
"description": "Receiver receiver",
"type": "object",
"required": [
"active",
Expand Down Expand Up @@ -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": {
Expand All @@ -20392,12 +20496,6 @@
"$ref": "#/definitions/QueryHistoryDeleteQueryResponse"
}
},
"getQueryHistoryMigrationResponse": {
"description": "(empty)",
"schema": {
"$ref": "#/definitions/QueryHistoryMigrationResponse"
}
},
"getQueryHistoryResponse": {
"description": "(empty)",
"schema": {
Expand Down Expand Up @@ -20911,7 +21009,7 @@
"updatePlaylistResponse": {
"description": "(empty)",
"schema": {
"$ref": "#/definitions/Playlist"
"$ref": "#/definitions/Spec"
}
},
"updateServiceAccountResponse": {
Expand Down

0 comments on commit 570f5cd

Please sign in to comment.