Auth: Add swagger metadata for the update SSO Settings endpoint (#79580)

* add swagger doc for sso settings update endpoint

* add generated api specs
This commit is contained in:
Mihai Doarna 2023-12-18 11:18:19 +02:00 committed by GitHub
parent 53d209e6f1
commit 9648a06dde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 185 additions and 5 deletions

View File

@ -105,6 +105,20 @@ func (api *Api) getProviderSettings(c *contextmodel.ReqContext) response.Respons
return response.JSON(http.StatusOK, settings)
}
// swagger:route PUT /v1/sso-settings/{key} sso_settings updateProviderSettings
//
// # Update SSO Settings
//
// Inserts or updates the SSO Settings for a provider.
//
// You need to have a permission with action `settings:write` and scope `settings:auth.<provider>:*`.
//
// Responses:
// 204: okResponse
// 400: badRequestError
// 401: unauthorisedError
// 403: forbiddenError
// 500: internalServerError
func (api *Api) updateProviderSettings(c *contextmodel.ReqContext) response.Response {
key, ok := web.Params(c.Req)[":key"]
if !ok {
@ -133,9 +147,9 @@ func (api *Api) updateProviderSettings(c *contextmodel.ReqContext) response.Resp
//
// # Remove SSO Settings
//
// # Remove an SSO Settings entry by Key
// Removes the SSO Settings for a provider.
//
// You need to have a permission with action `settings:write` with scope `settings:auth.<provider>:*`.
// You need to have a permission with action `settings:write` and scope `settings:auth.<provider>:*`.
//
// Responses:
// 204: okResponse
@ -160,9 +174,19 @@ func (api *Api) removeProviderSettings(c *contextmodel.ReqContext) response.Resp
return response.JSON(http.StatusNoContent, nil)
}
// swagger:parameters updateProviderSettings
type UpdateProviderSettingsParams struct {
// in:path
// required:true
Provider string `json:"key"`
// in:body
// required:true
Body models.SSOSettings `json:"body"`
}
// swagger:parameters removeProviderSettings
type RemoveProviderSettingsParams struct {
// in:path
// required:true
Key string `json:"key"`
Provider string `json:"key"`
}

View File

@ -5737,6 +5737,9 @@
"isEnabled": {
"type": "boolean"
},
"slug": {
"type": "string"
},
"title": {
"type": "string"
},
@ -6368,6 +6371,24 @@
}
}
},
"SSOSettings": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"provider": {
"type": "string"
},
"settings": {
"type": "object",
"additionalProperties": {}
},
"source": {
"$ref": "#/definitions/SettingsSource"
}
}
},
"SaveDashboardCommand": {
"type": "object",
"properties": {
@ -6716,6 +6737,10 @@
}
}
},
"SettingsSource": {
"type": "integer",
"format": "int64"
},
"ShareType": {
"type": "string"
},

View File

@ -11017,8 +11017,49 @@
}
},
"/v1/sso-settings/{key}": {
"put": {
"description": "Inserts or updates the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.",
"tags": [
"sso_settings"
],
"summary": "Update SSO Settings",
"operationId": "updateProviderSettings",
"parameters": [
{
"type": "string",
"name": "key",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SSOSettings"
}
}
],
"responses": {
"204": {
"$ref": "#/responses/okResponse"
},
"400": {
"$ref": "#/responses/badRequestError"
},
"401": {
"$ref": "#/responses/unauthorisedError"
},
"403": {
"$ref": "#/responses/forbiddenError"
},
"500": {
"$ref": "#/responses/internalServerError"
}
}
},
"delete": {
"description": "# Remove an SSO Settings entry by Key\n\nYou need to have a permission with action `settings:write` with scope `settings:auth.\u003cprovider\u003e:*`.",
"description": "Removes the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.",
"tags": [
"sso_settings"
],
@ -18512,6 +18553,24 @@
}
}
},
"SSOSettings": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"provider": {
"type": "string"
},
"settings": {
"type": "object",
"additionalProperties": false
},
"source": {
"$ref": "#/definitions/SettingsSource"
}
}
},
"Sample": {
"type": "object",
"title": "Sample is a single sample belonging to a metric.",
@ -18888,6 +18947,10 @@
}
}
},
"SettingsSource": {
"type": "integer",
"format": "int64"
},
"ShareType": {
"type": "string"
},

View File

@ -9404,6 +9404,24 @@
},
"type": "object"
},
"SSOSettings": {
"properties": {
"id": {
"type": "string"
},
"provider": {
"type": "string"
},
"settings": {
"additionalProperties": false,
"type": "object"
},
"source": {
"$ref": "#/components/schemas/SettingsSource"
}
},
"type": "object"
},
"Sample": {
"properties": {
"H": {
@ -9779,6 +9797,10 @@
},
"type": "object"
},
"SettingsSource": {
"format": "int64",
"type": "integer"
},
"ShareType": {
"type": "string"
},
@ -24163,7 +24185,7 @@
},
"/v1/sso-settings/{key}": {
"delete": {
"description": "# Remove an SSO Settings entry by Key\n\nYou need to have a permission with action `settings:write` with scope `settings:auth.\u003cprovider\u003e:*`.",
"description": "Removes the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.",
"operationId": "removeProviderSettings",
"parameters": [
{
@ -24196,6 +24218,52 @@
"tags": [
"sso_settings"
]
},
"put": {
"description": "Inserts or updates the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.",
"operationId": "updateProviderSettings",
"parameters": [
{
"in": "path",
"name": "key",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SSOSettings"
}
}
},
"required": true,
"x-originalParamName": "body"
},
"responses": {
"204": {
"$ref": "#/components/responses/okResponse"
},
"400": {
"$ref": "#/components/responses/badRequestError"
},
"401": {
"$ref": "#/components/responses/unauthorisedError"
},
"403": {
"$ref": "#/components/responses/forbiddenError"
},
"500": {
"$ref": "#/components/responses/internalServerError"
}
},
"summary": "Update SSO Settings",
"tags": [
"sso_settings"
]
}
}
},