ves-io-schema-network_policy-API-Replace

Examples of replacing network_policy

Usecase:

Replace network-policy-1

Request using vesctl:

vesctl configuration replace network_policy -i network_policy.yaml

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

metadata:
  name: network-policy-1
  namespace: documentation
spec:
  egressRules:
  - kind: network_policy_rule
    name: egress-rule-2
  ingressRules:
  - kind: network_policy_rule
    name: ingress-rule-2
  prefix:
    prefix:
    - 1.1.1.1/32

vesctl yaml response: None

Request using curl:

curl -X 'PUT' -d '{"metadata":{"name":"network-policy-1","namespace":"documentation"},"spec":{"prefix":{"prefix":["1.1.1.1/32"]},"ingressRules":[{"kind":"network_policy_rule","name":"ingress-rule-2"}],"egressRules":[{"kind":"network_policy_rule","name":"egress-rule-2"}]}}' -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/network_policys/network-policy-1'

curl response:

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

{

}