Event Gateway Virtual Cluster Policies

Create Cluster Policy for Virtual Cluster

Changed on

Creates a new cluster-level policy associated with the specified Event Gateway virtual cluster.

post/v1/event-gateways/{gatewayId}/virtual-clusters/{virtualClusterId}/cluster-policies#RequestRuleValidator

Request

  • Base URL
    https://global.api.konghq.com
  • Auth
    • HTTP bearer
    • or HTTP bearer
    • or HTTP bearer
    • or HTTP bearer

Path parameters

gatewayId, string uuid required
Example:9524ec7d-36d9-465d-a8c5-83a3c9390458

The UUID of your Gateway.

virtualClusterId, string uuid required

The ID of the Virtual Cluster.

Query parameters

before, string uuid

Determines the id of the existing policy the new policy should be inserted before. Either 'before' or 'after' can be provided, when both are omitted the new policy is added to the end of the chain. When both are provided, the request fails with a 400 Bad Request.

after, string uuid

Determines the id of the existing policy the new policy should be inserted after. Either 'before' or 'after' can be provided, when both are omitted the new policy is added to the end of the chain. When both are provided, the request fails with a 400 Bad Request.

Request body

EventGatewayRequestRuleValidatorPolicy required

Validates the content of Kafka requests against a list of rules.

Use this policy to enforce conventions that Kafka ACLs cannot express, because ACLs cannot read the content of a request. For example, a maximum number of partitions, a topic naming convention, or a minimum number of acknowledgements on produce.

Each rule describes the valid state of the request. The action of the rule runs when the rule evaluates to false.

Requires a minimum runtime version of 1.3.

type, 'request_rule_validator' required

The type name of the policy.

name, string

A unique user-defined name of the policy.

description, string

A human-readable description of the policy.

enabled, boolean

Whether the policy is enabled.

labels, Labels

Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types.

Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".

config, EventGatewayRequestRuleValidatorConfig required

The configuration of the policy.

condition, string

A string containing the boolean expression that determines whether the policy is applied.

Example request

{
  "labels": {
    "env": "test"
  },
  "config": {
    "requests": [
      {
        "type": "create_topics",
        "rules": [
          {
            "description": "Enforce the topic naming convention and a partition limit.",
            "rule": "context.topic.name.startsWith('team-a.') && context.topic.num_partitions <= 50",
            "action": "reject"
          }
        ]
      }
    ]
  },
  "condition": "context.auth.principal.name == \"this-user\""
}

Response

Created

EventGatewayPolicy required

A policy associated with an Event Gateway.

type, string required

The type name of the policy.

name, string

A unique user-defined name of the policy.

description, string

A human-readable description of the policy.

enabled, boolean

Whether the policy is enabled.

labels, Labels

Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types.

Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".

id, string uuid required

The unique identifier of the policy.

config, object nullable

The configuration of the policy.

created_at, string date-time required

An ISO-8601 timestamp representation of entity creation date.

parent_policy_id, string uuid nullable

The unique identifier of the parent policy, if any.

updated_at, string date-time required

An ISO-8601 timestamp representation of entity update date.

condition, string

A string containing the boolean expression that determines whether the policy is applied.

Example response

{
  "labels": {
    "env": "test"
  },
  "created_at": "2022-11-04T20:10:06.927Z",
  "updated_at": "2022-11-04T20:10:06.927Z"
}

Changes