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
anyAsn: {}
anyIp: {}
clientNameMatcher:
regexValues:
- .+\.ves.io
clientRole:
match: app-user
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
wafAction:
none: {}
vesctl yaml response: None
Request using curl:
curl -X 'PUT' -d '{"metadata":{"name":"service-policy-rule-1","namespace":"documentation"},"spec":{"action":"ALLOW","clientNameMatcher":{"regexValues":[".+\.ves.io"]},"clientRole":{"match":"app-user"},"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"]}}],"anyIp":{},"anyAsn":{},"wafAction":{"none":{}}}}' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build318584715_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: Wed, 31 Mar 2021 08:29:57 GMT
Vary: Accept-Encoding
{
}
Usecase:
Replace service-policy-rule-2
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-2
namespace: documentation
spec:
action: ALLOW
anyAsn: {}
anyIp: {}
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)
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
wafAction:
none: {}
vesctl yaml response: None
Request using curl:
curl -X 'PUT' -d '{"metadata":{"name":"service-policy-rule-2","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"},"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"]}}],"anyIp":{},"anyAsn":{},"wafAction":{"none":{}}}}' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build318584715_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/service_policy_rules/service-policy-rule-2'
curl response:
HTTP/1.1 200 OK
Content-Length: 4
Content-Type: application/json
Date: Wed, 31 Mar 2021 08:29:57 GMT
Vary: Accept-Encoding
{
}