This repository contains the Rate Service used by Bit-Broker.
The Rate Service implements an HTTP REST API for the CRUD of the configuration and extends the gRPC v2 ratelimit proto (used by Ambassador).
It can be deployed using the following helm chart:
Adds a new configuration or updates an existing one with the unique identifier "UID".
-
URL
/api/v1/:uid/config
-
Method:
PUT
-
URL Params
Required:
uid=[integer]
-
Body
Required:
{ "enabled": "true|false (Enable/Disable globally)", "rate": "N (Number of requests per second)", "quota": { "max_number": "N (Max requests)", "interval_type": "month|day (Per interval)" } }
-
Success Response:
- Code: 200
- Code: 200
-
Error Response:
- Code: 404
- Code: 404
-
Sample Call:
curl --location --request PUT '/api/v1/1/config' \ --header 'Content-Type: application/json' \ --data-raw '{ "enabled": true, "rate":5, "quota":{ "max_number": 20, "interval_type": "month" } }'
Returns the existing configuration with the unique identifier "UID".
-
URL
/api/v1/:uid/config
-
Method:
GET
-
URL Params
Required:
uid=[integer]
-
Success Response:
- Code: 200
- Code: 200
-
Error Response:
- Code: 404
- Code: 404
-
Sample Call:
curl --location --request GET '/api/v1/1/config'
Deletes the existing configuration with the unique identifier "UID".
-
URL
/api/v1/:uid/config
-
Method:
DELETE
-
URL Params
Required:
uid=[integer]
-
Success Response:
- Code: 200
- Code: 200
-
Error Response:
- Code: 404
- Code: 404
-
Sample Call:
curl --location --request DELETE '/api/v1/1/config'