ves-io-schema-service_policy-API-Replace

Examples of replacing service_policy

Usecase:

Replace service-policy-1

Request using vesctl:

vesctl configuration replace service_policy -i service_policy.yaml

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

metadata:
  name: service-policy-1
  namespace: documentation
spec:
  legacyRuleList:
    rules:
    - kind: service_policy_rule
      name: service-policy-rule-1
    - kind: service_policy_rule
      name: service-policy-rule-2
  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":"service-policy-1","namespace":"documentation"},"spec":{"serverSelector":{"expressions":["geoip.ves.io/region in (US-West), deployment in (testing)"]},"legacyRuleList":{"rules":[{"kind":"service_policy_rule","name":"service-policy-rule-1"},{"kind":"service_policy_rule","name":"service-policy-rule-2"}]}}}' -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/service_policys/service-policy-1'

curl response:

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

{

}