-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
refactor(admin): stream_routes/upstreams/protos/services/global_rules/consumer_groups/plugin_configs #8661
Conversation
apisix/admin/consumer_group.lua
Outdated
|
||
utils.fix_count(res.body, id) | ||
return res.status, res.body | ||
return need_id and id or true |
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.
Look like we can move this line to resource.lua?
apisix/admin/routes.lua
Outdated
@@ -143,5 +143,6 @@ return resource.new({ | |||
name = "routes", | |||
kind = "route", | |||
schema = core.schema.route, | |||
checker = check_conf | |||
checker = check_conf, | |||
unsupported_methods = {} |
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 can leave this nil as this resource doesn't have unsupported methods.
apisix/admin/services.lua
Outdated
kind = "service", | ||
schema = core.schema.service, | ||
checker = check_conf, | ||
unsupported_methods = {}, |
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.
Ditto
apisix/admin/resource.lua
Outdated
return self.checker(id, conf, need_id, self.schema) | ||
local ok, err = self.checker(id, conf, need_id, self.schema) | ||
|
||
if err then |
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.
Code style, please use if not ok then
@@ -199,7 +199,17 @@ local function run() | |||
end | |||
|
|||
local code, data | |||
if seg_res == "routes" then | |||
local refactored_resources = { |
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.
directly named as resources
?
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.
There has been a global variable named resources
already. 😭 (https://github.com/apache/apisix/blob/master/apisix/admin/init.lua#L46)
Maybe we can rename that variable after all resources are refactored.
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.
ok
apisix/admin/resource.lua
Outdated
end | ||
|
||
|
||
function _M:get(id) | ||
if self.unsupported_methods and core.table.array_find(self.unsupported_methods, "get") then |
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.
Is it enough to use if core.table.array_find(self.unsupported_methods, "get") then
?
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.
@soulbird Done.
* upstream/master: feat(elasticsearch-logger): support multi elasticsearch endpoints (apache#8604) chore: use operator # instead of string.len (apache#8751) chore: hi 2023 (apache#8748) refactor(admin): stream_routes/upstreams/protos/services/global_rules/consumer_groups/plugin_configs (apache#8661) feat: support send error-log to kafka brokers (apache#8693) chore: upgrade `casbin` to `1.41.5` (apache#8744)
Description
Fixes #8569
Checklist