Skip to content
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

feat(ratelimit): implement rate-limiter API #886

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Mar 28, 2023

Create

$ fastly rate-limit create \
  --action response \
  --client-key "req.http.Fastly-Client-IP, req.http.User-Agent" \
  --http-methods "post, put, patch, delete" \
  --name <RATE_LIMITER_NAME> \
  --penalty-box-dur 30 \
  --response-content '{"reason": "Too many requests"}' \
  --response-content-type application/json \
  --response-status 429 \
  --rps-limit 10000 \
  --service-id <SERVICE_ID> \
  --version 1 \
  --window-size 10

SUCCESS: Created rate limiter '<RATE_LIMITER_NAME>' (<RATE_LIMITER_ID>)

Update

fastly rate-limit update \
  --action response \
  --client-key "req.http.Fastly-Client-IP, req.http.User-Agent" \
  --id <RATE_LIMITER_ID> \
  --http-methods "post, put, patch, delete" \
  --name <RATE_LIMITER_NAME> \
  --penalty-box-dur 30 \
  --response-content '{"reason": "Too many requests"}' \
  --response-content-type application/json \
  --response-status 429 \
  --rps-limit 10000 \
  --window-size 10

SUCCESS: Updated rate limiter '<RATE_LIMITER_NAME>' (<RATE_LIMITER_ID>)

fastly rate-limit update \
  --id <RATE_LIMITER_ID> \
  --name new-name-here

SUCCESS: Updated rate limiter '<RATE_LIMITER_NAME>' (<RATE_LIMITER_ID>)

List

fastly rate-limit list --version 1 --service-id <SERVICE_ID>

Describe

fastly rate-limit describe --id <RATE_LIMITER_ID>

Delete

fastly rate-limit delete --id <RATE_LIMITER_ID>

@Integralist Integralist force-pushed the integralist/rate-limiter branch 3 times, most recently from abf5ab0 to 08ee905 Compare March 28, 2023 10:27
@Integralist Integralist added the enhancement New feature or request label Mar 28, 2023
@Integralist Integralist force-pushed the integralist/rate-limiter branch 3 times, most recently from 4550089 to 69c5fcb Compare March 28, 2023 15:10
@Integralist Integralist marked this pull request as ready for review March 28, 2023 15:10
@Integralist Integralist force-pushed the integralist/rate-limiter branch 3 times, most recently from 7b006c4 to a88fe28 Compare March 28, 2023 16:06
@Integralist Integralist merged commit 980ff16 into main Mar 28, 2023
@Integralist Integralist deleted the integralist/rate-limiter branch March 28, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant