diff --git a/api/conf/schema.json b/api/conf/schema.json index e0a7cbe05b..a684d3c1c2 100644 --- a/api/conf/schema.json +++ b/api/conf/schema.json @@ -1,3325 +1,3499 @@ { - "main": { - "host_def": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "service": { - "properties": { - "update_time": { - "type": "integer" - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "upstream_id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "script": { - "maxLength": 102400, - "type": "string", - "minLength": 10 - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "create_time": { - "type": "integer" - }, - "name": { - "type": "string", - "maxLength": 50 - }, - "plugins": { - "type": "object" - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "upstream": { - "properties": { - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" - }, - "timeout": { - "properties": { - "send": { - "type": "number", - "minimum": 0 - }, - "connect": { - "type": "number", - "minimum": 0 - }, - "read": { - "type": "number", - "minimum": 0 - } - }, - "type": "object", - "required": ["connect", "send", "read"] - }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "create_time": { - "type": "integer" - }, - "update_time": { - "type": "integer" - }, - "nodes": { - "anyOf": [{ - "patternProperties": { - ".*": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - } - }, - "type": "object", - "minProperties": 1 - }, { - "items": { - "properties": { - "metadata": { - "type": "object", - "description": "metadata of node" - }, - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - }, - "port": { - "description": "port of node", - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["host", "port", "weight"] - }, - "type": "array", - "minItems": 1 - }] - }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] - }, - "k8s_deployment_info": { - "properties": { - "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "deploy_name": { - "type": "string", - "description": "k8s deployment name" - }, - "port": { - "type": "number", - "minimum": 0 - }, - "backend_type": { - "default": "pod", - "description": "k8s service name", - "type": "string", - "enum": ["svc", "pod"] - }, - "service_name": { - "type": "string", - "description": "k8s service name" - } - }, - "type": "object", - "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] - }, { - "required": ["namespace", "service_name", "port"] - }] - }, - "hash_on": { - "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] - }, - "retries": { - "type": "integer", - "minimum": 0 - }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "checks": { - "properties": { - "active": { - "type": "object", - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "http_path": { - "type": "string", - "default": "/" - }, - "https_verify_certificate": { - "type": "boolean", - "default": true - }, - "concurrency": { - "type": "integer", - "default": 10 - }, - "timeout": { - "type": "number", - "default": 1 - }, - "req_headers": { - "items": { - "type": "string", - "uniqueItems": true - }, - "type": "array", - "minItems": 1 - }, - "unhealthy": { - "type": "object", - "properties": { - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 3, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "port": { - "minimum": 1, - "type": "integer", - "maximum": 65535 - }, - "healthy": { - "type": "object", - "properties": { - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [200, 302], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "successes": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - } - } - }, - "passive": { - "type": "object", - "properties": { - "unhealthy": { - "type": "object", - "properties": { - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [429, 500, 503], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 7, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "healthy": { - "type": "object", - "properties": { - "successes": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - } - } - } - } - } - }, - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }], - "type": "object", - "additionalProperties": false - }, - "name": { - "type": "string", - "maxLength": 50 - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "service_name": { - "type": "string", - "maxLength": 50 - } - }, - "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] - }, { - "required": ["type", "service_name"] - }], - "type": "object", - "additionalProperties": false - } - }, - "type": "object", - "additionalProperties": false - }, - "id_schema": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "upstream_hash_vars_schema": { - "type": "string", - "pattern": "^((uri|server_name|server_addr|request_uri|remote_port|remote_addr|query_string|host|hostname)|arg_[0-9a-zA-z_-]+)$" - }, - "version": 0.5, - "plugin_disable_schema": { - "disable": { - "type": "boolean" - } - }, - "stream_route": { - "type": "object", - "properties": { - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "server_addr": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string", - "title": "IPv4" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "type": "string", - "title": "IPv4/CIDR" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "type": "string", - "title": "IPv6" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", - "type": "string", - "title": "IPv6/CIDR" - }], - "description": "server IP", - "type": "string" - }, - "server_port": { - "type": "integer", - "description": "server port" - }, - "upstream_id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "plugins": { - "type": "object" - }, - "remote_addr": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string", - "title": "IPv4" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "type": "string", - "title": "IPv4/CIDR" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "type": "string", - "title": "IPv6" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", - "type": "string", - "title": "IPv6/CIDR" - }], - "description": "client IP", - "type": "string" - }, - "upstream": { - "properties": { - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" - }, - "timeout": { - "properties": { - "send": { - "type": "number", - "minimum": 0 - }, - "connect": { - "type": "number", - "minimum": 0 - }, - "read": { - "type": "number", - "minimum": 0 - } - }, - "type": "object", - "required": ["connect", "send", "read"] - }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "create_time": { - "type": "integer" - }, - "update_time": { - "type": "integer" - }, - "nodes": { - "anyOf": [{ - "patternProperties": { - ".*": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - } - }, - "type": "object", - "minProperties": 1 - }, { - "items": { - "properties": { - "metadata": { - "type": "object", - "description": "metadata of node" - }, - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - }, - "port": { - "description": "port of node", - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["host", "port", "weight"] - }, - "type": "array", - "minItems": 1 - }] - }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] - }, - "k8s_deployment_info": { - "properties": { - "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "deploy_name": { - "type": "string", - "description": "k8s deployment name" - }, - "port": { - "type": "number", - "minimum": 0 - }, - "backend_type": { - "default": "pod", - "description": "k8s service name", - "type": "string", - "enum": ["svc", "pod"] - }, - "service_name": { - "type": "string", - "description": "k8s service name" - } - }, - "type": "object", - "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] - }, { - "required": ["namespace", "service_name", "port"] - }] - }, - "hash_on": { - "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] - }, - "retries": { - "type": "integer", - "minimum": 0 - }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "checks": { - "properties": { - "active": { - "type": "object", - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "http_path": { - "type": "string", - "default": "/" - }, - "https_verify_certificate": { - "type": "boolean", - "default": true - }, - "concurrency": { - "type": "integer", - "default": 10 - }, - "timeout": { - "type": "number", - "default": 1 - }, - "req_headers": { - "items": { - "type": "string", - "uniqueItems": true - }, - "type": "array", - "minItems": 1 - }, - "unhealthy": { - "type": "object", - "properties": { - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 3, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "port": { - "minimum": 1, - "type": "integer", - "maximum": 65535 - }, - "healthy": { - "type": "object", - "properties": { - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [200, 302], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "successes": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - } - } - }, - "passive": { - "type": "object", - "properties": { - "unhealthy": { - "type": "object", - "properties": { - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [429, 500, 503], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 7, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "healthy": { - "type": "object", - "properties": { - "successes": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - } - } - } - } - } - }, - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }], - "type": "object", - "additionalProperties": false - }, - "name": { - "type": "string", - "maxLength": 50 - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "service_name": { - "type": "string", - "maxLength": 50 - } - }, - "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] - }, { - "required": ["type", "service_name"] - }], - "type": "object", - "additionalProperties": false - } - } - }, - "ip_def": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string", - "title": "IPv4" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "type": "string", - "title": "IPv4/CIDR" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "type": "string", - "title": "IPv6" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", - "type": "string", - "title": "IPv6/CIDR" - }], - "proto": { - "properties": { - "content": { - "maxLength": 1048576, - "type": "string", - "minLength": 1 - } - }, - "additionalProperties": false, - "type": "object", - "required": ["content"] - }, - "ssl": { - "properties": { - "update_time": { - "type": "integer" - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "certs": { - "type": "array", - "items": { - "maxLength": 65536, - "type": "string", - "minLength": 128 - } - }, - "snis": { - "type": "array", - "items": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - } - }, - "exptime": { - "type": "integer", - "minimum": 1588262400 - }, - "keys": { - "type": "array", - "items": { - "maxLength": 65536, - "type": "string", - "minLength": 128 - } - }, - "validity_end": { - "type": "integer" - }, - "key": { - "maxLength": 65536, - "type": "string", - "minLength": 128 - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "sni": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "validity_start": { - "type": "integer" - }, - "cert": { - "maxLength": 65536, - "type": "string", - "minLength": 128 - }, - "create_time": { - "type": "integer" - }, - "status": { - "default": 1, - "description": "ssl status, 1 to enable, 0 to disable", - "type": "integer", - "enum": [1, 0] - } - }, - "oneOf": [{ - "required": ["sni", "key", "cert"] - }, { - "required": ["snis", "key", "cert"] - }], - "type": "object", - "additionalProperties": false - }, - "consumer": { - "properties": { - "update_time": { - "type": "integer" - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "username": { - "pattern": "^[a-zA-Z0-9_]+$", - "maxLength": 32, - "type": "string", - "minLength": 1 - }, - "plugins": { - "type": "object" - }, - "create_time": { - "type": "integer" - }, - "desc": { - "type": "string", - "maxLength": 256 - } - }, - "additionalProperties": false, - "type": "object", - "required": ["username"] - }, - "route": { - "not": { - "anyOf": [{ - "required": ["script", "plugins"] - }] - }, - "type": "object", - "additionalProperties": false, - "properties": { - "priority": { - "type": "integer", - "default": 0 - }, - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "uris": { - "uniqueItems": true, - "type": "array", - "items": { - "type": "string", - "description": "HTTP uri" - } - }, - "upstream_id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "vars": { - "type": "array", - "items": { - "description": "Nginx builtin variable name and value", - "type": "array", - "items": { - "maxItems": 3, - "anyOf": [{ - "type": "string" - }, { - "type": "number" - }], - "minItems": 2 - } - } - }, - "plugins": { - "type": "object" - }, - "create_time": { - "type": "integer" - }, - "filter_func": { - "pattern": "^function", - "type": "string", - "minLength": 10 - }, - "update_time": { - "type": "integer" - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "uri": { - "maxLength": 4096, - "type": "string", - "minLength": 1 - }, - "upstream": { - "properties": { - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" - }, - "timeout": { - "properties": { - "send": { - "type": "number", - "minimum": 0 - }, - "connect": { - "type": "number", - "minimum": 0 - }, - "read": { - "type": "number", - "minimum": 0 - } - }, - "type": "object", - "required": ["connect", "send", "read"] - }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "create_time": { - "type": "integer" - }, - "update_time": { - "type": "integer" - }, - "nodes": { - "anyOf": [{ - "patternProperties": { - ".*": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - } - }, - "type": "object", - "minProperties": 1 - }, { - "items": { - "properties": { - "metadata": { - "type": "object", - "description": "metadata of node" - }, - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - }, - "port": { - "description": "port of node", - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["host", "port", "weight"] - }, - "type": "array", - "minItems": 1 - }] - }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] - }, - "k8s_deployment_info": { - "properties": { - "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "deploy_name": { - "type": "string", - "description": "k8s deployment name" - }, - "port": { - "type": "number", - "minimum": 0 - }, - "backend_type": { - "default": "pod", - "description": "k8s service name", - "type": "string", - "enum": ["svc", "pod"] - }, - "service_name": { - "type": "string", - "description": "k8s service name" - } - }, - "type": "object", - "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] - }, { - "required": ["namespace", "service_name", "port"] - }] - }, - "hash_on": { - "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] - }, - "retries": { - "type": "integer", - "minimum": 0 - }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "checks": { - "properties": { - "active": { - "type": "object", - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "http_path": { - "type": "string", - "default": "/" - }, - "https_verify_certificate": { - "type": "boolean", - "default": true - }, - "concurrency": { - "type": "integer", - "default": 10 - }, - "timeout": { - "type": "number", - "default": 1 - }, - "req_headers": { - "items": { - "type": "string", - "uniqueItems": true - }, - "type": "array", - "minItems": 1 - }, - "unhealthy": { - "type": "object", - "properties": { - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 3, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "port": { - "minimum": 1, - "type": "integer", - "maximum": 65535 - }, - "healthy": { - "type": "object", - "properties": { - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [200, 302], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "successes": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - } - } - }, - "passive": { - "type": "object", - "properties": { - "unhealthy": { - "type": "object", - "properties": { - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [429, 500, 503], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 7, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "healthy": { - "type": "object", - "properties": { - "successes": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - } - } - } - } - } - }, - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }], - "type": "object", - "additionalProperties": false - }, - "name": { - "type": "string", - "maxLength": 50 - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "service_name": { - "type": "string", - "maxLength": 50 - } - }, - "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] - }, { - "required": ["type", "service_name"] - }], - "type": "object", - "additionalProperties": false - }, - "remote_addr": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string", - "title": "IPv4" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "type": "string", - "title": "IPv4/CIDR" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "type": "string", - "title": "IPv6" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", - "type": "string", - "title": "IPv6/CIDR" - }], - "description": "client IP", - "type": "string" - }, - "hosts": { - "uniqueItems": true, - "type": "array", - "items": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - } - }, - "methods": { - "uniqueItems": true, - "type": "array", - "items": { - "description": "HTTP method", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] - } - }, - "script": { - "maxLength": 102400, - "type": "string", - "minLength": 10 - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "service_protocol": { - "enum": ["grpc", "http"] - }, - "name": { - "type": "string", - "maxLength": 50 - }, - "remote_addrs": { - "uniqueItems": true, - "type": "array", - "items": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string", - "title": "IPv4" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "type": "string", - "title": "IPv4/CIDR" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "type": "string", - "title": "IPv6" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", - "type": "string", - "title": "IPv6/CIDR" - }], - "description": "client IP", - "type": "string" - } - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "service_id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - } - }, - "anyOf": [{ - "required": ["plugins", "uri"] - }, { - "required": ["upstream", "uri"] - }, { - "required": ["upstream_id", "uri"] - }, { - "required": ["service_id", "uri"] - }, { - "required": ["plugins", "uris"] - }, { - "required": ["upstream", "uris"] - }, { - "required": ["upstream_id", "uris"] - }, { - "required": ["service_id", "uris"] - }, { - "required": ["script", "uri"] - }, { - "required": ["script", "uris"] - }] - }, - "upstream": { - "properties": { - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" - }, - "timeout": { - "properties": { - "send": { - "type": "number", - "minimum": 0 - }, - "connect": { - "type": "number", - "minimum": 0 - }, - "read": { - "type": "number", - "minimum": 0 - } - }, - "type": "object", - "required": ["connect", "send", "read"] - }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "create_time": { - "type": "integer" - }, - "update_time": { - "type": "integer" - }, - "nodes": { - "anyOf": [{ - "patternProperties": { - ".*": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - } - }, - "type": "object", - "minProperties": 1 - }, { - "items": { - "properties": { - "metadata": { - "type": "object", - "description": "metadata of node" - }, - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - }, - "port": { - "description": "port of node", - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["host", "port", "weight"] - }, - "type": "array", - "minItems": 1 - }] - }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] - }, - "k8s_deployment_info": { - "properties": { - "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "deploy_name": { - "type": "string", - "description": "k8s deployment name" - }, - "port": { - "type": "number", - "minimum": 0 - }, - "backend_type": { - "default": "pod", - "description": "k8s service name", - "type": "string", - "enum": ["svc", "pod"] - }, - "service_name": { - "type": "string", - "description": "k8s service name" - } - }, - "type": "object", - "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] - }, { - "required": ["namespace", "service_name", "port"] - }] - }, - "hash_on": { - "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] - }, - "retries": { - "type": "integer", - "minimum": 0 - }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" - }, - "labels": { - "patternProperties": { - ".*": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - } - }, - "description": "key/value pairs to specify attributes", - "type": "object", - "maxProperties": 16 - }, - "checks": { - "properties": { - "active": { - "type": "object", - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "http_path": { - "type": "string", - "default": "/" - }, - "https_verify_certificate": { - "type": "boolean", - "default": true - }, - "concurrency": { - "type": "integer", - "default": 10 - }, - "timeout": { - "type": "number", - "default": 1 - }, - "req_headers": { - "items": { - "type": "string", - "uniqueItems": true - }, - "type": "array", - "minItems": 1 - }, - "unhealthy": { - "type": "object", - "properties": { - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 3, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "port": { - "minimum": 1, - "type": "integer", - "maximum": 65535 - }, - "healthy": { - "type": "object", - "properties": { - "interval": { - "minimum": 1, - "type": "integer", - "default": 0 - }, - "http_statuses": { - "type": "array", - "default": [200, 302], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "successes": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - } - } - }, - "passive": { - "type": "object", - "properties": { - "unhealthy": { - "type": "object", - "properties": { - "tcp_failures": { - "default": 2, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [429, 500, 503], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - }, - "http_failures": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "timeouts": { - "default": 7, - "minimum": 1, - "type": "integer", - "maximum": 254 - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "healthy": { - "type": "object", - "properties": { - "successes": { - "default": 5, - "minimum": 1, - "type": "integer", - "maximum": 254 - }, - "http_statuses": { - "type": "array", - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "items": { - "minimum": 200, - "type": "integer", - "maximum": 599 - }, - "uniqueItems": true, - "minItems": 1 - } - } - } - } - } - }, - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }], - "type": "object", - "additionalProperties": false - }, - "name": { - "type": "string", - "maxLength": 50 - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "service_name": { - "type": "string", - "maxLength": 50 - } - }, - "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] - }, { - "required": ["type", "service_name"] - }], - "type": "object", - "additionalProperties": false - }, - "label_value_def": { - "type": "string", - "maxLength": 64, - "description": "value of label", - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1 - }, - "global_rule": { - "properties": { - "plugins": { - "type": "object" - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - } - }, - "additionalProperties": false, - "type": "object", - "required": ["plugins"] - }, - "upstream_hash_header_schema": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_]+$" - } - }, - "plugins": { - "log-rotate": { - "schema": { - "properties": [], - "type": "object", - "additionalProperties": false - } - }, - "openid-connect": { - "schema": { - "properties": { - "realm": { - "type": "string" - }, - "ssl_verify": { - "type": "boolean" - }, - "client_id": { - "type": "string" - }, - "token_signing_alg_values_expected": { - "type": "string" - }, - "scope": { - "type": "string" - }, - "public_key": { - "type": "string" - }, - "redirect_uri": { - "type": "string" - }, - "introspection_endpoint_auth_method": { - "type": "string" - }, - "discovery": { - "type": "string" - }, - "timeout": { - "type": "integer", - "minimum": 1 - }, - "client_secret": { - "type": "string" - }, - "bearer_only": { - "type": "boolean" - }, - "introspection_endpoint": { - "type": "string" - }, - "logout_path": { - "type": "string" - } - }, - "type": "object", - "required": ["client_id", "client_secret", "discovery"] - } - }, - "request-id": { - "schema": { - "type": "object", - "properties": { - "include_in_response": { - "type": "boolean", - "default": true - }, - "header_name": { - "type": "string", - "default": "X-Request-Id" - } - } - } - }, - "proxy-rewrite": { - "schema": { - "properties": { - "regex_uri": { - "type": "array", - "maxItems": 2, - "description": "new uri that substitute from client uri for upstream, lower priority than uri property", - "items": { - "type": "string", - "description": "regex uri" - }, - "minItems": 2 - }, - "host": { - "description": "new host for upstream", - "type": "string", - "pattern": "^[0-9a-zA-Z-.]+$" - }, - "headers": { - "description": "new headers for request", - "type": "object", - "minProperties": 1 - }, - "uri": { - "type": "string", - "maxLength": 4096, - "description": "new uri for upstream", - "pattern": "^\\/.*", - "minLength": 1 - }, - "scheme": { - "description": "new scheme for upstream", - "type": "string", - "enum": ["http", "https"] - } - }, - "additionalProperties": false, - "type": "object", - "minProperties": 1 - } - }, - "zipkin": { - "schema": { - "properties": { - "sample_ratio": { - "minimum": 1e-05, - "type": "number", - "maximum": 1 - }, - "endpoint": { - "type": "string" - }, - "server_addr": { - "description": "default is $server_addr, you can speific your external ip address", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" - }, - "service_name": { - "description": "service name for zipkin reporter", - "type": "string", - "default": "APISIX" - } - }, - "type": "object", - "required": ["endpoint", "sample_ratio"] - } - }, - "limit-req": { - "schema": { - "properties": { - "rejected_code": { - "minimum": 200, - "type": "integer", - "default": 503 - }, - "burst": { - "type": "number", - "minimum": 0 - }, - "key": { - "type": "string", - "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] - }, - "rate": { - "type": "number", - "minimum": 0 - } - }, - "type": "object", - "required": ["rate", "burst", "key"] - } - }, - "ip-restriction": { - "schema": { - "type": "object", - "oneOf": [{ - "properties": { - "whitelist": { - "minItems": 1, - "type": "array", - "items": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string", - "title": "IPv4" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "type": "string", - "title": "IPv4/CIDR" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "type": "string", - "title": "IPv6" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", - "type": "string", - "title": "IPv6/CIDR" - }] - } - } - }, - "additionalProperties": false, - "required": ["whitelist"], - "title": "whitelist" - }, { - "properties": { - "blacklist": { - "minItems": 1, - "type": "array", - "items": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string", - "title": "IPv4" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "type": "string", - "title": "IPv4/CIDR" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "type": "string", - "title": "IPv6" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", - "type": "string", - "title": "IPv6/CIDR" - }] - } - } - }, - "additionalProperties": false, - "required": ["blacklist"], - "title": "blacklist" - }] - } - }, - "limit-conn": { - "schema": { - "properties": { - "key": { - "type": "string", - "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"] - }, - "conn": { - "type": "integer", - "minimum": 0 - }, - "default_conn_delay": { - "type": "number", - "minimum": 0 - }, - "burst": { - "type": "integer", - "minimum": 0 - }, - "rejected_code": { - "minimum": 200, - "type": "integer", - "default": 503 - } - }, - "type": "object", - "required": ["conn", "burst", "default_conn_delay", "key"] - } - }, - "cors": { - "schema": { - "type": "object", - "properties": { - "allow_headers": { - "description": "you can use '*' to allow all header when no credentials,'**' to allow forcefully(it will bring some security risks, be carefully),multiple header use ',' to split. default: *.", - "type": "string", - "default": "*" - }, - "allow_origins": { - "description": "you can use '*' to allow all origins when no credentials,'**' to allow forcefully(it will bring some security risks, be carefully),multiple origin use ',' to split. default: *.", - "type": "string", - "default": "*" - }, - "allow_methods": { - "description": "you can use '*' to allow all methods when no credentials and '**','**' to allow forcefully(it will bring some security risks, be carefully),multiple method use ',' to split. default: *.", - "type": "string", - "default": "*" - }, - "max_age": { - "description": "maximum number of seconds the results can be cached.-1 mean no cached,the max value is depend on browser,more detail plz check MDN. default: 5.", - "type": "integer", - "default": 5 - }, - "expose_headers": { - "description": "you can use '*' to expose all header when no credentials,multiple header use ',' to split. default: *.", - "type": "string", - "default": "*" - }, - "allow_credential": { - "description": "allow client append crendential. according to CORS specification,if you set this option to 'true', you can not use '*' for other options.", - "type": "boolean", - "default": false - } - } - } - }, - "prometheus": { - "schema": { - "type": "object", - "additionalProperties": false - } - }, - "key-auth": { - "schema": { - "type": "object", - "properties": { - "key": { - "type": "string" - } - } - } - }, - "kafka-logger": { - "schema": { - "properties": { - "batch_max_size": { - "minimum": 1, - "type": "integer", - "default": 1000 - }, - "buffer_duration": { - "minimum": 1, - "type": "integer", - "default": 60 - }, - "include_req_body": { - "type": "boolean", - "default": false - }, - "retry_delay": { - "minimum": 0, - "type": "integer", - "default": 1 - }, - "inactive_timeout": { - "minimum": 1, - "type": "integer", - "default": 5 - }, - "key": { - "type": "string" - }, - "kafka_topic": { - "type": "string" - }, - "timeout": { - "minimum": 1, - "type": "integer", - "default": 3 - }, - "name": { - "type": "string", - "default": "kafka logger" - }, - "max_retry_count": { - "minimum": 0, - "type": "integer", - "default": 0 - }, - "meta_format": { - "default": "default", - "type": "string", - "enum": ["default", "origin"] - }, - "broker_list": { - "type": "object" - } - }, - "type": "object", - "required": ["broker_list", "kafka_topic", "key"] - } - }, - "uri-blocker": { - "schema": { - "properties": { - "rejected_code": { - "minimum": 200, - "type": "integer", - "default": 403 - }, - "block_rules": { - "uniqueItems": true, - "type": "array", - "items": { - "maxLength": 4096, - "type": "string", - "minLength": 1 - } - } - }, - "type": "object", - "required": ["block_rules"] - } - }, - "jwt-auth": { - "schema": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "secret": { - "type": "string" - }, - "exp": { - "type": "integer", - "minimum": 1 - }, - "algorithm": { - "default": "HS256", - "type": "string", - "enum": ["HS256", "HS512", "RS256"] - }, - "base64_secret": { - "type": "boolean", - "default": false - } - } - } - }, - "example-plugin": { - "schema": { - "properties": { - "s": { - "type": "string" - }, - "t": { - "type": "array", - "minItems": 1 - }, - "i": { - "type": "number", - "minimum": 0 - }, - "port": { - "type": "integer" - }, - "ip": { - "type": "string" - } - }, - "type": "object", - "required": ["i"] - } - }, - "proxy-cache": { - "schema": { - "properties": { - "cache_zone": { - "type": "string", - "minLength": 1 - }, - "cache_key": { - "default": ["$host", "$request_uri"], - "items": { - "description": "a key for caching", - "type": "string", - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" - }, - "type": "array", - "minItems": 1 - }, - "hide_cache_headers": { - "type": "boolean", - "default": false - }, - "cache_bypass": { - "items": { - "type": "string", - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" - }, - "type": "array", - "minItems": 1 - }, - "no_cache": { - "items": { - "type": "string", - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" - }, - "type": "array", - "minItems": 1 - }, - "cache_method": { - "type": "array", - "default": ["GET", "HEAD"], - "items": { - "description": "http method", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] - }, - "uniqueItems": true, - "minItems": 1 - }, - "cache_http_status": { - "type": "array", - "default": [200, 301, 404], - "items": { - "maximum": 599, - "description": "http response status", - "type": "integer", - "minimum": 200 - }, - "uniqueItems": true, - "minItems": 1 - } - }, - "type": "object", - "required": ["cache_zone"] - } - }, - "request-validation": { - "schema": { - "properties": { - "body_schema": { - "type": "object" - }, - "header_schema": { - "type": "object" - } - }, - "type": "object", - "anyOf": [{ - "required": ["body_schema"] - }, { - "required": ["header_schema"] - }] - } - }, - "hmac-auth": { - "schema": { - "properties": [], - "additionalProperties": false, - "type": "object", - "title": "work with route or service object" - } - }, - "http-logger": { - "schema": { - "properties": { - "batch_max_size": { - "minimum": 1, - "type": "integer", - "default": 1000 - }, - "uri": { - "type": "string" - }, - "concat_method": { - "default": "json", - "type": "string", - "enum": ["json", "new_line"] - }, - "inactive_timeout": { - "minimum": 1, - "type": "integer", - "default": 5 - }, - "include_req_body": { - "type": "boolean", - "default": false - }, - "max_retry_count": { - "minimum": 0, - "type": "integer", - "default": 0 - }, - "timeout": { - "minimum": 1, - "type": "integer", - "default": 3 - }, - "name": { - "type": "string", - "default": "http logger" - }, - "buffer_duration": { - "minimum": 1, - "type": "integer", - "default": 60 - }, - "auth_header": { - "type": "string", - "default": "" - }, - "retry_delay": { - "minimum": 0, - "type": "integer", - "default": 1 - } - }, - "type": "object", - "required": ["uri"] - } - }, - "serverless-pre-function": { - "schema": { - "properties": { - "phase": { - "type": "string", - "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"] - }, - "functions": { - "minItems": 1, - "type": "array", - "items": { - "type": "string" - } - } - }, - "type": "object", - "required": ["functions"] - } - }, - "wolf-rbac": { - "schema": { - "type": "object", - "properties": { - "appid": { - "type": "string", - "default": "unset" - }, - "server": { - "type": "string", - "default": "http://127.0.0.1:10080" - }, - "header_prefix": { - "type": "string", - "default": "X-" - } - } - } - }, - "skywalking": { - "schema": { - "properties": { - "sample_ratio": { - "default": 1, - "minimum": 1e-05, - "type": "number", - "maximum": 1 - }, - "endpoint": { - "type": "string" - } - }, - "required": ["endpoint"], - "type": "object", - "service_name": { - "description": "service name for skywalking", - "type": "string", - "default": "APISIX" - } - } - }, - "udp-logger": { - "schema": { - "properties": { - "inactive_timeout": { - "minimum": 1, - "type": "integer", - "default": 5 - }, - "host": { - "type": "string" - }, - "include_req_body": { - "type": "boolean", - "default": false - }, - "port": { - "type": "integer", - "minimum": 0 - }, - "name": { - "type": "string", - "default": "udp logger" - }, - "batch_max_size": { - "minimum": 1, - "type": "integer", - "default": 1000 - }, - "buffer_duration": { - "minimum": 1, - "type": "integer", - "default": 60 - }, - "timeout": { - "minimum": 1, - "type": "integer", - "default": 3 - } - }, - "type": "object", - "required": ["host", "port"] - } - }, - "serverless-post-function": { - "schema": { - "properties": { - "phase": { - "type": "string", - "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"] - }, - "functions": { - "minItems": 1, - "type": "array", - "items": { - "type": "string" - } - } - }, - "type": "object", - "required": ["functions"] - } - }, - "consumer-restriction": { - "schema": { - "type": "object", - "oneOf": [{ - "properties": { - "blacklist": { - "items": { - "type": "string" - }, - "type": "array", - "minItems": 1 - }, - "type": { - "default": "consumer_name", - "type": "string", - "enum": ["consumer_name", "service_id"] - }, - "rejected_code": { - "minimum": 200, - "type": "integer", - "default": 403 - } - }, - "required": ["blacklist"], - "title": "blacklist" - }, { - "properties": { - "whitelist": { - "items": { - "type": "string" - }, - "type": "array", - "minItems": 1 - }, - "type": { - "default": "consumer_name", - "type": "string", - "enum": ["consumer_name", "service_id"] - }, - "rejected_code": { - "minimum": 200, - "type": "integer", - "default": 403 - } - }, - "required": ["whitelist"], - "title": "whitelist" - }] - } - }, - "tcp-logger": { - "schema": { - "properties": { - "tls": { - "type": "boolean", - "default": false - }, - "host": { - "type": "string" - }, - "tls_options": { - "type": "string" - }, - "include_req_body": { - "type": "boolean", - "default": false - }, - "inactive_timeout": { - "minimum": 1, - "type": "integer", - "default": 5 - }, - "batch_max_size": { - "minimum": 1, - "type": "integer", - "default": 1000 - }, - "max_retry_count": { - "minimum": 0, - "type": "integer", - "default": 0 - }, - "port": { - "type": "integer", - "minimum": 0 - }, - "name": { - "type": "string", - "default": "tcp logger" - }, - "buffer_duration": { - "minimum": 1, - "type": "integer", - "default": 60 - }, - "retry_delay": { - "minimum": 0, - "type": "integer", - "default": 1 - }, - "timeout": { - "minimum": 1, - "type": "integer", - "default": 1000 - } - }, - "type": "object", - "required": ["host", "port"] - } - }, - "limit-count": { - "schema": { - "properties": { - "count": { - "type": "integer", - "minimum": 0 - }, - "key": { - "type": "string", - "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] - }, - "rejected_code": { - "default": 503, - "minimum": 200, - "type": "integer", - "maximum": 600 - }, - "time_window": { - "type": "integer", - "minimum": 0 - }, - "policy": { - "default": "local", - "type": "string", - "enum": ["local", "redis", "redis-cluster"] - } - }, - "dependencies": { - "policy": { - "oneOf": [{ - "properties": { - "policy": { - "enum": ["local"] - } - } - }, { - "properties": { - "policy": { - "enum": ["redis"] - }, - "redis_host": { - "type": "string", - "minLength": 2 - }, - "redis_timeout": { - "minimum": 1, - "type": "integer", - "default": 1000 - }, - "redis_port": { - "minimum": 1, - "type": "integer", - "default": 6379 - }, - "redis_password": { - "type": "string", - "minLength": 0 - } - }, - "required": ["redis_host"] - }, { - "properties": { - "redis_timeout": { - "minimum": 1, - "type": "integer", - "default": 1000 - }, - "policy": { - "enum": ["redis-cluster"] - }, - "redis_cluster_nodes": { - "items": { - "maxLength": 100, - "type": "string", - "minLength": 2 - }, - "type": "array", - "minItems": 2 - }, - "redis_password": { - "type": "string", - "minLength": 0 - } - }, - "required": ["redis_cluster_nodes"] - }] - } - }, - "type": "object", - "required": ["count", "time_window", "key"] - } - }, - "fault-injection": { - "schema": { - "properties": { - "delay": { - "properties": { - "duration": { - "type": "number", - "minimum": 0 - } - }, - "type": "object", - "minProperties": 1 - }, - "abort": { - "properties": { - "body": { - "type": "string", - "minLength": 0 - }, - "http_status": { - "type": "integer", - "minimum": 200 - } - }, - "type": "object", - "minProperties": 1 - } - }, - "type": "object", - "minProperties": 1 - } - }, - "proxy-mirror": { - "schema": { - "properties": { - "host": { - "type": "string", - "pattern": "^http(s)?:\\/\\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:[0-9]{1,5})?$" - } - }, - "minProperties": 1, - "type": "object", - "required": ["host"] - } - }, - "response-rewrite": { - "schema": { - "properties": { - "body": { - "type": "string", - "description": "new body for repsonse" - }, - "status_code": { - "maximum": 598, - "description": "new status code for repsonse", - "type": "integer", - "minimum": 200 - }, - "body_base64": { - "description": "whether new body for repsonse need base64 decode before return", - "type": "boolean", - "default": false - }, - "headers": { - "description": "new headers for repsonse", - "type": "object", - "minProperties": 1 - } - }, - "additionalProperties": false, - "type": "object", - "minProperties": 1 - } - }, - "basic-auth": { - "schema": { - "properties": [], - "additionalProperties": false, - "type": "object", - "title": "work with route or service object" - } - }, - "grpc-transcode": { - "schema": { - "properties": { - "service": { - "type": "string", - "description": "the grpc service name" - }, - "proto_id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_]+$", - "maxLength": 64, - "type": "string", - "minLength": 1 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "deadline": { - "description": "deadline for grpc, millisecond", - "type": "number", - "default": 0 - }, - "pb_option": { - "minItems": 1, - "type": "array", - "items": { - "type": "string", - "anyOf": [{ - "description": "enum as result", - "type": "string", - "enum": ["int64_as_number", "int64_as_string", "int64_as_hexstring"] - }, { - "description": "int64 as result", - "type": "string", - "enum": ["ienum_as_name", "enum_as_value"] - }, { - "description": "default values option", - "type": "string", - "enum": ["auto_default_values", "no_default_values", "use_default_values", "use_default_metatable"] - }, { - "description": "hooks option", - "type": "string", - "enum": ["enable_hooks", "disable_hooks"] - }] - } - }, - "method": { - "type": "string", - "description": "the method name in the grpc service." - } - }, - "required": ["proto_id", "service", "method"], - "type": "object", - "additionalProperties": true - } - }, - "batch-requests": { - "schema": { - "type": "object", - "additionalProperties": false - } - }, - "referer-restriction": { - "schema": { - "properties": { - "whitelist": { - "minItems": 1, - "type": "array", - "items": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - } - }, - "bypass_missing": { - "type": "boolean", - "default": false - } - }, - "additionalProperties": false, - "type": "object", - "required": ["whitelist"] - } - }, - "syslog": { - "schema": { - "properties": { - "tls": { - "type": "boolean", - "default": false - }, - "host": { - "type": "string" - }, - "sock_type": { - "default": "tcp", - "type": "string", - "enum": ["tcp", "udp"] - }, - "retry_interval": { - "minimum": 0, - "type": "integer", - "default": 1 - }, - "buffer_duration": { - "minimum": 1, - "type": "integer", - "default": 60 - }, - "flush_limit": { - "minimum": 1, - "type": "integer", - "default": 4096 - }, - "drop_limit": { - "type": "integer", - "default": 1048576 - }, - "include_req_body": { - "type": "boolean", - "default": false - }, - "max_retry_times": { - "minimum": 1, - "type": "integer", - "default": 1 - }, - "port": { - "type": "integer" - }, - "name": { - "type": "string", - "default": "sys logger" - }, - "batch_max_size": { - "minimum": 1, - "type": "integer", - "default": 1000 - }, - "timeout": { - "minimum": 1, - "type": "integer", - "default": 3 - }, - "pool_size": { - "minimum": 5, - "type": "integer", - "default": 5 - } - }, - "type": "object", - "required": ["host", "port"] - } - }, - "authz-keycloak": { - "schema": { - "properties": { - "keepalive_pool": { - "minimum": 1, - "type": "integer", - "default": 5 - }, - "token_endpoint": { - "maxLength": 4096, - "type": "string", - "minLength": 1 - }, - "policy_enforcement_mode": { - "default": "ENFORCING", - "type": "string", - "enum": ["ENFORCING", "PERMISSIVE"] - }, - "keepalive": { - "type": "boolean", - "default": true - }, - "ssl_verify": { - "type": "boolean", - "default": true - }, - "timeout": { - "minimum": 1000, - "type": "integer", - "default": 3000 - }, - "permissions": { - "uniqueItems": true, - "type": "array", - "items": { - "maxLength": 100, - "type": "string", - "minLength": 1 - } - }, - "keepalive_timeout": { - "minimum": 1000, - "type": "integer", - "default": 60000 - }, - "grant_type": { - "type": "string", - "maxLength": 100, - "minLength": 1, - "default": "urn:ietf:params:oauth:grant-type:uma-ticket", - "enum": ["urn:ietf:params:oauth:grant-type:uma-ticket"] - }, - "audience": { - "maxLength": 100, - "type": "string", - "minLength": 1 - } - }, - "type": "object", - "required": ["token_endpoint"] - } - }, - "echo": { - "schema": { - "type": "object", - "minProperties": 1, - "properties": { - "before_body": { - "type": "string", - "description": "body before the filter phase." - }, - "body": { - "type": "string", - "description": "body to replace upstream response." - }, - "auth_value": { - "type": "string", - "description": "auth value" - }, - "headers": { - "description": "new headers for response", - "type": "object", - "minProperties": 1 - }, - "after_body": { - "type": "string", - "description": "body after the modification of filter phase." - } - }, - "additionalProperties": false, - "anyOf": [{ - "required": ["before_body"] - }, { - "required": ["body"] - }, { - "required": ["after_body"] - }] - } - }, - "redirect": { - "schema": { - "properties": { - "ret_code": { - "minimum": 200, - "type": "integer", - "default": 302 - }, - "http_to_https": { - "type": "boolean" - }, - "uri": { - "type": "string", - "minLength": 2 - } - }, - "oneOf": [{ - "required": ["uri"] - }, { - "required": ["http_to_https"] - }], - "type": "object" - } - }, - "node-status": { - "schema": { - "type": "object", - "additionalProperties": false - } - } - } -} + "main": { + "global_rule": { + "additionalProperties": false, + "type": "object", + "required": ["plugins"], + "properties": { + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "plugins": { + "type": "object" + } + } + }, + "upstream": { + "properties": { + "update_time": { + "type": "integer" + }, + "retries": { + "minimum": 0, + "type": "integer" + }, + "k8s_deployment_info": { + "type": "object", + "properties": { + "port": { + "minimum": 0, + "type": "number" + }, + "deploy_name": { + "description": "k8s deployment name", + "type": "string" + }, + "service_name": { + "description": "k8s service name", + "type": "string" + }, + "namespace": { + "description": "k8s namespace", + "type": "string" + }, + "backend_type": { + "enum": ["svc", "pod"], + "type": "string", + "default": "pod", + "description": "k8s service name" + } + }, + "anyOf": [{ + "required": ["namespace", "deploy_name", "port"] + }, { + "required": ["namespace", "service_name", "port"] + }] + }, + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" + }, + "pass_host": { + "default": "pass", + "type": "string", + "description": "mod of host passing", + "enum": ["pass", "node", "rewrite"] + }, + "type": { + "type": "string", + "description": "algorithms of load balancing", + "enum": ["chash", "roundrobin", "ewma"] + }, + "timeout": { + "type": "object", + "required": ["connect", "send", "read"], + "properties": { + "send": { + "minimum": 0, + "type": "number" + }, + "read": { + "minimum": 0, + "type": "number" + }, + "connect": { + "minimum": 0, + "type": "number" + } + } + }, + "checks": { + "properties": { + "passive": { + "properties": { + "unhealthy": { + "properties": { + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 7, + "maximum": 254 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 500, 503], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "healthy": { + "properties": { + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + } + }, + "type": "object" + } + }, + "type": "object" + }, + "active": { + "properties": { + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "timeout": { + "default": 1, + "type": "number" + }, + "req_headers": { + "items": { + "uniqueItems": true, + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "http_path": { + "default": "/", + "type": "string" + }, + "concurrency": { + "default": 10, + "type": "integer" + }, + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "maximum": 65535 + }, + "unhealthy": { + "properties": { + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 3, + "maximum": 254 + }, + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 404, 500, 501, 502, 503, 504, 505], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "healthy": { + "properties": { + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 302], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "https_verify_certificate": { + "default": true, + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }] + }, + "hash_on": { + "type": "string", + "default": "vars", + "enum": ["vars", "header", "cookie", "consumer"] + }, + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "discovery_type": { + "description": "discovery type", + "type": "string" + }, + "create_time": { + "type": "integer" + }, + "name": { + "maxLength": 50, + "type": "string" + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, { + "items": { + "type": "object", + "required": ["host", "port", "weight"], + "properties": { + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "description": "port of node" + }, + "metadata": { + "description": "metadata of node", + "type": "object" + }, + "weight": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, + "type": "array", + "minItems": 1 + }] + }, + "service_name": { + "maxLength": 50, + "type": "string" + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["type", "nodes"] + }, { + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] + }] + }, + "id_schema": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "service": { + "type": "object", + "additionalProperties": false, + "properties": { + "script": { + "type": "string", + "maxLength": 102400, + "minLength": 10 + }, + "upstream": { + "properties": { + "update_time": { + "type": "integer" + }, + "retries": { + "minimum": 0, + "type": "integer" + }, + "k8s_deployment_info": { + "type": "object", + "properties": { + "port": { + "minimum": 0, + "type": "number" + }, + "deploy_name": { + "description": "k8s deployment name", + "type": "string" + }, + "service_name": { + "description": "k8s service name", + "type": "string" + }, + "namespace": { + "description": "k8s namespace", + "type": "string" + }, + "backend_type": { + "enum": ["svc", "pod"], + "type": "string", + "default": "pod", + "description": "k8s service name" + } + }, + "anyOf": [{ + "required": ["namespace", "deploy_name", "port"] + }, { + "required": ["namespace", "service_name", "port"] + }] + }, + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" + }, + "pass_host": { + "default": "pass", + "type": "string", + "description": "mod of host passing", + "enum": ["pass", "node", "rewrite"] + }, + "type": { + "type": "string", + "description": "algorithms of load balancing", + "enum": ["chash", "roundrobin", "ewma"] + }, + "timeout": { + "type": "object", + "required": ["connect", "send", "read"], + "properties": { + "send": { + "minimum": 0, + "type": "number" + }, + "read": { + "minimum": 0, + "type": "number" + }, + "connect": { + "minimum": 0, + "type": "number" + } + } + }, + "checks": { + "properties": { + "passive": { + "properties": { + "unhealthy": { + "properties": { + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 7, + "maximum": 254 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 500, 503], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "healthy": { + "properties": { + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + } + }, + "type": "object" + } + }, + "type": "object" + }, + "active": { + "properties": { + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "timeout": { + "default": 1, + "type": "number" + }, + "req_headers": { + "items": { + "uniqueItems": true, + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "http_path": { + "default": "/", + "type": "string" + }, + "concurrency": { + "default": 10, + "type": "integer" + }, + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "maximum": 65535 + }, + "unhealthy": { + "properties": { + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 3, + "maximum": 254 + }, + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 404, 500, 501, 502, 503, 504, 505], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "healthy": { + "properties": { + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 302], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "https_verify_certificate": { + "default": true, + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }] + }, + "hash_on": { + "type": "string", + "default": "vars", + "enum": ["vars", "header", "cookie", "consumer"] + }, + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "discovery_type": { + "description": "discovery type", + "type": "string" + }, + "create_time": { + "type": "integer" + }, + "name": { + "maxLength": 50, + "type": "string" + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, { + "items": { + "type": "object", + "required": ["host", "port", "weight"], + "properties": { + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "description": "port of node" + }, + "metadata": { + "description": "metadata of node", + "type": "object" + }, + "weight": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, + "type": "array", + "minItems": 1 + }] + }, + "service_name": { + "maxLength": 50, + "type": "string" + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["type", "nodes"] + }, { + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] + }] + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "create_time": { + "type": "integer" + }, + "name": { + "maxLength": 50, + "type": "string" + }, + "upstream_id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "plugins": { + "type": "object" + }, + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" + }, + "update_time": { + "type": "integer" + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + } + }, + "ip_def": [{ + "type": "string", + "title": "IPv4", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + }, { + "type": "string", + "title": "IPv4/CIDR", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$" + }, { + "type": "string", + "title": "IPv6", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$" + }, { + "type": "string", + "title": "IPv6/CIDR", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$" + }], + "host_def": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "ssl": { + "oneOf": [{ + "required": ["sni", "key", "cert"] + }, { + "required": ["snis", "key", "cert"] + }], + "type": "object", + "additionalProperties": false, + "properties": { + "update_time": { + "type": "integer" + }, + "create_time": { + "type": "integer" + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "status": { + "default": 1, + "type": "integer", + "description": "ssl status, 1 to enable, 0 to disable", + "enum": [1, 0] + }, + "cert": { + "type": "string", + "maxLength": 65536, + "minLength": 128 + }, + "sni": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "validity_end": { + "type": "integer" + }, + "validity_start": { + "type": "integer" + }, + "key": { + "type": "string", + "maxLength": 65536, + "minLength": 128 + }, + "exptime": { + "minimum": 1588262400, + "type": "integer" + }, + "keys": { + "items": { + "type": "string", + "maxLength": 65536, + "minLength": 128 + }, + "type": "array" + }, + "certs": { + "items": { + "type": "string", + "maxLength": 65536, + "minLength": 128 + }, + "type": "array" + }, + "snis": { + "items": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "type": "array" + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + } + }, + "proto": { + "additionalProperties": false, + "type": "object", + "required": ["content"], + "properties": { + "content": { + "type": "string", + "maxLength": 1048576, + "minLength": 1 + } + } + }, + "route": { + "type": "object", + "additionalProperties": false, + "properties": { + "service_id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "update_time": { + "type": "integer" + }, + "uris": { + "items": { + "description": "HTTP uri", + "type": "string" + }, + "type": "array", + "uniqueItems": true + }, + "hosts": { + "items": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "type": "array", + "uniqueItems": true + }, + "remote_addrs": { + "items": { + "type": "string", + "description": "client IP", + "anyOf": [{ + "type": "string", + "title": "IPv4", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + }, { + "type": "string", + "title": "IPv4/CIDR", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$" + }, { + "type": "string", + "title": "IPv6", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$" + }, { + "type": "string", + "title": "IPv6/CIDR", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$" + }] + }, + "type": "array", + "uniqueItems": true + }, + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "remote_addr": { + "type": "string", + "description": "client IP", + "anyOf": [{ + "type": "string", + "title": "IPv4", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + }, { + "type": "string", + "title": "IPv4/CIDR", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$" + }, { + "type": "string", + "title": "IPv6", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$" + }, { + "type": "string", + "title": "IPv6/CIDR", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$" + }] + }, + "upstream_id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "plugins": { + "type": "object" + }, + "priority": { + "default": 0, + "type": "integer" + }, + "uri": { + "type": "string", + "maxLength": 4096, + "minLength": 1 + }, + "methods": { + "items": { + "type": "string", + "description": "HTTP method", + "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] + }, + "type": "array", + "uniqueItems": true + }, + "script": { + "type": "string", + "maxLength": 102400, + "minLength": 10 + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" + }, + "create_time": { + "type": "integer" + }, + "name": { + "maxLength": 50, + "type": "string" + }, + "service_protocol": { + "enum": ["grpc", "http"] + }, + "vars": { + "items": { + "items": { + "maxItems": 3, + "minItems": 2, + "anyOf": [{ + "type": "string" + }, { + "type": "number" + }] + }, + "type": "array", + "description": "Nginx builtin variable name and value" + }, + "type": "array" + }, + "upstream": { + "properties": { + "update_time": { + "type": "integer" + }, + "retries": { + "minimum": 0, + "type": "integer" + }, + "k8s_deployment_info": { + "type": "object", + "properties": { + "port": { + "minimum": 0, + "type": "number" + }, + "deploy_name": { + "description": "k8s deployment name", + "type": "string" + }, + "service_name": { + "description": "k8s service name", + "type": "string" + }, + "namespace": { + "description": "k8s namespace", + "type": "string" + }, + "backend_type": { + "enum": ["svc", "pod"], + "type": "string", + "default": "pod", + "description": "k8s service name" + } + }, + "anyOf": [{ + "required": ["namespace", "deploy_name", "port"] + }, { + "required": ["namespace", "service_name", "port"] + }] + }, + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" + }, + "pass_host": { + "default": "pass", + "type": "string", + "description": "mod of host passing", + "enum": ["pass", "node", "rewrite"] + }, + "type": { + "type": "string", + "description": "algorithms of load balancing", + "enum": ["chash", "roundrobin", "ewma"] + }, + "timeout": { + "type": "object", + "required": ["connect", "send", "read"], + "properties": { + "send": { + "minimum": 0, + "type": "number" + }, + "read": { + "minimum": 0, + "type": "number" + }, + "connect": { + "minimum": 0, + "type": "number" + } + } + }, + "checks": { + "properties": { + "passive": { + "properties": { + "unhealthy": { + "properties": { + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 7, + "maximum": 254 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 500, 503], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "healthy": { + "properties": { + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + } + }, + "type": "object" + } + }, + "type": "object" + }, + "active": { + "properties": { + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "timeout": { + "default": 1, + "type": "number" + }, + "req_headers": { + "items": { + "uniqueItems": true, + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "http_path": { + "default": "/", + "type": "string" + }, + "concurrency": { + "default": 10, + "type": "integer" + }, + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "maximum": 65535 + }, + "unhealthy": { + "properties": { + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 3, + "maximum": 254 + }, + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 404, 500, 501, 502, 503, 504, 505], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "healthy": { + "properties": { + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 302], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "https_verify_certificate": { + "default": true, + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }] + }, + "hash_on": { + "type": "string", + "default": "vars", + "enum": ["vars", "header", "cookie", "consumer"] + }, + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "discovery_type": { + "description": "discovery type", + "type": "string" + }, + "create_time": { + "type": "integer" + }, + "name": { + "maxLength": 50, + "type": "string" + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, { + "items": { + "type": "object", + "required": ["host", "port", "weight"], + "properties": { + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "description": "port of node" + }, + "metadata": { + "description": "metadata of node", + "type": "object" + }, + "weight": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, + "type": "array", + "minItems": 1 + }] + }, + "service_name": { + "maxLength": 50, + "type": "string" + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["type", "nodes"] + }, { + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] + }] + }, + "filter_func": { + "type": "string", + "pattern": "^function", + "minLength": 10 + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + }, + "not": { + "anyOf": [{ + "required": ["script", "plugins"] + }] + }, + "anyOf": [{ + "required": ["plugins", "uri"] + }, { + "required": ["upstream", "uri"] + }, { + "required": ["upstream_id", "uri"] + }, { + "required": ["service_id", "uri"] + }, { + "required": ["plugins", "uris"] + }, { + "required": ["upstream", "uris"] + }, { + "required": ["upstream_id", "uris"] + }, { + "required": ["service_id", "uris"] + }, { + "required": ["script", "uri"] + }, { + "required": ["script", "uris"] + }] + }, + "upstream_hash_header_schema": { + "pattern": "^[a-zA-Z0-9-_]+$", + "type": "string" + }, + "upstream_hash_vars_schema": { + "pattern": "^((uri|server_name|server_addr|request_uri|remote_port|remote_addr|query_string|host|hostname)|arg_[0-9a-zA-z_-]+)$", + "type": "string" + }, + "version": 0.5, + "stream_route": { + "properties": { + "remote_addr": { + "type": "string", + "description": "client IP", + "anyOf": [{ + "type": "string", + "title": "IPv4", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + }, { + "type": "string", + "title": "IPv4/CIDR", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$" + }, { + "type": "string", + "title": "IPv6", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$" + }, { + "type": "string", + "title": "IPv6/CIDR", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$" + }] + }, + "plugins": { + "type": "object" + }, + "server_addr": { + "type": "string", + "description": "server IP", + "anyOf": [{ + "type": "string", + "title": "IPv4", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + }, { + "type": "string", + "title": "IPv4/CIDR", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$" + }, { + "type": "string", + "title": "IPv6", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$" + }, { + "type": "string", + "title": "IPv6/CIDR", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$" + }] + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "upstream_id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "server_port": { + "description": "server port", + "type": "integer" + }, + "upstream": { + "properties": { + "update_time": { + "type": "integer" + }, + "retries": { + "minimum": 0, + "type": "integer" + }, + "k8s_deployment_info": { + "type": "object", + "properties": { + "port": { + "minimum": 0, + "type": "number" + }, + "deploy_name": { + "description": "k8s deployment name", + "type": "string" + }, + "service_name": { + "description": "k8s service name", + "type": "string" + }, + "namespace": { + "description": "k8s namespace", + "type": "string" + }, + "backend_type": { + "enum": ["svc", "pod"], + "type": "string", + "default": "pod", + "description": "k8s service name" + } + }, + "anyOf": [{ + "required": ["namespace", "deploy_name", "port"] + }, { + "required": ["namespace", "service_name", "port"] + }] + }, + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" + }, + "pass_host": { + "default": "pass", + "type": "string", + "description": "mod of host passing", + "enum": ["pass", "node", "rewrite"] + }, + "type": { + "type": "string", + "description": "algorithms of load balancing", + "enum": ["chash", "roundrobin", "ewma"] + }, + "timeout": { + "type": "object", + "required": ["connect", "send", "read"], + "properties": { + "send": { + "minimum": 0, + "type": "number" + }, + "read": { + "minimum": 0, + "type": "number" + }, + "connect": { + "minimum": 0, + "type": "number" + } + } + }, + "checks": { + "properties": { + "passive": { + "properties": { + "unhealthy": { + "properties": { + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 7, + "maximum": 254 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 500, 503], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "healthy": { + "properties": { + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + } + }, + "type": "object" + } + }, + "type": "object" + }, + "active": { + "properties": { + "type": { + "type": "string", + "default": "http", + "enum": ["http", "https", "tcp"] + }, + "timeout": { + "default": 1, + "type": "number" + }, + "req_headers": { + "items": { + "uniqueItems": true, + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "http_path": { + "default": "/", + "type": "string" + }, + "concurrency": { + "default": 10, + "type": "integer" + }, + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "maximum": 65535 + }, + "unhealthy": { + "properties": { + "timeouts": { + "minimum": 1, + "type": "integer", + "default": 3, + "maximum": 254 + }, + "http_failures": { + "minimum": 1, + "type": "integer", + "default": 5, + "maximum": 254 + }, + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [429, 404, 500, 501, 502, 503, 504, 505], + "minItems": 1, + "uniqueItems": true + }, + "tcp_failures": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "healthy": { + "properties": { + "interval": { + "minimum": 1, + "type": "integer", + "default": 0 + }, + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [200, 302], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 2, + "maximum": 254 + } + }, + "type": "object" + }, + "https_verify_certificate": { + "default": true, + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }] + }, + "hash_on": { + "type": "string", + "default": "vars", + "enum": ["vars", "header", "cookie", "consumer"] + }, + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "discovery_type": { + "description": "discovery type", + "type": "string" + }, + "create_time": { + "type": "integer" + }, + "name": { + "maxLength": 50, + "type": "string" + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, { + "items": { + "type": "object", + "required": ["host", "port", "weight"], + "properties": { + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "port": { + "minimum": 1, + "type": "integer", + "description": "port of node" + }, + "metadata": { + "description": "metadata of node", + "type": "object" + }, + "weight": { + "minimum": 0, + "type": "integer", + "description": "weight of node" + } + } + }, + "type": "array", + "minItems": 1 + }] + }, + "service_name": { + "maxLength": 50, + "type": "string" + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + }, + "type": "object", + "additionalProperties": false, + "anyOf": [{ + "required": ["type", "nodes"] + }, { + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] + }] + } + }, + "type": "object" + }, + "plugin_disable_schema": { + "disable": { + "type": "boolean" + } + }, + "plugins": { + "items": { + "type": "object", + "required": ["name"], + "properties": { + "stream": { + "type": "boolean" + }, + "name": { + "minLength": 1, + "type": "string" + }, + "additionalProperties": false + } + }, + "type": "array" + }, + "label_value_def": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + }, + "consumer": { + "additionalProperties": false, + "type": "object", + "required": ["username"], + "properties": { + "username": { + "maxLength": 32, + "type": "string", + "pattern": "^[a-zA-Z0-9_]+$", + "minLength": 1 + }, + "create_time": { + "type": "integer" + }, + "update_time": { + "type": "integer" + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "plugins": { + "type": "object" + }, + "labels": { + "maxProperties": 16, + "type": "object", + "description": "key/value pairs to specify attributes", + "patternProperties": { + ".*": { + "type": "string", + "description": "value of label", + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64 + } + } + } + } + } + }, + "plugins": { + "limit-req": { + "schema": { + "type": "object", + "required": ["rate", "burst", "key"], + "properties": { + "rejected_code": { + "minimum": 200, + "type": "integer", + "default": 503 + }, + "key": { + "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"], + "type": "string" + }, + "rate": { + "minimum": 0, + "type": "number" + }, + "burst": { + "minimum": 0, + "type": "number" + } + } + } + }, + "zipkin": { + "schema": { + "type": "object", + "required": ["endpoint", "sample_ratio"], + "properties": { + "endpoint": { + "type": "string" + }, + "service_name": { + "type": "string", + "description": "service name for zipkin reporter", + "default": "APISIX" + }, + "sample_ratio": { + "minimum": 1e-05, + "type": "number", + "maximum": 1 + }, + "server_addr": { + "type": "string", + "description": "default is $server_addr, you can speific your external ip address", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + } + } + } + }, + "jwt-auth": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "consumer_schema": { + "required": ["key"], + "type": "object", + "additionalProperties": false, + "properties": { + "public_key": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exp": { + "minimum": 1, + "type": "integer", + "default": 86400 + }, + "base64_secret": { + "default": false, + "type": "boolean" + }, + "private_key": { + "type": "string" + }, + "algorithm": { + "type": "string", + "default": "HS256", + "enum": ["HS256", "HS512", "RS256"] + }, + "secret": { + "type": "string" + } + } + } + }, + "request-id": { + "schema": { + "properties": { + "header_name": { + "default": "X-Request-Id", + "type": "string" + }, + "include_in_response": { + "default": true, + "type": "boolean" + } + }, + "type": "object" + } + }, + "proxy-rewrite": { + "schema": { + "minProperties": 1, + "type": "object", + "additionalProperties": false, + "properties": { + "host": { + "type": "string", + "description": "new host for upstream", + "pattern": "^[0-9a-zA-Z-.]+$" + }, + "regex_uri": { + "items": { + "description": "regex uri", + "type": "string" + }, + "type": "array", + "description": "new uri that substitute from client uri for upstream, lower priority than uri property", + "maxItems": 2, + "minItems": 2 + }, + "scheme": { + "type": "string", + "description": "new scheme for upstream", + "enum": ["http", "https"] + }, + "uri": { + "type": "string", + "description": "new uri for upstream", + "pattern": "^\\/.*", + "maxLength": 4096, + "minLength": 1 + }, + "headers": { + "minProperties": 1, + "type": "object", + "description": "new headers for request" + } + } + } + }, + "serverless-post-function": { + "schema": { + "type": "object", + "required": ["functions"], + "properties": { + "phase": { + "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"], + "type": "string" + }, + "functions": { + "items": { + "type": "string" + }, + "type": "array", + "minItems": 1 + } + } + } + }, + "ip-restriction": { + "schema": { + "oneOf": [{ + "additionalProperties": false, + "properties": { + "whitelist": { + "items": { + "anyOf": [{ + "type": "string", + "title": "IPv4", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + }, { + "type": "string", + "title": "IPv4/CIDR", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$" + }, { + "type": "string", + "title": "IPv6", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$" + }, { + "type": "string", + "title": "IPv6/CIDR", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$" + }] + }, + "type": "array", + "minItems": 1 + } + }, + "title": "whitelist", + "required": ["whitelist"] + }, { + "additionalProperties": false, + "properties": { + "blacklist": { + "items": { + "anyOf": [{ + "type": "string", + "title": "IPv4", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + }, { + "type": "string", + "title": "IPv4/CIDR", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$" + }, { + "type": "string", + "title": "IPv6", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$" + }, { + "type": "string", + "title": "IPv6/CIDR", + "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$" + }] + }, + "type": "array", + "minItems": 1 + } + }, + "title": "blacklist", + "required": ["blacklist"] + }], + "type": "object" + } + }, + "tcp-logger": { + "schema": { + "type": "object", + "required": ["host", "port"], + "properties": { + "tls": { + "default": false, + "type": "boolean" + }, + "timeout": { + "minimum": 1, + "type": "integer", + "default": 1000 + }, + "max_retry_count": { + "minimum": 0, + "type": "integer", + "default": 0 + }, + "include_req_body": { + "default": false, + "type": "boolean" + }, + "host": { + "type": "string" + }, + "port": { + "minimum": 0, + "type": "integer" + }, + "name": { + "default": "tcp logger", + "type": "string" + }, + "batch_max_size": { + "minimum": 1, + "type": "integer", + "default": 1000 + }, + "buffer_duration": { + "minimum": 1, + "type": "integer", + "default": 60 + }, + "retry_delay": { + "minimum": 0, + "type": "integer", + "default": 1 + }, + "inactive_timeout": { + "minimum": 1, + "type": "integer", + "default": 5 + }, + "tls_options": { + "type": "string" + } + } + } + }, + "cors": { + "schema": { + "properties": { + "allow_credential": { + "type": "boolean", + "description": "allow client append crendential. according to CORS specification,if you set this option to 'true', you can not use '*' for other options.", + "default": false + }, + "allow_headers": { + "type": "string", + "description": "you can use '*' to allow all header when no credentials,'**' to allow forcefully(it will bring some security risks, be carefully),multiple header use ',' to split. default: *.", + "default": "*" + }, + "allow_origins": { + "type": "string", + "description": "you can use '*' to allow all origins when no credentials,'**' to allow forcefully(it will bring some security risks, be carefully),multiple origin use ',' to split. default: *.", + "default": "*" + }, + "allow_methods": { + "type": "string", + "description": "you can use '*' to allow all methods when no credentials and '**','**' to allow forcefully(it will bring some security risks, be carefully),multiple method use ',' to split. default: *.", + "default": "*" + }, + "expose_headers": { + "type": "string", + "description": "you can use '*' to expose all header when no credentials,multiple header use ',' to split. default: *.", + "default": "*" + }, + "max_age": { + "type": "integer", + "description": "maximum number of seconds the results can be cached.-1 mean no cached,the max value is depend on browser,more detail plz check MDN. default: 5.", + "default": 5 + } + }, + "type": "object" + } + }, + "hmac-auth": { + "schema": { + "additionalProperties": false, + "type": "object", + "title": "work with route or service object", + "properties": {} + }, + "consumer_schema": { + "type": "object", + "title": "work with consumer object", + "properties": { + "signed_headers": { + "items": { + "type": "string", + "maxLength": 50, + "minLength": 1 + }, + "type": "array" + }, + "access_key": { + "type": "string", + "maxLength": 256, + "minLength": 1 + }, + "clock_skew": { + "default": 0, + "type": "integer" + }, + "algorithm": { + "type": "string", + "default": "hmac-sha256", + "enum": ["hmac-sha1", "hmac-sha256", "hmac-sha512"] + }, + "secret_key": { + "type": "string", + "maxLength": 256, + "minLength": 1 + }, + "keep_headers": { + "type": "boolean", + "title": "whether to keep the http request header", + "default": false + } + }, + "additionalProperties": false, + "required": ["access_key", "secret_key"] + } + }, + "grpc-transcode": { + "schema": { + "required": ["proto_id", "service", "method"], + "type": "object", + "additionalProperties": true, + "properties": { + "method": { + "description": "the method name in the grpc service.", + "type": "string" + }, + "proto_id": { + "anyOf": [{ + "maxLength": 64, + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$", + "minLength": 1 + }, { + "minimum": 1, + "type": "integer" + }] + }, + "pb_option": { + "items": { + "anyOf": [{ + "type": "string", + "description": "enum as result", + "enum": ["int64_as_number", "int64_as_string", "int64_as_hexstring"] + }, { + "type": "string", + "description": "int64 as result", + "enum": ["ienum_as_name", "enum_as_value"] + }, { + "type": "string", + "description": "default values option", + "enum": ["auto_default_values", "no_default_values", "use_default_values", "use_default_metatable"] + }, { + "type": "string", + "description": "hooks option", + "enum": ["enable_hooks", "disable_hooks"] + }], + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "service": { + "description": "the grpc service name", + "type": "string" + }, + "deadline": { + "type": "number", + "description": "deadline for grpc, millisecond", + "default": 0 + } + } + } + }, + "limit-count": { + "schema": { + "dependencies": { + "policy": { + "oneOf": [{ + "properties": { + "policy": { + "enum": ["local"] + } + } + }, { + "required": ["redis_host"], + "properties": { + "redis_timeout": { + "minimum": 1, + "type": "integer", + "default": 1000 + }, + "redis_host": { + "minLength": 2, + "type": "string" + }, + "policy": { + "enum": ["redis"] + }, + "redis_password": { + "minLength": 0, + "type": "string" + }, + "redis_port": { + "minimum": 1, + "type": "integer", + "default": 6379 + } + } + }, { + "required": ["redis_cluster_nodes"], + "properties": { + "redis_cluster_nodes": { + "items": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "type": "array", + "minItems": 2 + }, + "policy": { + "enum": ["redis-cluster"] + }, + "redis_password": { + "minLength": 0, + "type": "string" + }, + "redis_timeout": { + "minimum": 1, + "type": "integer", + "default": 1000 + } + } + }] + } + }, + "type": "object", + "required": ["count", "time_window", "key"], + "properties": { + "count": { + "minimum": 0, + "type": "integer" + }, + "rejected_code": { + "minimum": 200, + "type": "integer", + "default": 503, + "maximum": 600 + }, + "policy": { + "type": "string", + "default": "local", + "enum": ["local", "redis", "redis-cluster"] + }, + "time_window": { + "minimum": 0, + "type": "integer" + }, + "key": { + "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name", "service_id"], + "type": "string" + } + } + } + }, + "key-auth": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "consumer_schema": { + "required": ["key"], + "type": "object", + "additionalProperties": false, + "properties": { + "key": { + "type": "string" + } + } + } + }, + "authz-keycloak": { + "schema": { + "type": "object", + "required": ["token_endpoint"], + "properties": { + "keepalive": { + "default": true, + "type": "boolean" + }, + "grant_type": { + "type": "string", + "default": "urn:ietf:params:oauth:grant-type:uma-ticket", + "enum": ["urn:ietf:params:oauth:grant-type:uma-ticket"], + "maxLength": 100, + "minLength": 1 + }, + "timeout": { + "minimum": 1000, + "type": "integer", + "default": 3000 + }, + "policy_enforcement_mode": { + "type": "string", + "default": "ENFORCING", + "enum": ["ENFORCING", "PERMISSIVE"] + }, + "audience": { + "type": "string", + "maxLength": 100, + "minLength": 1 + }, + "permissions": { + "items": { + "type": "string", + "maxLength": 100, + "minLength": 1 + }, + "type": "array", + "uniqueItems": true + }, + "keepalive_timeout": { + "minimum": 1000, + "type": "integer", + "default": 60000 + }, + "ssl_verify": { + "default": true, + "type": "boolean" + }, + "keepalive_pool": { + "minimum": 1, + "type": "integer", + "default": 5 + }, + "token_endpoint": { + "type": "string", + "maxLength": 4096, + "minLength": 1 + } + } + } + }, + "wolf-rbac": { + "schema": { + "properties": { + "appid": { + "default": "unset", + "type": "string" + }, + "header_prefix": { + "default": "X-", + "type": "string" + }, + "server": { + "default": "http://127.0.0.1:10080", + "type": "string" + } + }, + "type": "object" + } + }, + "kafka-logger": { + "schema": { + "type": "object", + "required": ["broker_list", "kafka_topic", "key"], + "properties": { + "meta_format": { + "type": "string", + "default": "default", + "enum": ["default", "origin"] + }, + "timeout": { + "minimum": 1, + "type": "integer", + "default": 3 + }, + "max_retry_count": { + "minimum": 0, + "type": "integer", + "default": 0 + }, + "include_req_body": { + "default": false, + "type": "boolean" + }, + "batch_max_size": { + "minimum": 1, + "type": "integer", + "default": 1000 + }, + "inactive_timeout": { + "minimum": 1, + "type": "integer", + "default": 5 + }, + "key": { + "type": "string" + }, + "buffer_duration": { + "minimum": 1, + "type": "integer", + "default": 60 + }, + "kafka_topic": { + "type": "string" + }, + "retry_delay": { + "minimum": 0, + "type": "integer", + "default": 1 + }, + "broker_list": { + "type": "object" + }, + "name": { + "default": "kafka logger", + "type": "string" + } + } + } + }, + "openid-connect": { + "schema": { + "type": "object", + "required": ["client_id", "client_secret", "discovery"], + "properties": { + "logout_path": { + "type": "string" + }, + "introspection_endpoint_auth_method": { + "type": "string" + }, + "client_secret": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "introspection_endpoint": { + "type": "string" + }, + "discovery": { + "type": "string" + }, + "public_key": { + "type": "string" + }, + "ssl_verify": { + "type": "boolean" + }, + "redirect_uri": { + "type": "string" + }, + "realm": { + "type": "string" + }, + "bearer_only": { + "type": "boolean" + }, + "timeout": { + "minimum": 1, + "type": "integer" + }, + "token_signing_alg_values_expected": { + "type": "string" + }, + "client_id": { + "type": "string" + } + } + } + }, + "limit-conn": { + "schema": { + "type": "object", + "required": ["conn", "burst", "default_conn_delay", "key"], + "properties": { + "conn": { + "exclusiveMinimum": 0, + "type": "integer" + }, + "burst": { + "minimum": 0, + "type": "integer" + }, + "rejected_code": { + "minimum": 200, + "type": "integer", + "default": 503 + }, + "key": { + "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"], + "type": "string" + }, + "default_conn_delay": { + "exclusiveMinimum": 0, + "type": "number" + } + } + } + }, + "redirect": { + "schema": { + "oneOf": [{ + "required": ["uri"] + }, { + "required": ["http_to_https"] + }], + "type": "object", + "properties": { + "ret_code": { + "minimum": 200, + "type": "integer", + "default": 302 + }, + "uri": { + "minLength": 2, + "type": "string" + }, + "http_to_https": { + "type": "boolean" + } + } + } + }, + "echo": { + "schema": { + "minProperties": 1, + "type": "object", + "additionalProperties": false, + "properties": { + "before_body": { + "description": "body before the filter phase.", + "type": "string" + }, + "auth_value": { + "description": "auth value", + "type": "string" + }, + "headers": { + "minProperties": 1, + "type": "object", + "description": "new headers for response" + }, + "after_body": { + "description": "body after the modification of filter phase.", + "type": "string" + }, + "body": { + "description": "body to replace upstream response.", + "type": "string" + } + }, + "anyOf": [{ + "required": ["before_body"] + }, { + "required": ["body"] + }, { + "required": ["after_body"] + }] + } + }, + "proxy-cache": { + "schema": { + "type": "object", + "required": ["cache_zone"], + "properties": { + "no_cache": { + "items": { + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "cache_bypass": { + "items": { + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "cache_method": { + "items": { + "type": "string", + "description": "http method", + "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] + }, + "type": "array", + "default": ["GET", "HEAD"], + "minItems": 1, + "uniqueItems": true + }, + "cache_zone": { + "minLength": 1, + "type": "string" + }, + "hide_cache_headers": { + "default": false, + "type": "boolean" + }, + "cache_key": { + "items": { + "type": "string", + "description": "a key for caching", + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" + }, + "type": "array", + "minItems": 1, + "default": ["$host", "$request_uri"] + }, + "cache_http_status": { + "items": { + "minimum": 200, + "type": "integer", + "description": "http response status", + "maximum": 599 + }, + "type": "array", + "default": [200, 301, 404], + "minItems": 1, + "uniqueItems": true + } + } + } + }, + "udp-logger": { + "schema": { + "type": "object", + "required": ["host", "port"], + "properties": { + "host": { + "type": "string" + }, + "port": { + "minimum": 0, + "type": "integer" + }, + "timeout": { + "minimum": 1, + "type": "integer", + "default": 3 + }, + "include_req_body": { + "default": false, + "type": "boolean" + }, + "batch_max_size": { + "minimum": 1, + "type": "integer", + "default": 1000 + }, + "buffer_duration": { + "minimum": 1, + "type": "integer", + "default": 60 + }, + "inactive_timeout": { + "minimum": 1, + "type": "integer", + "default": 5 + }, + "name": { + "default": "udp logger", + "type": "string" + } + } + } + }, + "request-validation": { + "schema": { + "anyOf": [{ + "properties": { + "body_schema": { + "type": "object" + } + }, + "title": "Body schema", + "required": ["body_schema"] + }, { + "properties": { + "header_schema": { + "type": "object" + } + }, + "title": "Header schema", + "required": ["header_schema"] + }], + "type": "object" + } + }, + "consumer-restriction": { + "schema": { + "oneOf": [{ + "properties": { + "type": { + "type": "string", + "default": "consumer_name", + "enum": ["consumer_name", "service_id"] + }, + "rejected_code": { + "minimum": 200, + "type": "integer", + "default": 403 + }, + "blacklist": { + "items": { + "type": "string" + }, + "type": "array", + "minItems": 1 + } + }, + "title": "blacklist", + "required": ["blacklist"] + }, { + "properties": { + "type": { + "type": "string", + "default": "consumer_name", + "enum": ["consumer_name", "service_id"] + }, + "whitelist": { + "items": { + "type": "string" + }, + "type": "array", + "minItems": 1 + }, + "rejected_code": { + "minimum": 200, + "type": "integer", + "default": 403 + } + }, + "title": "whitelist", + "required": ["whitelist"] + }], + "type": "object" + } + }, + "response-rewrite": { + "schema": { + "minProperties": 1, + "type": "object", + "additionalProperties": false, + "properties": { + "status_code": { + "minimum": 200, + "type": "integer", + "description": "new status code for repsonse", + "maximum": 598 + }, + "body": { + "description": "new body for repsonse", + "type": "string" + }, + "body_base64": { + "type": "boolean", + "description": "whether new body for repsonse need base64 decode before return", + "default": false + }, + "headers": { + "minProperties": 1, + "type": "object", + "description": "new headers for repsonse" + } + } + } + }, + "syslog": { + "schema": { + "type": "object", + "required": ["host", "port"], + "properties": { + "tls": { + "default": false, + "type": "boolean" + }, + "drop_limit": { + "default": 1048576, + "type": "integer" + }, + "timeout": { + "minimum": 1, + "type": "integer", + "default": 3 + }, + "pool_size": { + "minimum": 5, + "type": "integer", + "default": 5 + }, + "sock_type": { + "type": "string", + "default": "tcp", + "enum": ["tcp", "udp"] + }, + "include_req_body": { + "default": false, + "type": "boolean" + }, + "host": { + "type": "string" + }, + "port": { + "type": "integer" + }, + "name": { + "default": "sys logger", + "type": "string" + }, + "buffer_duration": { + "minimum": 1, + "type": "integer", + "default": 60 + }, + "batch_max_size": { + "minimum": 1, + "type": "integer", + "default": 1000 + }, + "retry_interval": { + "minimum": 0, + "type": "integer", + "default": 1 + }, + "max_retry_times": { + "minimum": 1, + "type": "integer", + "default": 1 + }, + "flush_limit": { + "minimum": 1, + "type": "integer", + "default": 4096 + } + } + } + }, + "skywalking": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": { + "sample_ratio": { + "minimum": 1e-05, + "type": "number", + "default": 1, + "maximum": 1 + } + } + } + }, + "node-status": { + "schema": { + "additionalProperties": false, + "type": "object" + } + }, + "http-logger": { + "schema": { + "type": "object", + "required": ["uri"], + "properties": { + "timeout": { + "minimum": 1, + "type": "integer", + "default": 3 + }, + "max_retry_count": { + "minimum": 0, + "type": "integer", + "default": 0 + }, + "inactive_timeout": { + "minimum": 1, + "type": "integer", + "default": 5 + }, + "include_req_body": { + "default": false, + "type": "boolean" + }, + "batch_max_size": { + "minimum": 1, + "type": "integer", + "default": 1000 + }, + "name": { + "default": "http logger", + "type": "string" + }, + "concat_method": { + "type": "string", + "default": "json", + "enum": ["json", "new_line"] + }, + "auth_header": { + "default": "", + "type": "string" + }, + "retry_delay": { + "minimum": 0, + "type": "integer", + "default": 1 + }, + "uri": { + "type": "string" + }, + "buffer_duration": { + "minimum": 1, + "type": "integer", + "default": 60 + } + } + } + }, + "fault-injection": { + "schema": { + "minProperties": 1, + "type": "object", + "properties": { + "delay": { + "minProperties": 1, + "type": "object", + "properties": { + "percentage": { + "minimum": 0, + "type": "integer", + "maximum": 100 + }, + "duration": { + "minimum": 0, + "type": "number" + } + } + }, + "abort": { + "minProperties": 1, + "type": "object", + "properties": { + "percentage": { + "minimum": 0, + "type": "integer", + "maximum": 100 + }, + "http_status": { + "minimum": 200, + "type": "integer" + }, + "body": { + "minLength": 0, + "type": "string" + } + } + } + } + } + }, + "referer-restriction": { + "schema": { + "additionalProperties": false, + "type": "object", + "required": ["whitelist"], + "properties": { + "bypass_missing": { + "default": false, + "type": "boolean" + }, + "whitelist": { + "items": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "type": "array", + "minItems": 1 + } + } + } + }, + "uri-blocker": { + "schema": { + "type": "object", + "required": ["block_rules"], + "properties": { + "rejected_code": { + "minimum": 200, + "type": "integer", + "default": 403 + }, + "block_rules": { + "items": { + "type": "string", + "maxLength": 4096, + "minLength": 1 + }, + "type": "array", + "uniqueItems": true + } + } + } + }, + "serverless-pre-function": { + "schema": { + "type": "object", + "required": ["functions"], + "properties": { + "phase": { + "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"], + "type": "string" + }, + "functions": { + "items": { + "type": "string" + }, + "type": "array", + "minItems": 1 + } + } + } + }, + "proxy-mirror": { + "schema": { + "minProperties": 1, + "type": "object", + "required": ["host"], + "properties": { + "host": { + "pattern": "^http(s)?:\\/\\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:[0-9]{1,5})?$", + "type": "string" + } + } + } + }, + "basic-auth": { + "schema": { + "additionalProperties": false, + "type": "object", + "title": "work with route or service object", + "properties": {} + }, + "consumer_schema": { + "type": "object", + "title": "work with consumer object", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["username", "password"] + } + }, + "prometheus": { + "schema": { + "additionalProperties": false, + "type": "object" + } + }, + "example-plugin": { + "schema": { + "type": "object", + "required": ["i"], + "properties": { + "i": { + "minimum": 0, + "type": "number" + }, + "port": { + "type": "integer" + }, + "s": { + "type": "string" + }, + "t": { + "minItems": 1, + "type": "array" + }, + "ip": { + "type": "string" + } + } + } + }, + "log-rotate": { + "schema": { + "type": "object", + "additionalProperties": false, + "properties": {} + } + }, + "api-breaker": { + "schema": { + "type": "object", + "required": ["break_response_code"], + "properties": { + "max_breaker_sec": { + "minimum": 3, + "type": "integer", + "default": 300 + }, + "healthy": { + "type": "object", + "default": { + "http_statuses": [200], + "successes": 3 + }, + "properties": { + "http_statuses": { + "items": { + "minimum": 200, + "type": "integer", + "maximum": 499 + }, + "type": "array", + "default": [200], + "minItems": 1, + "uniqueItems": true + }, + "successes": { + "minimum": 1, + "type": "integer", + "default": 3 + } + } + }, + "break_response_code": { + "minimum": 200, + "type": "integer", + "maximum": 599 + }, + "unhealthy": { + "type": "object", + "default": { + "http_statuses": [500], + "failures": 3 + }, + "properties": { + "http_statuses": { + "items": { + "minimum": 500, + "type": "integer", + "maximum": 599 + }, + "type": "array", + "default": [500], + "minItems": 1, + "uniqueItems": true + }, + "failures": { + "minimum": 1, + "type": "integer", + "default": 3 + } + } + } + } + } + }, + "batch-requests": { + "schema": { + "additionalProperties": false, + "type": "object" + } + } + } +} \ No newline at end of file diff --git a/api/internal/core/entity/entity.go b/api/internal/core/entity/entity.go index c15a5d5a6b..93ae456abc 100644 --- a/api/internal/core/entity/entity.go +++ b/api/internal/core/entity/entity.go @@ -75,6 +75,7 @@ type Route struct { UpstreamID string `json:"upstream_id,omitempty"` ServiceProtocol string `json:"service_protocol,omitempty"` Labels map[string]string `json:"labels,omitempty"` + EnableWebsocket bool `json:"enable_websocket,omitempty"` } // --- structures for upstream start --- @@ -138,21 +139,20 @@ type HealthChecker struct { } type UpstreamDef struct { - Nodes interface{} `json:"nodes,omitempty"` - Retries int `json:"retries,omitempty"` - Timeout interface{} `json:"timeout,omitempty"` - K8sInfo interface{} `json:"k8s_deployment_info,omitempty"` - Type string `json:"type,omitempty"` - Checks interface{} `json:"checks,omitempty"` - HashOn string `json:"hash_on,omitempty"` - Key string `json:"key,omitempty"` - EnableWebsocket bool `json:"enable_websocket,omitempty"` - PassHost string `json:"pass_host,omitempty"` - UpstreamHost string `json:"upstream_host,omitempty"` - Name string `json:"name,omitempty"` - Desc string `json:"desc,omitempty"` - ServiceName string `json:"service_name,omitempty"` - Labels map[string]string `json:"labels,omitempty"` + Nodes interface{} `json:"nodes,omitempty"` + Retries int `json:"retries,omitempty"` + Timeout interface{} `json:"timeout,omitempty"` + K8sInfo interface{} `json:"k8s_deployment_info,omitempty"` + Type string `json:"type,omitempty"` + Checks interface{} `json:"checks,omitempty"` + HashOn string `json:"hash_on,omitempty"` + Key string `json:"key,omitempty"` + PassHost string `json:"pass_host,omitempty"` + UpstreamHost string `json:"upstream_host,omitempty"` + Name string `json:"name,omitempty"` + Desc string `json:"desc,omitempty"` + ServiceName string `json:"service_name,omitempty"` + Labels map[string]string `json:"labels,omitempty"` } type Upstream struct { @@ -200,13 +200,14 @@ type SSL struct { type Service struct { BaseInfo - Name string `json:"name,omitempty"` - Desc string `json:"desc,omitempty"` - Upstream *UpstreamDef `json:"upstream,omitempty"` - UpstreamID string `json:"upstream_id,omitempty"` - Plugins map[string]interface{} `json:"plugins,omitempty"` - Script string `json:"script,omitempty"` - Labels map[string]string `json:"labels,omitempty"` + Name string `json:"name,omitempty"` + Desc string `json:"desc,omitempty"` + Upstream *UpstreamDef `json:"upstream,omitempty"` + UpstreamID string `json:"upstream_id,omitempty"` + Plugins map[string]interface{} `json:"plugins,omitempty"` + Script string `json:"script,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + EnableWebsocket bool `json:"enable_websocket,omitempty"` } type Script struct { diff --git a/api/internal/core/store/validate.go b/api/internal/core/store/validate.go index b4f3bd1c4e..23f7154be0 100644 --- a/api/internal/core/store/validate.go +++ b/api/internal/core/store/validate.go @@ -22,12 +22,12 @@ import ( "io/ioutil" "regexp" - "github.com/shiningrush/droplet/log" "github.com/xeipuuv/gojsonschema" "go.uber.org/zap/buffer" "github.com/apisix/manager-api/conf" "github.com/apisix/manager-api/internal/core/entity" + "github.com/apisix/manager-api/log" ) type Validator interface { diff --git a/api/internal/handler/route/route_test.go b/api/internal/handler/route/route_test.go index d70fff3a80..00a86a3306 100644 --- a/api/internal/handler/route/route_test.go +++ b/api/internal/handler/route/route_test.go @@ -1098,17 +1098,18 @@ func Test_Route_With_Script(t *testing.T) { route2 := &UpdateInput{} route2.ID = "1" reqBody = `{ - "id": "1", - "uri": "/index.html", - "upstream": { - "type": "roundrobin", - "nodes": [{ - "host": "www.a.com", - "port": 80, - "weight": 1 - }] - } - }` + "id": "1", + "uri": "/index.html", + "enable_websocket": true, + "upstream": { + "type": "roundrobin", + "nodes": [{ + "host": "www.a.com", + "port": 80, + "weight": 1 + }] + } + }` err = json.Unmarshal([]byte(reqBody), route2) assert.Nil(t, err) diff --git a/api/internal/handler/service/service_test.go b/api/internal/handler/service/service_test.go index 12f9efd424..6f801c4a6d 100644 --- a/api/internal/handler/service/service_test.go +++ b/api/internal/handler/service/service_test.go @@ -95,6 +95,7 @@ func TestService(t *testing.T) { "key": "remote_addr" } }, + "enable_websocket": true, "upstream": { "type": "roundrobin", "nodes": [{ diff --git a/api/internal/handler/upstream/upstream_test.go b/api/internal/handler/upstream/upstream_test.go index f562c0de9f..c11089c0e2 100644 --- a/api/internal/handler/upstream/upstream_test.go +++ b/api/internal/handler/upstream/upstream_test.go @@ -62,7 +62,6 @@ func TestUpstream(t *testing.T) { "send":15, "read":15 }, - "enable_websocket": true, "hash_on": "header", "key": "server_addr", "checks": {