Last active
October 6, 2022 18:13
-
-
Save Guaris/4d5f36f0a74dbfa12a2f713e7b7d1a9a to your computer and use it in GitHub Desktop.
entities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"$id": "/entities/", | |
"title": "entities", | |
"description": "a schema representation of lua entitiy schemas for kong/kong", | |
"type": "object", | |
"properties": { | |
"routes": { | |
"type": "object", | |
"name": { | |
"type": "string", | |
"maxLength": 128, | |
"pattern": "^[0-9a-zA-Z.\\-_~]*$" | |
}, | |
"primary_key": { | |
"$ref": "/definitions/primary_key" | |
}, | |
"endpoint_key": { | |
"$ref": "/defintions/endpoint_key" | |
}, | |
"workspaceable": { | |
"$ref": "/typedefs/defs/workspaceable" | |
}, | |
"subschema_key": {}, | |
"fields": { | |
"id": { | |
"$refs": "#/definitions/workspaceID" | |
}, | |
"created_at": { | |
"$refs": "#/defintions/timestamp" | |
}, | |
"updated_at": { | |
"$refs": "#/defintions/timestamp" | |
}, | |
"name": { | |
"type": "string", | |
"description": "A utf-8 name" | |
}, | |
"protocols": { | |
"$refs": "/typedefs/defs/http_protocol" | |
}, | |
"methods": { | |
"$refs": "/typedefs/defs/http_method" | |
}, | |
"paths": { | |
"$refs": "#/defintions/paths" | |
}, | |
"headers": { | |
"$refs": "/typdefs/defs/headers" | |
}, | |
"https_redirect_status_code": { | |
"$refs": "/typdefs/defs/https_redirect_status_code" | |
}, | |
"regex_priority": { | |
"$refs": "#/definition/regex_priority" | |
}, | |
"strip_path": { | |
"$refs": "#/definition/strip_path" | |
}, | |
"path_handling": { | |
"$refs": "#/definition/path_handling" | |
}, | |
"preserve_host": { | |
"$refs": "#/definition/preserve_host" | |
}, | |
"response_buffering": { | |
"$refs": "#/definition/response_buffering" | |
}, | |
"request_buffering": { | |
"$refs": "#/definition/request_buffering" | |
}, | |
"snis": { | |
"$refs": "/defs/snis" | |
}, | |
"sources": { | |
"$refs": "/typedefs/defs/host" | |
}, | |
"destinations": { | |
"$refs": "/typedefs/destinations" | |
}, | |
"tags": { | |
"$ref": "/typedefs/defs/tags" | |
}, | |
"service": { | |
"$ref": "/typedefs/service" | |
} | |
}, | |
"required": [ | |
"name", | |
"primary_key", | |
"endpoint_key", | |
"workspaceable", | |
"schema_key", | |
"https_redirect_status_code", | |
"regex_priority", | |
"preserve_host", | |
"request_buffering" | |
] | |
}, | |
"services": { | |
"type": "object", | |
"name": { | |
"type": "string", | |
"definition": "The name of the service", | |
"examples": "services" | |
}, | |
"primary_key": { | |
"$ref": "/definitions/primary_key" | |
}, | |
"endpoint_key": { | |
"$ref": "/defintions/endpoint_key" | |
}, | |
"fields": { | |
"id": { | |
"$refs": "#/definitions/workspaceID" | |
}, | |
"created_at": { | |
"$refs": "#/defintions/timestamp" | |
}, | |
"updated_at": { | |
"$refs": "#/defintions/timestamp" | |
}, | |
"name": { | |
"type": "string", | |
"description": "A utf-8 name" | |
}, | |
"retries": { | |
"$refs": "#definitions/retries" | |
}, | |
"protocol": { | |
"$refs": "/typedefs/defs/http_protocol" | |
}, | |
"host": { | |
"$refs": "/typedefs/defs/host" | |
}, | |
"port": { | |
"$refs": "#/defintions/port" | |
}, | |
"path": { | |
"$refs": "#/defintions/paths" | |
}, | |
"connect_timeout": { | |
"$refs": "/typedefs/defs/nonzero_timeout" | |
}, | |
"write_timeout": { | |
"$refs": "/typedefs/defs/nonzero_timeout" | |
}, | |
"read_timeout": { | |
"$refs": "/typedefs/defs/nonzero_timeout" | |
}, | |
"tags": { | |
"$ref": "/typedefs/defs/tags" | |
}, | |
"client_certificate": { | |
"$ref": "/entities/certificates" | |
}, | |
"tls_verify": { | |
"$ref": "/typedefs/defs/tls_verify" | |
}, | |
"tls_verify_depth": { | |
"$ref": "/typedefs/defs/tls_verify_depth" | |
}, | |
"ca_certificates": { | |
"$ref": "/typedefs/defs/ca_certificates" | |
}, | |
"enabled": { | |
"$ref": "#/definition/enabled" | |
} | |
}, | |
"required": [ | |
"protocol", | |
"host" | |
] | |
}, | |
"certificates": { | |
"type": "object", | |
"name": { | |
"type": "string", | |
"const": "certificate" | |
}, | |
"primary_key": { | |
"$ref": "/definitions/primary_key" | |
}, | |
"workspaceable": { | |
"$ref": "/typedefs/defs/workspaceable" | |
}, | |
"fields": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"$refs": "#/definitions/workspaceID" | |
}, | |
"created_at": { | |
"$refs": "#/defintions/timestamp" | |
}, | |
"cert": { | |
"$refs": "/typedefs/#/defintions/cert" | |
}, | |
"key:": { | |
"$refs": "#/defintions/key" | |
}, | |
"cert_alt": { | |
"$refs": "#/defintions/cert" | |
}, | |
"key_alt": { | |
"$refs": "#/defintions/key" | |
}, | |
"tags": { | |
"$ref": "/typedefs/defs/tags" | |
} | |
}, | |
"required": [ | |
"cert", | |
"key" | |
] | |
}, | |
"tags": { | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"primary_key": { | |
"$ref": "/definitions/primary_key" | |
}, | |
"endpoint_key": { | |
"$ref": "/defintions/endpoint_key" | |
}, | |
"dao": { | |
"type": "object" | |
}, | |
"db_export": { | |
"type": "boolean" | |
}, | |
"fields": { | |
"type": "object", | |
"properties": { | |
"tag": { | |
"$ref": "/typedefs/tag" | |
}, | |
"entity_name": { | |
"$ref": "/definitions/entity_name" | |
}, | |
"entity_id": { | |
"$ref": "/definitions/entity_id" | |
} | |
} | |
} | |
}, | |
"snis": { | |
"type": "object", | |
"properties": { | |
"name": { | |
"maxLength": 256, | |
"pattern": "^(\\*\\.)?[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?(.[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?)*$", | |
"type": "string", | |
"description": "must be a valid hostname with a wildcard prefix '*' or without" | |
}, | |
"primary_key": { | |
"$ref": "/definitions/primary_key" | |
}, | |
"endpoint_key": { | |
"$ref": "/defintions/endpoint_key" | |
}, | |
"fields": { | |
"id": { | |
"$refs": "#/definitions/workspaceID" | |
}, | |
"created_at": { | |
"$refs": "#/defintions/timestamp" | |
}, | |
"updated_at": { | |
"$refs": "#/defintions/timestamp" | |
}, | |
"tags": { | |
"$ref": "/typedefs/defs/tags" | |
}, | |
"certificate": { | |
"$ref": "/typedefs/defs/Certificate" | |
} | |
}, | |
"required": [ | |
"id", | |
"name", | |
"certificate" | |
] | |
}, | |
"$defs": { | |
"$id": "/typedefs", | |
"description": "Custom Typedefs", | |
"http_method": { | |
"$id": "/typedefs/defs/http_method", | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"description": "Enum of available http methods returned as strings", | |
"type": "object", | |
"properties": { | |
"protocol": { | |
"$ref": "#/definitions/http_method" | |
} | |
} | |
}, | |
"http_protocol": { | |
"$id": "/typedefs/http_protocol", | |
"description": "Enum of available http protocols returned as strings", | |
"type": "object", | |
"properties": { | |
"protocol": { | |
"$ref": "#/definitions/http_protocol" | |
} | |
} | |
}, | |
"host": { | |
"$id": "/typedefs/host", | |
"description": "A string representation of either IPV4, IPV6, or Hostname", | |
"type": "object", | |
"oneOf": [ | |
{ | |
"required": { | |
"$ref": "#/definition/ipv4" | |
} | |
}, | |
{ | |
"required": { | |
"$ref": "#/definition/ipv6" | |
} | |
}, | |
{ | |
"required": { | |
"$ref": "#/definition/hostname" | |
} | |
} | |
] | |
}, | |
"destinations": { | |
"maxItems": 16, | |
"type": "array", | |
"items": { | |
"properties": { | |
"ip": { | |
"description": "at least one of 'ip' or 'port' is required", | |
"type": "string", | |
"anyOf": [ | |
{ | |
"pattern": "^([0-9]{1,3}[.]{1}){3}[0-9]{1,3}$", | |
"description": "must be a valid IP or CIDR" | |
}, | |
{ | |
"pattern": "^([0-9]{1,3}[.]{1}){3}[0-9]{1,3}/[0-9]{1,3}$", | |
"description": "must be a valid IP or CIDR" | |
} | |
], | |
"port": { | |
"$ref": "#/definition/port" | |
} | |
}, | |
"type": "object", | |
"description": "at least one of 'ip' or 'port' is required", | |
"anyOf": [ | |
{ | |
"required": [ | |
"ip" | |
] | |
}, | |
{ | |
"required": [ | |
"port" | |
] | |
} | |
] | |
} | |
}, | |
"host_with_optional_port": { | |
"$id": "/typedefs/hosts_with_optional_port", | |
"description": "Enum of available http methods returned as strings", | |
"type": "object", | |
"properties": { | |
"allOf": { | |
"host": { | |
"$ref": "/typedefs/host" | |
}, | |
"additionalProperties": { | |
"$ref": "#/definition/port" | |
} | |
}, | |
"nonzero_timeout": { | |
"type": "integer", | |
"description": " An non-zero integer between (1, math.pow(2, 31) - 2) ", | |
"minimum": 1, | |
"exclusiveMaximum": 2147483646, | |
"const": 60000 | |
}, | |
"workspaceable": { | |
"$id": "/typedefs/workspaceable", | |
"description": " Boolean value that determines if a workspace is usuable", | |
"type": "object", | |
"properties": { | |
"if": { | |
"workspace": { | |
"$ref": "#/definitions/workspaceID" | |
} | |
}, | |
"then": { | |
"type": "boolean" | |
} | |
} | |
} | |
}, | |
"Certificate": { | |
"properties": { | |
"cert": { | |
"type": "string" | |
}, | |
"cert_alt": { | |
"type": "string" | |
}, | |
"created_at": { | |
"type": "integer" | |
}, | |
"id": { | |
"type": "string" | |
}, | |
"key": { | |
"type": "string" | |
}, | |
"key_alt": { | |
"type": "string" | |
}, | |
"snis": { | |
"items": { | |
"type": "string" | |
}, | |
"type": "array" | |
}, | |
"tags": { | |
"items": { | |
"type": "string" | |
}, | |
"type": "array" | |
} | |
}, | |
"additionalProperties": false, | |
"type": "object" | |
}, | |
"sources": { | |
"type": "object" | |
}, | |
"service": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", | |
"type": "string", | |
"description": "must be a valid UUID" | |
} | |
}, | |
"additionalProperties": false, | |
"required": [ | |
"id" | |
] | |
}, | |
"tags": { | |
"maxLength": 8, | |
"items": { | |
"maxLength": 128, | |
"minLength": 1, | |
"pattern": "^[0-9a-zA-Z.-_~]*$", | |
"type": "string" | |
}, | |
"type": "array" | |
} | |
}, | |
"definitions": { | |
"description": "Simple objects that build custom typedefs", | |
"http_protocol": { | |
"enum": [ | |
"http", | |
"https", | |
"tcp", | |
"tls", | |
"udp", | |
"tls_passthrough", | |
"grpc", | |
"grpcs" | |
], | |
"const": "http" | |
}, | |
"http_method": { | |
"description": "An enum of the different HTTP methods", | |
"enum": [ | |
"GET", | |
"HEAD", | |
"POST", | |
"PUT", | |
"DELETE", | |
"CONNECT", | |
"TRACE", | |
"PATCH" | |
] | |
}, | |
"ipv4": { | |
"type": "string", | |
"format": "ipv4" | |
}, | |
"ipv6": { | |
"type": "string", | |
"format": "ipv6" | |
}, | |
"ip": { | |
"type": "object", | |
"oneOf": [ | |
{ | |
"required": { | |
"$ref": "ipv4" | |
} | |
}, | |
{ | |
"required": { | |
"$ref": "ipv6" | |
} | |
}, | |
{ | |
"required": { | |
"$ref": "port" | |
} | |
} | |
] | |
}, | |
"hostname": { | |
"type": "string", | |
"format": "hostname" | |
}, | |
"port": { | |
"description": "Port", | |
"type": "integer", | |
"maximum": 65535, | |
"minimum": 1 | |
}, | |
"routeName": { | |
"description": "The name of the route", | |
"type": "string" | |
}, | |
"workspaceID": { | |
"description": "The Workspace ID", | |
"type": "string", | |
"const": "c543d2c8-d297-4c9c-adf5-cd64212868fd", | |
"format": "uuid" | |
}, | |
"subschemaName": { | |
"description": "A list of possible subschema names", | |
"enum": [ | |
"http", | |
"tcp", | |
"grpc" | |
] | |
}, | |
"timestamp": { | |
"type": "string", | |
"description": "A timestamp", | |
"format": "date-time" | |
}, | |
"paths": { | |
"items": { | |
"type": "string", | |
"allOf": [ | |
{ | |
"pattern": "^/.*|^~/.*", | |
"description": "must begin with `/` (prefix path) or `~/` (regex path)" | |
}, | |
{ | |
"maxLength": 1024, | |
"description": "length must not exceed 1024" | |
}, | |
{ | |
"not": { | |
"pattern": "//", | |
"description": "must not contain `//`" | |
} | |
} | |
] | |
}, | |
"maxItems": 16, | |
"type": "array" | |
}, | |
"https_redirect_status_code": { | |
"type": "integer", | |
"enum": [ | |
426, | |
301, | |
302, | |
307, | |
308 | |
], | |
"const": 426 | |
}, | |
"regex_priority": { | |
"type": "integer", | |
"definition": " It accepts any integer value. Routes are evaluated in order of highest priority to lowest.", | |
"exclusiveMinimum": -1 | |
}, | |
"strip_path": { | |
"type": "boolean", | |
"const": true | |
}, | |
"path_handling": { | |
"type": "string", | |
"enum": [ | |
"v0", | |
"v1" | |
] | |
}, | |
"preserve_host": { | |
"type": "boolean", | |
"const": true | |
}, | |
"response_buffering": { | |
"type": "boolean", | |
"const": true | |
}, | |
"request_buffering": { | |
"type": "boolean", | |
"const": true | |
}, | |
"cert": { | |
"type": "string", | |
"description": "openssl_x509 SSL certificate" | |
}, | |
"key": { | |
"type": "string", | |
"description": "openssl_pkey" | |
}, | |
"tls_verify": { | |
"type": "boolean" | |
}, | |
"tls_verify_depth": { | |
"type": "integer", | |
"const": null, | |
"minimum": 0, | |
"maximum": 64 | |
}, | |
"ca_certificates": { | |
"type": "array", | |
"items": { | |
"type": "string", | |
"format": "uuid" | |
} | |
}, | |
"enabled": { | |
"type": "boolean", | |
"const": true | |
}, | |
"headers": { | |
"type": "object", | |
"maxProperties": 16, | |
"patternProperties": { | |
"^[A-Za-z0-9!#$%&'*+-.^_|~]{1,64}$": { | |
"properties": { | |
"values": { | |
"items": { | |
"maxLength": 64, | |
"type": "string" | |
}, | |
"maxItems": 16, | |
"type": "array" | |
} | |
}, | |
"type": "object" | |
}, | |
"^[Hh][Oo][Ss][Tt]$": { | |
"not": { | |
"description": "must not contain 'host' header" | |
} | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"primary_key": { | |
"type": "string", | |
"description": "An object containing a list of consumer IDs", | |
"format": "uuid" | |
}, | |
"endpoint_key": { | |
"type": "string", | |
"description": "The consumer's username. For services, the endpoint_key corresponds to the name of the server", | |
"examples": { | |
"oneOf": { | |
"service_example": "my-service", | |
"consumer_example": "my_username" | |
} | |
} | |
}, | |
"retries": { | |
"type": "integer", | |
"const": 5, | |
"minimum": 0, | |
"maximum": 32767 | |
}, | |
"entity_name": { | |
"type": "string" | |
}, | |
"entity_id": { | |
"type": "string", | |
"format": "uuid" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment