ves-io-schema-views-rate_limiter_policy-API-Replace

Examples of replacing ratelimiterpolicy

Usecase:

Replace rate-limiter-policy-1

Request using vesctl:

vesctl configuration replace rate_limiter_policy -i rate_limiter_policy.yaml

where file ratelimiterpolicy.yaml has following contents (ratelimiterpolicy.ReplaceRequest):

metadata:
  name: rate-limiter-policy-1
  namespace: documentation
spec:
  rules:
  - metadata:
      description: description-3
      name: rule-3
    spec:
      applyRateLimiter: {}
      path:
        exactValues:
        - /register
        - /guest-play
  - metadata:
      description: description-4
      name: rule-4
    spec:
      applyRateLimiter: {}
      headers:
      - item:
          exactValues:
          - en-UK
        name: Accept-Language
      - item:
          exactValues:
          - deflate
        name: Accept-Encoding
      path:
        exactValues:
        - /register-v2
        - /guest-play-v2
  serverSelector:
    expressions:
    - geoip.ves.io/region in (US-West), deployment in (testing)

vesctl yaml response: None

Request using curl:

curl -X 'PUT' -d '{"metadata":{"name":"rate-limiter-policy-1","namespace":"documentation"},"spec":{"serverSelector":{"expressions":["geoip.ves.io/region in (US-West), deployment in (testing)"]},"rules":[{"metadata":{"name":"rule-3","description":"description-3"},"spec":{"applyRateLimiter":{},"path":{"exactValues":["/register","/guest-play"]}}},{"metadata":{"name":"rule-4","description":"description-4"},"spec":{"applyRateLimiter":{},"path":{"exactValues":["/register-v2","/guest-play-v2"]},"headers":[{"name":"Accept-Language","item":{"exactValues":["en-UK"]}},{"name":"Accept-Encoding","item":{"exactValues":["deflate"]}}]}}]}}' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build970361017_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/rate_limiter_policys/rate-limiter-policy-1'

curl response:

HTTP/1.1 200 OK
Content-Length: 4
Content-Type: application/json
Date: Wed, 25 Aug 2021 09:04:29 GMT
Vary: Accept-Encoding

{

}