ves-io-schema-waf_rules-API-Create

Examples of creating waf_rules

Usecase:

Create waf-rules-1

Request using vesctl:

vesctl configuration create waf_rules -i waf_rules.yaml

where file wafrules.yaml has following contents (wafrules.CreateRequest):

metadata:
  name: waf-rules-1
  namespace: documentation
spec:
  anomalyScoreThreshold: 5
  paranoiaLevel: 2
  ruleIds:
  - WAF_RULE_941100
  - WAF_RULE_941101

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: waf-rules-1
  namespace: documentation
spec:
  anomalyScoreThreshold: 5
  paranoiaLevel: 2
  ruleIds:
  - WAF_RULE_941100
  - WAF_RULE_941101
systemMetadata:
  creationTimestamp: "2020-07-02T15:53:45.506821900Z"
  creatorClass: examplesvc.ves.io
  finalizers: []
  tenant: acmecorp
  uid: fbdb2b2f-4f1f-4837-a853-8830a24c71f1

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"waf-rules-1","namespace":"documentation"},"spec":{"anomalyScoreThreshold":5,"paranoiaLevel":2,"ruleIds":["WAF_RULE_941100","WAF_RULE_941101"]}}' -H 'Content-Type: application/json' -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/waf_ruless'

curl response:

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

{
  "metadata": {
    "name": "waf-rules-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "fbdb2b2f-4f1f-4837-a853-8830a24c71f1",
    "creation_timestamp": "2020-07-02T15:53:45.506821900Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc.ves.io",
    "creator_id": "",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "mode": "BLOCK",
    "anomaly_score_threshold": 5,
    "paranoia_level": 2,
    "rule_ids": [
      "WAF_RULE_941100",
      "WAF_RULE_941101"
    ],
    "rule_list_type": "EXCLUDE"
  }
}