Agree, it is a needed feature.

Kind regards,
Bobur

On Tue, Sep 20, 2022 at 11:42 AM YuanSheng Wang <membp...@apache.org> wrote:

> it is a nice new feature.
>
> Can't wait to try it.
>
>
> On Sun, Sep 18, 2022 at 10:57 AM Zhiyuan Ju <juzhiy...@apache.org> wrote:
>
> > Hi,
> >
> > The description is clear to me, and the API design looks good!
> >
> >
> > Jinhua Luo <luajit...@gmail.com> 于2022年9月2日周五 11:45写道:
> >
> > > Background:
> > >
> > > With consumer groups, you can define any number of plugins, e.g. rate
> > > limiting and apply them to a set of consumers, instead of managing
> > > each consumer individually.
> > >
> > > While configuring the same plugin for the same route, only one copy of
> > > the configuration is valid. The order of precedence is Consumer >
> > > Consumer group > Route > plugin_config> Service.
> > >
> > >
> > > Admin API design:
> > >
> > > GET
> > > /apisix/admin/consumer_groups
> > > Fetches a list of all Consumer groups.
> > >
> > > GET
> > > /apisix/admin/consumer_groups/{id}
> > > Fetches specified Consumer group by id.
> > >
> > > PUT
> > > /apisix/admin/consumer_groups/{id}
> > > Creates or updates a new consumer group with the specified id.
> > >
> > > DELETE
> > > /apisix/admin/consumer_groups/{id}
> > > Removes the Consumer group with the specified id.
> > >
> > > PATCH
> > > /apisix/admin/consumer_groups/{id}
> > > Updates the attributes specified, existing Consumer group. To delete
> > > an attribute, set value of attribute set to null.
> > >
> > > PATCH
> > > /apisix/admin/consumer_groups/{id}/{path}
> > > Updates the attribute specified in the path. The values of other
> > > attributes remain unchanged.
> > >
> > >
> > > Add new variable to indicate the consumer group of the route:
> > > $consumer_group_id
> > >
> > >
> > > Example:
> > >
> > > curl http://127.0.0.1:9180/apisix/admin/consumer_groups/company_a -H
> > > 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
> > > {
> > > "plugins": {
> > > "limit-count": {
> > > "count": 200,
> > > "time_window": 60,
> > > "rejected_code": 503,
> > > "group": "$consumer_group_id"
> > > }
> > > }
> > > }'
> > >
> > >
> > > curl http://127.0.0.1:9180/apisix/admin/consumers -H 'X-API-KEY:
> > > edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
> > > {
> > > "username": "jack",
> > > "plugins": {
> > > "key-auth": {
> > > "key": "auth-one"
> > > }
> > > },
> > > "group_id": "company_a"
> > > }'
> > >
> > >
> > > curl http://127.0.0.1:9180/apisix/admin/consumers -H 'X-API-KEY:
> > > edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
> > > {
> > > "username": "johnson",
> > > "plugins": {
> > > "key-auth": {
> > > "key": "auth-two"
> > > }
> > > },
> > > "group_id": "company_a"
> > > }'
> > >
> > >
> > > curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY:
> > > edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
> > > {
> > > "uri": "/get",
> > > "plugins": {
> > > "key-auth": {}
> > > },
> > > "upstream": {
> > > "type": "roundrobin",
> > > "nodes": {
> > > "httpbin.org": 1
> > > }
> > > }
> > > }'
> > >
> > >
> > > curl -i http://127.0.0.1:9180/get -H 'apikey: auth-one'
> > > ...
> > > X-RateLimit-Limit: 200
> > > X-RateLimit-Remaining: 199
> > > ...
> > >
> > >
> > > curl -i http://127.0.0.1:9180/get -H 'apikey: auth-two'
> > > ...
> > > X-RateLimit-Limit: 200
> > > X-RateLimit-Remaining: 198
> > > ...
> > >
> >
>
>
> --
>
> *MembPhis*
> My GitHub: https://github.com/membphis
> Apache APISIX: https://github.com/apache/apisix
>

Reply via email to