From b4a23f00cb4d8aaa8f2ac3eed9171d295714c900 Mon Sep 17 00:00:00 2001 From: Domas Date: Fri, 19 Feb 2021 12:36:05 +0200 Subject: [PATCH] rename fodler->namespace for perms --- pkg/api/folders.go | 42 ------------------------------------------ pkg/api/permissions.go | 42 ++++++++++++++++++++++++++++++++++++++++++ spec.json | 25 ++++++++++++------------- 3 files changed, 54 insertions(+), 55 deletions(-) delete mode 100644 pkg/api/folders.go create mode 100644 pkg/api/permissions.go diff --git a/pkg/api/folders.go b/pkg/api/folders.go deleted file mode 100644 index f9a4f900786..00000000000 --- a/pkg/api/folders.go +++ /dev/null @@ -1,42 +0,0 @@ -// swagger:route GET /api/v1/folder/{Id}/permissions folders RouteGetFolderPermissions -// -// sets an Alerting config -// -// Responses: -// 200: Permissions -// 400: ValidationError - -// swagger:route POST /api/v1/folder/{Id}/permissions folders RouteSetFolderPermissions -// -// gets an Alerting config -// -// Responses: -// 201: Ack -// 400: ValidationError - -package api - -import ( - "github.com/grafana/grafana/pkg/api/dtos" -) - -// swagger:model -type Permissions []dtos.UpdateDashboardAclCommand - -// swagger:parameters RouteGetFolderPermissions -type GetFolderPermsEndpointParams struct { - // Id of a folder - // in: path - Id string -} - -// swagger:parameters RouteSetFolderPermissions -type SetFolderPermsEndpointParams struct { - // Id of a folder - // in: path - Id string - - // New folder permissions - // in: body - Body Permissions -} diff --git a/pkg/api/permissions.go b/pkg/api/permissions.go new file mode 100644 index 00000000000..4a53378b2d8 --- /dev/null +++ b/pkg/api/permissions.go @@ -0,0 +1,42 @@ +// swagger:route GET /api/v1/namespace/{Namespace}/permissions permissions RouteGetNamespacePermissions +// +// sets an Alerting config +// +// Responses: +// 200: Permissions +// 400: ValidationError + +// swagger:route POST /api/v1/namespace/{Namespace}/permissions permissions RouteSetNamespacePermissions +// +// gets an Alerting config +// +// Responses: +// 201: Ack +// 400: ValidationError + +package api + +import ( + "github.com/grafana/grafana/pkg/api/dtos" +) + +// swagger:model +type Permissions []dtos.UpdateDashboardAclCommand + +// swagger:parameters RouteGetNamespacePermissions +type GetNamespacePermsEndpointParams struct { + // Namespace name + // in: path + Namespace string +} + +// swagger:parameters RouteSetNamespacePermissions +type SetNamespacePermsEndpointParams struct { + // Namespace name to apply perms to + // in: path + Namespace string + + // New namespace permissions + // in: body + Body Permissions +} diff --git a/spec.json b/spec.json index 23c9672620b..de42b203177 100644 --- a/spec.json +++ b/spec.json @@ -222,18 +222,18 @@ } } }, - "/api/v1/folder/{Id}/permissions": { + "/api/v1/namespace/{Namespace}/permissions": { "get": { "description": "sets an Alerting config", "tags": [ - "folders" + "permissions" ], - "operationId": "RouteGetFolderPermissions", + "operationId": "RouteGetNamespacePermissions", "parameters": [ { "type": "string", - "description": "Id of a folder", - "name": "Id", + "description": "Namespace name", + "name": "Namespace", "in": "path", "required": true } @@ -256,19 +256,19 @@ "post": { "description": "gets an Alerting config", "tags": [ - "folders" + "permissions" ], - "operationId": "RouteSetFolderPermissions", + "operationId": "RouteSetNamespacePermissions", "parameters": [ { "type": "string", - "description": "Id of a folder", - "name": "Id", + "description": "Namespace name to apply perms to", + "name": "Namespace", "in": "path", "required": true }, { - "description": "New folder permissions", + "description": "New namespace permissions", "name": "Body", "in": "body", "schema": { @@ -1784,9 +1784,8 @@ "x-go-package": "github.com/prometheus/common/config" }, "URL": { - "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.", "type": "object", - "title": "A URL represents a parsed URL (technically, a URI reference).", + "title": "URL is a custom URL type that allows validation at configuration load time.", "properties": { "ForceQuery": { "type": "boolean" @@ -1819,7 +1818,7 @@ "$ref": "#/definitions/Userinfo" } }, - "x-go-package": "net/url" + "x-go-package": "github.com/prometheus/common/config" }, "UpdateDashboardAclCommand": { "type": "object",