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

Examples of replacing rate_limiter_policy

Usecase:

Replace rate-limiter-policy-1

Request using vesctl:

vesctl configuration replace rate_limiter_policy -i rate_limiter_policy.yaml

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

RequestJSON:

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

vesctl yaml response: None

Request using curl:

curl -X 'PUT' -d '{"metadata":{"name":"rate-limiter-policy-1","namespace":"documentation"},"spec":{"server_selector":{"expressions":["geoip.ves.io/region in (US-West), deployment in (testing)"]},"rules":[{"metadata":{"name":"rule-3","description":"description-3"},"spec":{"apply_rate_limiter":{},"path":{"exact_values":["/register","/guest-play"]}}},{"metadata":{"name":"rule-4","description":"description-4"},"spec":{"apply_rate_limiter":{},"path":{"exact_values":["/register-v2","/guest-play-v2"]},"headers":[{"name":"Accept-Language","item":{"exact_values":["en-UK"]}},{"name":"Accept-Encoding","item":{"exact_values":["deflate"]}}]}}]}}' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build243329498_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: Fri, 23 Sep 2022 13:17:38 GMT
Vary: Accept-Encoding

{

}