ves-io-schema-service_policy_rule-API-Replace

Examples of replacing servicepolicyrule

Usecase:

Replace service-policy-rule-1

Request using vesctl:

vesctl configuration replace service_policy_rule -i service_policy_rule.yaml

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

metadata:
  name: service-policy-rule-1
  namespace: documentation
spec:
  action: ALLOW
  clientNameMatcher:
    regexValues:
    - .+\.ves.io
  clientRole:
    match: app-user
  clientSelector:
    expressions:
    - geoip.ves.io/region in (US-West, US-East), geoip.ves.io.city, geoip.ves.io.city
      notin (ves-io-sjc, ves-io-ny)
  domainMatcher: {}
  headers:
  - item:
      exactValues:
      - en-US
    name: Accept-Language
  - item:
      exactValues:
      - gzip
      - deflate
    name: Accept-Encoding
  labelMatcher:
    keys:
    - ves.io/appType
    - geoip.ves.io/region
  path:
    exactValues:
    - pokemongo.tenant.ves.io/register
    - pokemongo.tenant.ves.io/guest-play
  virtualHostMatcher: {}

vesctl yaml response: None

Request using curl:

curl -X 'PUT' -d '{"metadata":{"name":"service-policy-rule-1","namespace":"documentation"},"spec":{"action":"ALLOW","clientSelector":{"expressions":["geoip.ves.io/region in (US-West, US-East), geoip.ves.io.city, geoip.ves.io.city notin (ves-io-sjc, ves-io-ny)"]},"clientRole":{"match":"app-user"},"clientNameMatcher":{"regexValues":[".+\.ves.io"]},"labelMatcher":{"keys":["ves.io/appType","geoip.ves.io/region"]},"path":{"exactValues":["pokemongo.tenant.ves.io/register","pokemongo.tenant.ves.io/guest-play"]},"headers":[{"name":"Accept-Language","item":{"exactValues":["en-US"]}},{"name":"Accept-Encoding","item":{"exactValues":["gzip","deflate"]}}],"domainMatcher":{},"virtualHostMatcher":{}}}' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build743694289_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/service_policy_rules/service-policy-rule-1'

curl response:

HTTP/1.1 200 OK
Content-Length: 4
Content-Type: application/json
Date: Thu, 02 Jul 2020 15:53:31 GMT
Vary: Accept-Encoding

{

}