ves-io-schema-malicious_user_mitigation-API-Create

Examples of creating malicioususermitigation

Usecase:

Create malicioususermitigation in namespace documentation that uses apptype bookinfo. There can only be one malicioususer_mitigation in a namespace.

Request using vesctl:

vesctl configuration create malicious_user_mitigation -i malicious_user_mitigation.yaml

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

metadata:
  name: malicious-user-mitigation
  namespace: documentation
spec:
  javascriptChallengeSettings:
    cookieExpiry: 10
    jsScriptDelay: 3000
  mitigationType:
    rules:
    - mitigationAction:
        javascriptChallenge: null
      threatLevel:
        low: null

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: malicious-user-mitigation
  namespace: documentation
spec:
  javascriptChallengeSettings:
    cookieExpiry: 10
    jsScriptDelay: 3000
  mitigationType:
    rules:
    - mitigationAction: {}
      threatLevel: {}
systemMetadata:
  creationTimestamp: "2020-10-19T09:48:41.248877700Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: f0a47db4-8160-469e-8892-e2351bcfcc87

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"malicious-user-mitigation","namespace":"documentation"},"spec":{"mitigationType":{"rules":[{"threatLevel":{"low":null},"mitigationAction":{"javascriptChallenge":null}}]},"javascriptChallengeSettings":{"jsScriptDelay":3000,"cookieExpiry":10}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build185306297_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/malicious_user_mitigations'

curl response:

HTTP/1.1 200 OK
Content-Length: 982
Content-Type: application/json
Date: Mon, 19 Oct 2020 09:48:41 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "malicious-user-mitigation",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "f0a47db4-8160-469e-8892-e2351bcfcc87",
    "creation_timestamp": "2020-10-19T09:48:41.248877700Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "mitigation_type": {
      "rules": [
        {
          "threat_level": {

          },
          "mitigation_action": {

          }
        }
      ]
    },
    "javascript_challenge_settings": {
      "js_script_delay": 3000,
      "cookie_expiry": 10,
      "custom_page": ""
    },
    "captcha_challenge_settings": null,
    "temporary_blocking_settings": null
  }
}