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: "2021-08-25T09:04:47.498476937Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: 4e86b89b-37c0-4129-acf1-2a5540fdffe9

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-build970361017_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: 781
Content-Type: application/json
Date: Wed, 25 Aug 2021 09:04:47 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "waf-rules-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "4e86b89b-37c0-4129-acf1-2a5540fdffe9",
    "creation_timestamp": "2021-08-25T09:04:47.498476937Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "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"
  }
}