-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Public Role APIs #20732
Public Role APIs #20732
Changes from 27 commits
c2474b2
50e4fc1
366df0f
a03ac1b
55f59b3
25ddb7b
35a7def
c9a64c6
70862b2
da8d5db
0abe3b6
7c22748
e9f8a73
3b1ddc3
cff2b89
5ee5d23
2072348
3e9e8bd
fa03390
2566043
77ab30b
694ed25
4096ae0
941cf2b
7bcaac7
f00cb3e
b599fda
8b7cb3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import _ from 'lodash'; | ||
import Joi from 'joi'; | ||
import { wrapError } from '../../../../lib/errors'; | ||
|
||
export function initDeleteRolesApi(server, callWithRequest, routePreCheckLicenseFn) { | ||
server.route({ | ||
method: 'DELETE', | ||
path: '/api/security/role/{name}', | ||
handler(request, reply) { | ||
const name = request.params.name; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edit - I'm withdrawing this comment, but leaving it here for posterity.
{"statusCode":404,"error":"Not Found","message":"Not Found"}
|
||
return callWithRequest(request, 'shield.deleteRole', { name }).then( | ||
() => reply().code(204), | ||
_.flow(wrapError, reply)); | ||
}, | ||
config: { | ||
validate: { | ||
params: Joi.object() | ||
.keys({ | ||
name: Joi.string() | ||
.required(), | ||
}) | ||
.required(), | ||
}, | ||
pre: [routePreCheckLicenseFn] | ||
} | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a precedent for how to version our public APIs yet? I'm concerned that not including a version number will prevent us from iterating in minor versions. Or at the other side of the spectrum, these public APIs could inadvertently become fluid like our plugin API, where users have to tie to a specific minor/patch release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want our public APIs to be versioned with our "product version" so that when we do a major release, we are able to make breaking changes to the APIs. If we had to do a breaking change in a minor, we'd have to put it in the release notes and have a very good reason for doing so. We don't want "multiple versions" for stuff like this.