Skip to content

Latest commit

 

History

History
145 lines (89 loc) · 2.46 KB

INFO.md

File metadata and controls

145 lines (89 loc) · 2.46 KB

Bit-Broker

Bit-Broker Rate Service

Github Actions

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).

Deployment

It can be deployed using the following helm chart:

Rate Service Helm Chart

Documentation

REST API

Set or Update Configuration


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
  • Error Response:

    • 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"
      }
    }'
    

Get Configuration


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
  • Error Response:

    • Code: 404
  • Sample Call:

    curl --location --request GET '/api/v1/1/config'
    

Delete Configuration


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
  • Error Response:

    • Code: 404
  • Sample Call:

    curl --location --request DELETE '/api/v1/1/config'
    

gRPC Proto

Envoy v2 RateLimit Proto