ves-io-schema-protocol_policer-API-Create

Examples of creating protocol_policer

Usecase:

Create protocol-policer-1 to rate limit all TCP SYN packets

Request using vesctl:

vesctl configuration create protocol_policer -i protocol_policer.yaml

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

metadata:
  name: protocol-policer-1
  namespace: system
spec:
  protocolPolicer:
  - policer:
    - kind: policer
      name: tcp-syn-limiter
    protocol:
      tcp:
        flags:
        - SYN

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: protocol-policer-1
  namespace: system
spec:
  protocolPolicer:
  - policer:
    - kind: policer
      name: tcp-syn-limiter
      namespace: system
      tenant: acmecorp
      uid: ffffffff-ffff-ffff-ffff-ffffffffffff
    protocol:
      tcp:
        flags:
        - SYN
systemMetadata:
  creationTimestamp: "2021-07-14T08:07:57.504500013Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: 8c3fe325-f92e-4638-b973-c8838d0d3a5f

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"protocol-policer-1","namespace":"system"},"spec":{"protocolPolicer":[{"protocol":{"tcp":{"flags":["SYN"]}},"policer":[{"kind":"policer","name":"tcp-syn-limiter"}]}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build381173587_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/protocol_policers'

curl response:

HTTP/1.1 200 OK
Content-Length: 1016
Content-Type: application/json
Date: Wed, 14 Jul 2021 08:07:57 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "protocol-policer-1",
    "namespace": "system",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "8c3fe325-f92e-4638-b973-c8838d0d3a5f",
    "creation_timestamp": "2021-07-14T08:07:57.504500013Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "protocol_policer": [
      {
        "protocol": {
          "tcp": {
            "flags": [
              "SYN"
            ]
          }
        },
        "policer": [
          {
            "kind": "policer",
            "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
            "tenant": "acmecorp",
            "namespace": "system",
            "name": "tcp-syn-limiter"
          }
        ]
      }
    ]
  }
}

Usecase:

Create protocol-policer-2 to rate limit all ICMP packets

Request using vesctl:

vesctl configuration create protocol_policer -i protocol_policer.yaml

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

metadata:
  name: protocol-policer-2
  namespace: system
spec:
  protocolPolicer:
  - policer:
    - kind: policer
      name: icmp-limiter
    protocol:
      icmp:
        type:
        - ALL_ICMP_MSG

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: protocol-policer-2
  namespace: system
spec:
  protocolPolicer:
  - policer:
    - kind: policer
      name: icmp-limiter
      namespace: system
      tenant: acmecorp
      uid: ffffffff-ffff-ffff-ffff-ffffffffffff
    protocol:
      icmp:
        type:
        - ALL_ICMP_MSG
systemMetadata:
  creationTimestamp: "2021-07-14T08:07:57.511459811Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: 2e6e5267-c797-403d-8485-69ed4e6193bc

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"protocol-policer-2","namespace":"system"},"spec":{"protocolPolicer":[{"protocol":{"icmp":{"type":["ALL_ICMP_MSG"]}},"policer":[{"kind":"policer","name":"icmp-limiter"}]}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build381173587_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/protocol_policers'

curl response:

HTTP/1.1 200 OK
Content-Length: 1022
Content-Type: application/json
Date: Wed, 14 Jul 2021 08:07:57 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "protocol-policer-2",
    "namespace": "system",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "2e6e5267-c797-403d-8485-69ed4e6193bc",
    "creation_timestamp": "2021-07-14T08:07:57.511459811Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "protocol_policer": [
      {
        "protocol": {
          "icmp": {
            "type": [
              "ALL_ICMP_MSG"
            ]
          }
        },
        "policer": [
          {
            "kind": "policer",
            "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
            "tenant": "acmecorp",
            "namespace": "system",
            "name": "icmp-limiter"
          }
        ]
      }
    ]
  }
}