policy

Create new Agent Policy

post/policies/agent

Request body

OR

Example request

{
  "name": "my-policy",
  "description": "A policy example",
  "tags": {
    "region": "eu",
    "node_type": "dns"
  },
  "version": 1,
  "backend": "pktvisor",
  "schema_version": "1.0",
  "policy": {
    "handlers": {
      "modules": {
        "default_dns": {
          "type": "dns"
        },
        "default_net": {
          "type": "net"
        }
      }
    },
    "input": {
      "input_type": "pcap",
      "tap": "default_pcap"
    },
    "kind": "collection"
  }
}

Response

Policy object

idstring uuid required

Unique identifier (UUID)

namestring

A unique name label

descriptionstring

User description of this Policy

tagsobject

User defined key/values for organization and searching

backendstring

The policy backend to use. Cannot change once created.

ts_createdstring date-time

Timestamp of creation

versioninteger

A monotonically increasing counter starting at 0 on creation and increasing with each policy update.

policyobject

Agent backend specific policy data in json format

formatstring

Policy text format needed to specify when a policy was created in yaml format.

policy_datastring

Agent backend specific policy data in yaml format

Example response

{
  "name": "my-policy",
  "description": "An example policy",
  "tags": {
    "region": "eu",
    "node_type": "dns"
  },
  "backend": "pktvisor",
  "policy": {
    "handlers": {
      "modules": {
        "default_dns": {
          "type": "dns"
        },
        "default_net": {
          "type": "net"
        }
      }
    },
    "input": {
      "input_type": "pcap",
      "tap": "default_pcap"
    },
    "kind": "collection"
  },
  "format": "yaml",
  "policy_data": "handlers:\n  modules:\n    default_dns:\n      type: dns\n    default_net:\n      type: net\ninput:\n  input_type: pcap\n  tap: default_pcap\nkind: collection"
}

Changes

Changed in 17 of the 25 revisions of this API.201542

    • added the new required header request parameter Authorization to all path's operations

      new-required-request-default-parameter-to-existing-path

    • added the new required header request parameter Bearer authorization to all path's operations

      new-required-request-default-parameter-to-existing-path

    • added the optional property format to the response with the 201 status

      response-optional-property-added

    • added the optional property policy_data to the response with the 201 status

      response-optional-property-added

    • added the new optional request property oneOf[PolicyCreateReqSchemaJson]/schema_version

      new-optional-request-property

    • added the new optional request property oneOf[PolicyCreateReqSchemaYaml]/schema_version

      new-optional-request-property

    • added the new optional request property oneOf[PolicyCreateReqSchemaJson]/policy/handlers

      new-optional-request-property

    • added the new optional request property oneOf[PolicyCreateReqSchemaJson]/policy/input

      new-optional-request-property

    • added the new optional request property oneOf[PolicyCreateReqSchemaJson]/policy/kind

      new-optional-request-property

    • added the new optional request property oneOf[PolicyCreateReqSchemaJson]/version

      new-optional-request-property

    • the request property oneOf[PolicyCreateReqSchemaJson]/description became optional

      request-property-became-optional

    • the request property oneOf[PolicyCreateReqSchemaYaml]/description became optional

      request-property-became-optional

    • the policy response's property type/format changed from string/ to object/ for status 201

      response-property-type-changed

  • 36e163b84ec9171See the full diff
    • the request's body type/format changed from object/ to /

      request-body-type-changed

    • removed the request property backend

      request-property-removed

    • removed the request property description

      request-property-removed

    • removed the request property format

      request-property-removed

    • removed the request property name

      request-property-removed

    • removed the request property policy

      request-property-removed

    • removed the request property policy_data

      request-property-removed

    • removed the request property tags

      request-property-removed

    • added PolicyCreateReqSchemaJson PolicyCreateReqSchemaYaml to the request body oneOf list

      request-body-one-of-added

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • e0d05716908c11See the full diff
    • the policy request property type/format changed from string/ to object/

      request-property-type-changed

    • the request property policy became optional

      request-property-became-optional

    • added the new optional request property format

      new-optional-request-property

    • added the new optional request property policy_data

      new-optional-request-property

    • the policy request property type/format changed from object/ to string/

      request-property-type-changed

    • the policy response's property type/format changed from object/ to string/ for status 201

      response-property-type-changed