API keys: Return 410 Gone status from POST /auth/keys endpoint (#92965)

* return 410 Gone status from POST /auth/keys endpoint

* generate swagger

* remove postAPIkeyResponse

* re-generate swagger

* remove docs for api key creation endpoint
This commit is contained in:
Mihai Doarna
2024-09-05 13:10:24 +03:00
committed by GitHub
parent de5bbd2539
commit ebd17adecf
6 changed files with 40 additions and 75 deletions

View File

@@ -89,47 +89,13 @@ Endpoint is obsolete and has been moved to [Grafana service account API]({{< rel
{{% admonition type="warning" %}}
### DEPRECATED
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
JSON Body schema:
- **name** The key name
- **role** Sets the access level/Grafana Role for the key. Can be one of the following values: `None`, `Viewer`, `Editor` or `Admin`.
- **secondsToLive** Sets the key expiration in seconds. It is optional. If it is a positive number an expiration date for the key is set. If it is null, zero or is omitted completely (unless `api_key_max_seconds_to_live` configuration option is set) the key will never expire.
Error statuses:
- **400** `api_key_max_seconds_to_live` is set but no `secondsToLive` is specified or `secondsToLive` is greater than this value.
- **500** The key was unable to be stored in the database.
**Example Response**:
```http
HTTP/1.1 301
Content-Type: application/json
```
## Delete API Key
{{% admonition type="warning" %}}
### DEPRECATED
{{% /admonition %}}
`DELETE /api/auth/keys/:id`
{{% /admonition %}}
`DELETE /api/auth/keys/:id`
**Required permissions**
| `apikeys:delete` | apikeys:\* |
See note in the [introduction]({{< ref "#authentication-api" >}}) for an explanation.
| Action | Scope |