From 3646b8f14396bcb06063eaad16f3301036f665af Mon Sep 17 00:00:00 2001 From: liuxiran Date: Fri, 18 Dec 2020 10:01:06 +0800 Subject: [PATCH 1/4] debug --- api/build-tools/schema-sync.lua | 4 + api/conf/schema.json | 5635 ++++++++++++++++--------------- 2 files changed, 2847 insertions(+), 2792 deletions(-) diff --git a/api/build-tools/schema-sync.lua b/api/build-tools/schema-sync.lua index f0c49b3399..7e96e964e4 100644 --- a/api/build-tools/schema-sync.lua +++ b/api/build-tools/schema-sync.lua @@ -22,6 +22,8 @@ local fake_module_list = { 'cjson.safe', 'bit', 'lfs', + 'ngx.worker', + 'ngx.errlog', 'ngx.process', 'ngx.re', 'net.url', @@ -80,10 +82,12 @@ ngx.timer = {} ngx.location = {} ngx.socket = {} ngx.thread = {} +ngx.worker = {} ngx.re.gmatch = empty_function ngx.shared = { ["plugin-api-breaker"] = {} } +ngx.shared.internal_status = {} -- additional define for management local time_def = { diff --git a/api/conf/schema.json b/api/conf/schema.json index 855d620aa8..1b685dc787 100644 --- a/api/conf/schema.json +++ b/api/conf/schema.json @@ -1,2825 +1,2805 @@ { "main": { - "consumer": { + "proto": { "additionalProperties": false, "properties": { - "create_time": { + "content": { + "minLength": 1, + "type": "string", + "maxLength": 1048576 + } + }, + "type": "object", + "required": ["content"] + }, + "upstream_hash_header_schema": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_]+$" + }, + "ssl": { + "additionalProperties": false, + "properties": { + "validity_start": { "type": "integer" }, - "desc": { - "maxLength": 256, - "type": "string" + "keys": { + "type": "array", + "items": { + "minLength": 128, + "type": "string", + "maxLength": 65536 + } }, - "id": { - "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - }, { - "minimum": 1, - "type": "integer" - }] + "validity_end": { + "type": "integer" + }, + "certs": { + "type": "array", + "items": { + "minLength": 128, + "type": "string", + "maxLength": 65536 + } + }, + "snis": { + "type": "array", + "items": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + } + }, + "cert": { + "minLength": 128, + "type": "string", + "maxLength": 65536 }, "labels": { - "description": "key/value pairs to specify attributes", "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", "patternProperties": { ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", - "maxLength": 64, "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "maxLength": 64 } - }, - "type": "object" - }, - "plugins": { - "type": "object" - }, - "update_time": { - "type": "integer" + } }, - "username": { - "maxLength": 32, - "minLength": 1, - "pattern": "^[a-zA-Z0-9_]+$", - "type": "string" - } - }, - "required": ["username"], - "type": "object" - }, - "global_rule": { - "additionalProperties": false, - "properties": { "id": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }] }, - "plugins": { - "type": "object" + "update_time": { + "type": "integer" + }, + "create_time": { + "type": "integer" + }, + "status": { + "default": 1, + "description": "ssl status, 1 to enable, 0 to disable", + "type": "integer", + "enum": [1, 0] + }, + "exptime": { + "type": "integer", + "minimum": 1588262400 + }, + "sni": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "key": { + "minLength": 128, + "type": "string", + "maxLength": 65536 } }, - "required": ["plugins"], - "type": "object" - }, - "host_def": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" + "type": "object", + "oneOf": [{ + "required": ["sni", "key", "cert"] + }, { + "required": ["snis", "key", "cert"] + }] }, "id_schema": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }] }, - "ip_def": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "title": "IPv4", - "type": "string" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "title": "IPv4/CIDR", - "type": "string" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "title": "IPv6", - "type": "string" - }, { - "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}$", - "title": "IPv6/CIDR", - "type": "string" - }], - "label_value_def": { - "description": "value of label", - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - }, - "plugin_disable_schema": { - "disable": { - "type": "boolean" - } - }, - "plugins": { - "items": { - "properties": { - "additionalProperties": false, - "name": { - "minLength": 1, - "type": "string" - }, - "stream": { - "type": "boolean" - } - }, - "required": ["name"], - "type": "object" - }, - "type": "array" - }, - "proto": { - "additionalProperties": false, - "properties": { - "content": { - "maxLength": 1048576, - "minLength": 1, - "type": "string" - } - }, - "required": ["content"], - "type": "object" - }, - "route": { + "global_rule": { "additionalProperties": false, - "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"] - }], - "not": { - "anyOf": [{ - "required": ["plugins", "script"] - }] - }, "properties": { - "create_time": { - "type": "integer" - }, - "desc": { - "maxLength": 256, - "type": "string" - }, - "enable_websocket": { - "description": "enable websocket for request", - "type": "boolean" - }, - "filter_func": { - "minLength": 10, - "pattern": "^function", - "type": "string" - }, - "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "hosts": { - "items": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "type": "array", - "uniqueItems": true + "plugins": { + "type": "object" }, "id": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }] - }, + } + }, + "type": "object", + "required": ["plugins"] + }, + "consumer": { + "additionalProperties": false, + "properties": { "labels": { - "description": "key/value pairs to specify attributes", "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", "patternProperties": { ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", - "maxLength": 64, "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "maxLength": 64 } - }, - "type": "object" + } }, - "methods": { - "items": { - "description": "HTTP method", - "enum": ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"], - "type": "string" - }, - "type": "array", - "uniqueItems": true + "id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] }, - "name": { - "maxLength": 100, + "username": { + "pattern": "^[a-zA-Z0-9_]+$", "minLength": 1, - "type": "string" + "type": "string", + "maxLength": 32 + }, + "desc": { + "type": "string", + "maxLength": 256 }, "plugins": { "type": "object" }, - "priority": { - "default": 0, + "update_time": { "type": "integer" }, - "remote_addr": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "title": "IPv4", - "type": "string" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "title": "IPv4/CIDR", - "type": "string" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "title": "IPv6", - "type": "string" - }, { - "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}$", - "title": "IPv6/CIDR", - "type": "string" - }], - "description": "client IP", - "type": "string" - }, - "remote_addrs": { - "items": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "title": "IPv4", - "type": "string" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "title": "IPv4/CIDR", - "type": "string" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "title": "IPv6", - "type": "string" - }, { - "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}$", - "title": "IPv6/CIDR", - "type": "string" - }], - "description": "client IP", - "type": "string" - }, - "type": "array", - "uniqueItems": true - }, - "script": { - "maxLength": 102400, - "minLength": 10, - "type": "string" - }, - "service_id": { - "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - }, { - "minimum": 1, - "type": "integer" - }] - }, - "service_protocol": { - "enum": ["grpc", "http"] - }, - "update_time": { - "type": "integer" + "create_time": { + "type": "integer" + } + }, + "type": "object", + "required": ["username"] + }, + "service": { + "properties": { + "enable_websocket": { + "type": "boolean", + "description": "enable websocket for request" }, "upstream": { "additionalProperties": false, - "anyOf": [{ - "required": ["nodes", "type"] - }, { - "required": ["k8s_deployment_info", "type"] - }, { - "required": ["service_name", "type"] - }], "properties": { - "checks": { - "additionalProperties": false, + "retries": { + "type": "integer", + "minimum": 0 + }, + "type": { + "description": "algorithms of load balancing", + "type": "string", + "enum": ["chash", "roundrobin", "ewma"] + }, + "hash_on": { + "default": "vars", + "type": "string", + "enum": ["vars", "header", "cookie", "consumer"] + }, + "k8s_deployment_info": { + "properties": { + "deploy_name": { + "type": "string", + "description": "k8s deployment name" + }, + "namespace": { + "type": "string", + "description": "k8s namespace" + }, + "service_name": { + "type": "string", + "description": "k8s service name" + }, + "port": { + "type": "number", + "minimum": 0 + }, + "backend_type": { + "enum": ["svc", "pod"], + "default": "pod", + "type": "string", + "description": "k8s service name" + } + }, + "type": "object", "anyOf": [{ - "required": ["active"] + "required": ["namespace", "deploy_name", "port"] }, { - "required": ["active", "passive"] - }], - "properties": { - "active": { + "required": ["namespace", "service_name", "port"] + }] + }, + "create_time": { + "type": "integer" + }, + "upstream_host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "service_name": { + "minLength": 1, + "type": "string", + "maxLength": 100 + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + } + } + }, { + "minItems": 1, + "type": "array", + "items": { "properties": { - "concurrency": { - "default": 10, - "type": "integer" + "host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" }, + "weight": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + }, + "metadata": { + "type": "object", + "description": "metadata of node" + }, + "port": { + "description": "port of node", + "type": "integer", + "minimum": 1 + } + }, + "type": "object", + "required": ["host", "port", "weight"] + } + }] + }, + "key": { + "type": "string", + "description": "the key of chash for dynamic load balancing" + }, + "enable_websocket": { + "type": "boolean", + "description": "enable websocket for request" + }, + "checks": { + "additionalProperties": false, + "properties": { + "passive": { + "type": "object", + "properties": { "healthy": { + "type": "object", "properties": { + "successes": { + "maximum": 254, + "default": 5, + "type": "integer", + "minimum": 1 + }, "http_statuses": { - "default": [200, 302], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "type": "array", + "minItems": 1, "uniqueItems": true + } + } + }, + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] + }, + "unhealthy": { + "type": "object", + "properties": { + "timeouts": { + "maximum": 254, + "default": 7, + "type": "integer", + "minimum": 1 }, - "interval": { - "default": 0, - "minimum": 1, - "type": "integer" - }, - "successes": { + "tcp_failures": { + "maximum": 254, "default": 2, + "type": "integer", + "minimum": 1 + }, + "http_failures": { "maximum": 254, - "minimum": 1, - "type": "integer" + "default": 5, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 200 + }, + "default": [429, 500, 503], + "type": "array", + "minItems": 1, + "uniqueItems": true } - }, - "type": "object" - }, + } + } + } + }, + "active": { + "type": "object", + "properties": { "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" }, - "http_path": { - "default": "/", - "type": "string" - }, - "https_verify_certificate": { - "default": true, - "type": "boolean" + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] }, "port": { "maximum": 65535, - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }, "req_headers": { + "minItems": 1, + "type": "array", "items": { "type": "string", "uniqueItems": true - }, - "minItems": 1, - "type": "array" + } }, "timeout": { - "default": 1, - "type": "number" + "type": "number", + "default": 1 }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" + "concurrency": { + "type": "integer", + "default": 10 }, - "unhealthy": { + "https_verify_certificate": { + "type": "boolean", + "default": true + }, + "healthy": { + "type": "object", "properties": { - "http_failures": { - "default": 5, + "successes": { "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "http_statuses": { - "default": [404, 429, 500, 501, 502, 503, 504, 505], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true + "default": 2, + "type": "integer", + "minimum": 1 }, "interval": { "default": 0, - "minimum": 1, - "type": "integer" - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }, - "timeouts": { - "default": 3, - "maximum": 254, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "passive": { - "properties": { - "healthy": { - "properties": { "http_statuses": { - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [200, 302], "type": "array", + "minItems": 1, "uniqueItems": true - }, - "successes": { - "default": 5, - "maximum": 254, - "minimum": 1, - "type": "integer" } - }, - "type": "object" + } }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" + "http_path": { + "type": "string", + "default": "\/" }, "unhealthy": { + "type": "object", "properties": { "http_failures": { + "maximum": 254, "default": 5, + "type": "integer", + "minimum": 1 + }, + "timeouts": { + "maximum": 254, + "default": 3, + "type": "integer", + "minimum": 1 + }, + "tcp_failures": { "maximum": 254, - "minimum": 1, - "type": "integer" + "default": 2, + "type": "integer", + "minimum": 1 + }, + "interval": { + "default": 0, + "type": "integer", + "minimum": 1 }, "http_statuses": { - "default": [429, 500, 503], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [429, 404, 500, 501, 502, 503, 504, 505], "type": "array", + "minItems": 1, "uniqueItems": true - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "timeouts": { - "default": 7, - "maximum": 254, - "minimum": 1, - "type": "integer" } - }, - "type": "object" + } } - }, - "type": "object" + } } }, - "type": "object" + "type": "object", + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }] }, - "create_time": { + "update_time": { "type": "integer" }, - "desc": { - "maxLength": 256, - "type": "string" - }, - "discovery_type": { - "description": "discovery type", - "type": "string" - }, - "enable_websocket": { - "description": "enable websocket for request", - "type": "boolean" - }, - "hash_on": { - "default": "vars", - "enum": ["consumer", "cookie", "header", "vars"], - "type": "string" + "labels": { + "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", + "patternProperties": { + ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", + "description": "value of label", + "minLength": 1, + "maxLength": 64 + } + } }, "id": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }] }, - "k8s_deployment_info": { - "anyOf": [{ - "required": ["deploy_name", "namespace", "port"] - }, { - "required": ["namespace", "port", "service_name"] - }], - "properties": { - "backend_type": { - "default": "pod", - "description": "k8s service name", - "enum": ["pod", "svc"], - "type": "string" - }, - "deploy_name": { - "description": "k8s deployment name", - "type": "string" - }, - "namespace": { - "description": "k8s namespace", - "type": "string" - }, - "port": { - "minimum": 0, - "type": "number" - }, - "service_name": { - "description": "k8s service name", - "type": "string" - } - }, - "type": "object" - }, - "key": { - "description": "the key of chash for dynamic load balancing", - "type": "string" + "desc": { + "type": "string", + "maxLength": 256 }, - "labels": { - "description": "key/value pairs to specify attributes", - "maxProperties": 16, - "patternProperties": { - ".*": { - "description": "value of label", - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - } - }, - "type": "object" + "discovery_type": { + "type": "string", + "description": "discovery type" }, "name": { - "maxLength": 100, "minLength": 1, - "type": "string" - }, - "nodes": { - "anyOf": [{ - "minProperties": 1, - "patternProperties": { - ".*": { - "description": "weight of node", - "minimum": 0, - "type": "integer" - } - }, - "type": "object" - }, { - "items": { - "properties": { - "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "metadata": { - "description": "metadata of node", - "type": "object" - }, - "port": { - "description": "port of node", - "minimum": 1, - "type": "integer" - }, - "weight": { - "description": "weight of node", - "minimum": 0, - "type": "integer" - } - }, - "required": ["host", "port", "weight"], - "type": "object" - }, - "minItems": 1, - "type": "array" - }] + "type": "string", + "maxLength": 100 }, "pass_host": { "default": "pass", "description": "mod of host passing", - "enum": ["node", "pass", "rewrite"], - "type": "string" - }, - "retries": { - "minimum": 0, - "type": "integer" - }, - "service_name": { - "maxLength": 100, - "minLength": 1, - "type": "string" + "type": "string", + "enum": ["pass", "node", "rewrite"] }, "timeout": { "properties": { "connect": { - "minimum": 0, - "type": "number" + "type": "number", + "minimum": 0 }, "read": { - "minimum": 0, - "type": "number" + "type": "number", + "minimum": 0 }, "send": { - "minimum": 0, - "type": "number" + "type": "number", + "minimum": 0 } }, - "required": ["connect", "read", "send"], - "type": "object" - }, - "type": { - "description": "algorithms of load balancing", - "enum": ["chash", "ewma", "roundrobin"], - "type": "string" - }, - "update_time": { - "type": "integer" - }, - "upstream_host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" + "type": "object", + "required": ["connect", "send", "read"] } }, - "type": "object" - }, - "upstream_id": { + "type": "object", "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "required": ["type", "nodes"] }, { - "minimum": 1, - "type": "integer" + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] }] }, - "uri": { - "maxLength": 4096, - "minLength": 1, - "type": "string" - }, - "uris": { - "items": { - "description": "HTTP uri", - "type": "string" - }, - "type": "array", - "uniqueItems": true + "script": { + "minLength": 10, + "type": "string", + "maxLength": 102400 }, - "vars": { - "items": { - "description": "Nginx builtin variable name and value", - "items": { - "anyOf": [{ - "type": "string" - }, { - "type": "number" - }], - "maxItems": 3, - "minItems": 2 - }, - "type": "array" - }, - "type": "array" - } - }, - "type": "object" - }, - "service": { - "additionalProperties": false, - "properties": { - "create_time": { + "update_time": { "type": "integer" }, - "desc": { - "maxLength": 256, - "type": "string" - }, - "enable_websocket": { - "description": "enable websocket for request", - "type": "boolean" - }, - "id": { + "upstream_id": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }] }, "labels": { - "description": "key/value pairs to specify attributes", "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", "patternProperties": { ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", - "maxLength": 64, "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "maxLength": 64 } - }, + } + }, + "id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] + }, + "create_time": { + "type": "integer" + }, + "plugins": { "type": "object" }, + "desc": { + "type": "string", + "maxLength": 256 + }, "name": { - "maxLength": 100, "minLength": 1, - "type": "string" + "type": "string", + "maxLength": 100 + } + }, + "type": "object", + "additionalProperties": false + }, + "stream_route": { + "type": "object", + "properties": { + "remote_addr": { + "description": "client IP", + "type": "string", + "anyOf": [{ + "title": "IPv4", + "type": "string", + "format": "ipv4" + }, { + "title": "IPv4\/CIDR", + "type": "string", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + }, { + "title": "IPv6", + "type": "string", + "format": "ipv6" + }, { + "title": "IPv6\/CIDR", + "type": "string", + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" + }] + }, + "id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] + }, + "server_addr": { + "description": "server IP", + "type": "string", + "anyOf": [{ + "title": "IPv4", + "type": "string", + "format": "ipv4" + }, { + "title": "IPv4\/CIDR", + "type": "string", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + }, { + "title": "IPv6", + "type": "string", + "format": "ipv6" + }, { + "title": "IPv6\/CIDR", + "type": "string", + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" + }] }, "plugins": { "type": "object" }, - "script": { - "maxLength": 102400, - "minLength": 10, - "type": "string" - }, - "update_time": { - "type": "integer" + "server_port": { + "type": "integer", + "description": "server port" }, "upstream": { "additionalProperties": false, - "anyOf": [{ - "required": ["nodes", "type"] - }, { - "required": ["k8s_deployment_info", "type"] - }, { - "required": ["service_name", "type"] - }], "properties": { - "checks": { - "additionalProperties": false, + "retries": { + "type": "integer", + "minimum": 0 + }, + "type": { + "description": "algorithms of load balancing", + "type": "string", + "enum": ["chash", "roundrobin", "ewma"] + }, + "hash_on": { + "default": "vars", + "type": "string", + "enum": ["vars", "header", "cookie", "consumer"] + }, + "k8s_deployment_info": { + "properties": { + "deploy_name": { + "type": "string", + "description": "k8s deployment name" + }, + "namespace": { + "type": "string", + "description": "k8s namespace" + }, + "service_name": { + "type": "string", + "description": "k8s service name" + }, + "port": { + "type": "number", + "minimum": 0 + }, + "backend_type": { + "enum": ["svc", "pod"], + "default": "pod", + "type": "string", + "description": "k8s service name" + } + }, + "type": "object", "anyOf": [{ - "required": ["active"] + "required": ["namespace", "deploy_name", "port"] }, { - "required": ["active", "passive"] - }], - "properties": { - "active": { + "required": ["namespace", "service_name", "port"] + }] + }, + "create_time": { + "type": "integer" + }, + "upstream_host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "service_name": { + "minLength": 1, + "type": "string", + "maxLength": 100 + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + } + } + }, { + "minItems": 1, + "type": "array", + "items": { "properties": { - "concurrency": { - "default": 10, - "type": "integer" + "host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "weight": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + }, + "metadata": { + "type": "object", + "description": "metadata of node" }, + "port": { + "description": "port of node", + "type": "integer", + "minimum": 1 + } + }, + "type": "object", + "required": ["host", "port", "weight"] + } + }] + }, + "key": { + "type": "string", + "description": "the key of chash for dynamic load balancing" + }, + "enable_websocket": { + "type": "boolean", + "description": "enable websocket for request" + }, + "checks": { + "additionalProperties": false, + "properties": { + "passive": { + "type": "object", + "properties": { "healthy": { + "type": "object", "properties": { + "successes": { + "maximum": 254, + "default": 5, + "type": "integer", + "minimum": 1 + }, "http_statuses": { - "default": [200, 302], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "type": "array", + "minItems": 1, "uniqueItems": true + } + } + }, + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] + }, + "unhealthy": { + "type": "object", + "properties": { + "timeouts": { + "maximum": 254, + "default": 7, + "type": "integer", + "minimum": 1 }, - "interval": { - "default": 0, - "minimum": 1, - "type": "integer" - }, - "successes": { + "tcp_failures": { + "maximum": 254, "default": 2, + "type": "integer", + "minimum": 1 + }, + "http_failures": { "maximum": 254, - "minimum": 1, - "type": "integer" + "default": 5, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 200 + }, + "default": [429, 500, 503], + "type": "array", + "minItems": 1, + "uniqueItems": true } - }, - "type": "object" - }, + } + } + } + }, + "active": { + "type": "object", + "properties": { "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "http_path": { - "default": "/", - "type": "string" + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" }, - "https_verify_certificate": { - "default": true, - "type": "boolean" + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] }, "port": { "maximum": 65535, - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }, "req_headers": { + "minItems": 1, + "type": "array", "items": { "type": "string", "uniqueItems": true - }, - "minItems": 1, - "type": "array" + } }, "timeout": { - "default": 1, - "type": "number" + "type": "number", + "default": 1 }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" + "concurrency": { + "type": "integer", + "default": 10 }, - "unhealthy": { + "https_verify_certificate": { + "type": "boolean", + "default": true + }, + "healthy": { + "type": "object", "properties": { - "http_failures": { - "default": 5, + "successes": { "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "http_statuses": { - "default": [404, 429, 500, 501, 502, 503, 504, 505], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true + "default": 2, + "type": "integer", + "minimum": 1 }, "interval": { "default": 0, - "minimum": 1, - "type": "integer" - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }, - "timeouts": { - "default": 3, - "maximum": 254, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "passive": { - "properties": { - "healthy": { - "properties": { "http_statuses": { - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [200, 302], "type": "array", + "minItems": 1, "uniqueItems": true - }, - "successes": { - "default": 5, - "maximum": 254, - "minimum": 1, - "type": "integer" } - }, - "type": "object" + } }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" + "http_path": { + "type": "string", + "default": "\/" }, "unhealthy": { + "type": "object", "properties": { "http_failures": { + "maximum": 254, "default": 5, + "type": "integer", + "minimum": 1 + }, + "timeouts": { + "maximum": 254, + "default": 3, + "type": "integer", + "minimum": 1 + }, + "tcp_failures": { "maximum": 254, - "minimum": 1, - "type": "integer" + "default": 2, + "type": "integer", + "minimum": 1 + }, + "interval": { + "default": 0, + "type": "integer", + "minimum": 1 }, "http_statuses": { - "default": [429, 500, 503], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [429, 404, 500, 501, 502, 503, 504, 505], "type": "array", + "minItems": 1, "uniqueItems": true - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "timeouts": { - "default": 7, - "maximum": 254, - "minimum": 1, - "type": "integer" } - }, - "type": "object" + } } - }, - "type": "object" + } } }, - "type": "object" - }, - "create_time": { - "type": "integer" - }, - "desc": { - "maxLength": 256, - "type": "string" - }, - "discovery_type": { - "description": "discovery type", - "type": "string" - }, - "enable_websocket": { - "description": "enable websocket for request", - "type": "boolean" - }, - "hash_on": { - "default": "vars", - "enum": ["consumer", "cookie", "header", "vars"], - "type": "string" - }, - "id": { + "type": "object", "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "required": ["active"] }, { - "minimum": 1, - "type": "integer" + "required": ["active", "passive"] }] }, - "k8s_deployment_info": { - "anyOf": [{ - "required": ["deploy_name", "namespace", "port"] - }, { - "required": ["namespace", "port", "service_name"] - }], - "properties": { - "backend_type": { - "default": "pod", - "description": "k8s service name", - "enum": ["pod", "svc"], - "type": "string" - }, - "deploy_name": { - "description": "k8s deployment name", - "type": "string" - }, - "namespace": { - "description": "k8s namespace", - "type": "string" - }, - "port": { - "minimum": 0, - "type": "number" - }, - "service_name": { - "description": "k8s service name", - "type": "string" - } - }, - "type": "object" - }, - "key": { - "description": "the key of chash for dynamic load balancing", - "type": "string" + "update_time": { + "type": "integer" }, "labels": { - "description": "key/value pairs to specify attributes", "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", "patternProperties": { ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", - "maxLength": 64, "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "maxLength": 64 } - }, - "type": "object" - }, - "name": { - "maxLength": 100, - "minLength": 1, - "type": "string" + } }, - "nodes": { + "id": { "anyOf": [{ - "minProperties": 1, - "patternProperties": { - ".*": { - "description": "weight of node", - "minimum": 0, - "type": "integer" - } - }, - "type": "object" + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "items": { - "properties": { - "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "metadata": { - "description": "metadata of node", - "type": "object" - }, - "port": { - "description": "port of node", - "minimum": 1, - "type": "integer" - }, - "weight": { - "description": "weight of node", - "minimum": 0, - "type": "integer" - } - }, - "required": ["host", "port", "weight"], - "type": "object" - }, - "minItems": 1, - "type": "array" + "type": "integer", + "minimum": 1 }] }, - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "enum": ["node", "pass", "rewrite"], - "type": "string" + "desc": { + "type": "string", + "maxLength": 256 }, - "retries": { - "minimum": 0, - "type": "integer" + "discovery_type": { + "type": "string", + "description": "discovery type" }, - "service_name": { - "maxLength": 100, + "name": { "minLength": 1, - "type": "string" + "type": "string", + "maxLength": 100 + }, + "pass_host": { + "default": "pass", + "description": "mod of host passing", + "type": "string", + "enum": ["pass", "node", "rewrite"] }, "timeout": { "properties": { "connect": { - "minimum": 0, - "type": "number" + "type": "number", + "minimum": 0 }, "read": { - "minimum": 0, - "type": "number" + "type": "number", + "minimum": 0 }, "send": { - "minimum": 0, - "type": "number" + "type": "number", + "minimum": 0 } }, - "required": ["connect", "read", "send"], - "type": "object" - }, - "type": { - "description": "algorithms of load balancing", - "enum": ["chash", "ewma", "roundrobin"], - "type": "string" - }, - "update_time": { - "type": "integer" - }, - "upstream_host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" + "type": "object", + "required": ["connect", "send", "read"] } }, - "type": "object" + "type": "object", + "anyOf": [{ + "required": ["type", "nodes"] + }, { + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] + }] }, "upstream_id": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }] } - }, - "type": "object" + } }, - "ssl": { + "label_value_def": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", + "description": "value of label", + "minLength": 1, + "maxLength": 64 + }, + "version": 0.5, + "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_-]+)$" + }, + "upstream": { "additionalProperties": false, - "oneOf": [{ - "required": ["cert", "key", "sni"] - }, { - "required": ["cert", "key", "snis"] - }], "properties": { - "cert": { - "maxLength": 65536, - "minLength": 128, - "type": "string" - }, - "certs": { - "items": { - "maxLength": 65536, - "minLength": 128, - "type": "string" - }, - "type": "array" + "retries": { + "type": "integer", + "minimum": 0 }, - "create_time": { - "type": "integer" + "type": { + "description": "algorithms of load balancing", + "type": "string", + "enum": ["chash", "roundrobin", "ewma"] }, - "exptime": { - "minimum": 1588262400, - "type": "integer" + "hash_on": { + "default": "vars", + "type": "string", + "enum": ["vars", "header", "cookie", "consumer"] }, - "id": { + "k8s_deployment_info": { + "properties": { + "deploy_name": { + "type": "string", + "description": "k8s deployment name" + }, + "namespace": { + "type": "string", + "description": "k8s namespace" + }, + "service_name": { + "type": "string", + "description": "k8s service name" + }, + "port": { + "type": "number", + "minimum": 0 + }, + "backend_type": { + "enum": ["svc", "pod"], + "default": "pod", + "type": "string", + "description": "k8s service name" + } + }, + "type": "object", "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "required": ["namespace", "deploy_name", "port"] }, { - "minimum": 1, - "type": "integer" + "required": ["namespace", "service_name", "port"] }] }, - "key": { - "maxLength": 65536, - "minLength": 128, - "type": "string" - }, - "keys": { - "items": { - "maxLength": 65536, - "minLength": 128, - "type": "string" - }, - "type": "array" - }, - "labels": { - "description": "key/value pairs to specify attributes", - "maxProperties": 16, - "patternProperties": { - ".*": { - "description": "value of label", - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - } - }, - "type": "object" - }, - "sni": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "snis": { - "items": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "type": "array" - }, - "status": { - "default": 1, - "description": "ssl status, 1 to enable, 0 to disable", - "enum": [0, 1], + "create_time": { "type": "integer" }, - "update_time": { - "type": "integer" + "upstream_host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" }, - "validity_end": { - "type": "integer" + "service_name": { + "minLength": 1, + "type": "string", + "maxLength": 100 }, - "validity_start": { - "type": "integer" - } - }, - "type": "object" - }, - "stream_route": { - "properties": { - "id": { + "nodes": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + } + } }, { - "minimum": 1, - "type": "integer" + "minItems": 1, + "type": "array", + "items": { + "properties": { + "host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "weight": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + }, + "metadata": { + "type": "object", + "description": "metadata of node" + }, + "port": { + "description": "port of node", + "type": "integer", + "minimum": 1 + } + }, + "type": "object", + "required": ["host", "port", "weight"] + } }] }, - "plugins": { - "type": "object" - }, - "remote_addr": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "title": "IPv4", - "type": "string" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "title": "IPv4/CIDR", - "type": "string" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "title": "IPv6", - "type": "string" - }, { - "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}$", - "title": "IPv6/CIDR", - "type": "string" - }], - "description": "client IP", - "type": "string" - }, - "server_addr": { - "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "title": "IPv4", - "type": "string" - }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "title": "IPv4/CIDR", - "type": "string" - }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", - "title": "IPv6", - "type": "string" - }, { - "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}$", - "title": "IPv6/CIDR", - "type": "string" - }], - "description": "server IP", - "type": "string" + "key": { + "type": "string", + "description": "the key of chash for dynamic load balancing" }, - "server_port": { - "description": "server port", - "type": "integer" + "enable_websocket": { + "type": "boolean", + "description": "enable websocket for request" }, - "upstream": { + "checks": { "additionalProperties": false, - "anyOf": [{ - "required": ["nodes", "type"] - }, { - "required": ["k8s_deployment_info", "type"] - }, { - "required": ["service_name", "type"] - }], "properties": { - "checks": { - "additionalProperties": false, - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }], + "passive": { + "type": "object", "properties": { - "active": { + "healthy": { + "type": "object", "properties": { - "concurrency": { - "default": 10, - "type": "integer" - }, - "healthy": { - "properties": { - "http_statuses": { - "default": [200, 302], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "interval": { - "default": 0, - "minimum": 1, - "type": "integer" - }, - "successes": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" - }, - "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "http_path": { - "default": "/", - "type": "string" - }, - "https_verify_certificate": { - "default": true, - "type": "boolean" - }, - "port": { - "maximum": 65535, - "minimum": 1, - "type": "integer" + "successes": { + "maximum": 254, + "default": 5, + "type": "integer", + "minimum": 1 }, - "req_headers": { + "http_statuses": { "items": { - "type": "string", - "uniqueItems": true + "maximum": 599, + "type": "integer", + "minimum": 200 }, + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "type": "array", "minItems": 1, - "type": "array" + "uniqueItems": true + } + } + }, + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] + }, + "unhealthy": { + "type": "object", + "properties": { + "timeouts": { + "maximum": 254, + "default": 7, + "type": "integer", + "minimum": 1 }, - "timeout": { - "default": 1, - "type": "number" + "tcp_failures": { + "maximum": 254, + "default": 2, + "type": "integer", + "minimum": 1 }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" + "http_failures": { + "maximum": 254, + "default": 5, + "type": "integer", + "minimum": 1 }, - "unhealthy": { - "properties": { - "http_failures": { - "default": 5, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "http_statuses": { - "default": [404, 429, 500, 501, 502, 503, 504, 505], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "interval": { - "default": 0, - "minimum": 1, - "type": "integer" - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "timeouts": { - "default": 3, - "maximum": 254, - "minimum": 1, - "type": "integer" - } + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 200 }, - "type": "object" + "default": [429, 500, 503], + "type": "array", + "minItems": 1, + "uniqueItems": true } - }, - "type": "object" + } + } + } + }, + "active": { + "type": "object", + "properties": { + "host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" }, - "passive": { - "properties": { - "healthy": { - "properties": { - "http_statuses": { - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "successes": { - "default": 5, - "maximum": 254, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" - }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" - }, - "unhealthy": { - "properties": { - "http_failures": { - "default": 5, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "http_statuses": { - "default": [429, 500, 503], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "timeouts": { - "default": 7, - "maximum": 254, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "create_time": { - "type": "integer" - }, - "desc": { - "maxLength": 256, - "type": "string" - }, - "discovery_type": { - "description": "discovery type", - "type": "string" - }, - "enable_websocket": { - "description": "enable websocket for request", - "type": "boolean" - }, - "hash_on": { - "default": "vars", - "enum": ["consumer", "cookie", "header", "vars"], - "type": "string" - }, - "id": { - "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - }, { - "minimum": 1, - "type": "integer" - }] - }, - "k8s_deployment_info": { - "anyOf": [{ - "required": ["deploy_name", "namespace", "port"] - }, { - "required": ["namespace", "port", "service_name"] - }], - "properties": { - "backend_type": { - "default": "pod", - "description": "k8s service name", - "enum": ["pod", "svc"], - "type": "string" - }, - "deploy_name": { - "description": "k8s deployment name", - "type": "string" - }, - "namespace": { - "description": "k8s namespace", - "type": "string" + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] }, "port": { - "minimum": 0, - "type": "number" + "maximum": 65535, + "type": "integer", + "minimum": 1 }, - "service_name": { - "description": "k8s service name", - "type": "string" - } - }, - "type": "object" - }, - "key": { - "description": "the key of chash for dynamic load balancing", - "type": "string" - }, - "labels": { - "description": "key/value pairs to specify attributes", - "maxProperties": 16, - "patternProperties": { - ".*": { - "description": "value of label", - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - } - }, - "type": "object" - }, - "name": { - "maxLength": 100, - "minLength": 1, - "type": "string" - }, - "nodes": { - "anyOf": [{ - "minProperties": 1, - "patternProperties": { - ".*": { - "description": "weight of node", - "minimum": 0, - "type": "integer" + "req_headers": { + "minItems": 1, + "type": "array", + "items": { + "type": "string", + "uniqueItems": true } }, - "type": "object" - }, { - "items": { - "properties": { - "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "metadata": { - "description": "metadata of node", - "type": "object" - }, - "port": { - "description": "port of node", - "minimum": 1, - "type": "integer" - }, - "weight": { - "description": "weight of node", - "minimum": 0, - "type": "integer" - } - }, - "required": ["host", "port", "weight"], - "type": "object" - }, - "minItems": 1, - "type": "array" - }] - }, - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "enum": ["node", "pass", "rewrite"], - "type": "string" - }, - "retries": { - "minimum": 0, - "type": "integer" - }, - "service_name": { - "maxLength": 100, - "minLength": 1, - "type": "string" - }, - "timeout": { - "properties": { - "connect": { - "minimum": 0, - "type": "number" - }, - "read": { - "minimum": 0, - "type": "number" + "timeout": { + "type": "number", + "default": 1 }, - "send": { - "minimum": 0, - "type": "number" - } - }, - "required": ["connect", "read", "send"], - "type": "object" - }, - "type": { - "description": "algorithms of load balancing", - "enum": ["chash", "ewma", "roundrobin"], - "type": "string" - }, - "update_time": { - "type": "integer" - }, - "upstream_host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - } - }, - "type": "object" - }, - "upstream_id": { - "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - }, { - "minimum": 1, - "type": "integer" - }] - } - }, - "type": "object" - }, - "upstream": { - "additionalProperties": false, - "anyOf": [{ - "required": ["nodes", "type"] - }, { - "required": ["k8s_deployment_info", "type"] - }, { - "required": ["service_name", "type"] - }], - "properties": { - "checks": { - "additionalProperties": false, - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }], - "properties": { - "active": { - "properties": { "concurrency": { - "default": 10, - "type": "integer" + "type": "integer", + "default": 10 + }, + "https_verify_certificate": { + "type": "boolean", + "default": true }, "healthy": { + "type": "object", "properties": { + "successes": { + "maximum": 254, + "default": 2, + "type": "integer", + "minimum": 1 + }, + "interval": { + "default": 0, + "type": "integer", + "minimum": 1 + }, "http_statuses": { - "default": [200, 302], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [200, 302], "type": "array", + "minItems": 1, "uniqueItems": true - }, - "interval": { - "default": 0, - "minimum": 1, - "type": "integer" - }, - "successes": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" } - }, - "type": "object" - }, - "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" + } }, "http_path": { - "default": "/", - "type": "string" - }, - "https_verify_certificate": { - "default": true, - "type": "boolean" - }, - "port": { - "maximum": 65535, - "minimum": 1, - "type": "integer" - }, - "req_headers": { - "items": { - "type": "string", - "uniqueItems": true - }, - "minItems": 1, - "type": "array" - }, - "timeout": { - "default": 1, - "type": "number" - }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" + "type": "string", + "default": "\/" }, "unhealthy": { + "type": "object", "properties": { "http_failures": { + "maximum": 254, "default": 5, + "type": "integer", + "minimum": 1 + }, + "timeouts": { + "maximum": 254, + "default": 3, + "type": "integer", + "minimum": 1 + }, + "tcp_failures": { "maximum": 254, - "minimum": 1, - "type": "integer" + "default": 2, + "type": "integer", + "minimum": 1 + }, + "interval": { + "default": 0, + "type": "integer", + "minimum": 1 }, "http_statuses": { - "default": [404, 429, 500, 501, 502, 503, 504, 505], "items": { "maximum": 599, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, - "minItems": 1, + "default": [429, 404, 500, 501, 502, 503, 504, 505], "type": "array", + "minItems": 1, "uniqueItems": true - }, - "interval": { - "default": 0, - "minimum": 1, - "type": "integer" - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "timeouts": { - "default": 3, - "maximum": 254, - "minimum": 1, - "type": "integer" } - }, - "type": "object" - } - }, - "type": "object" - }, - "passive": { - "properties": { - "healthy": { - "properties": { - "http_statuses": { - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "successes": { - "default": 5, - "maximum": 254, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" - }, - "type": { - "default": "http", - "enum": ["http", "https", "tcp"], - "type": "string" - }, - "unhealthy": { - "properties": { - "http_failures": { - "default": 5, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "http_statuses": { - "default": [429, 500, 503], - "items": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "tcp_failures": { - "default": 2, - "maximum": 254, - "minimum": 1, - "type": "integer" - }, - "timeouts": { - "default": 7, - "maximum": 254, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" + } } - }, - "type": "object" + } } }, - "type": "object" + "type": "object", + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }] }, - "create_time": { + "update_time": { "type": "integer" }, - "desc": { - "maxLength": 256, - "type": "string" - }, - "discovery_type": { - "description": "discovery type", - "type": "string" - }, - "enable_websocket": { - "description": "enable websocket for request", - "type": "boolean" - }, - "hash_on": { - "default": "vars", - "enum": ["consumer", "cookie", "header", "vars"], - "type": "string" + "labels": { + "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", + "patternProperties": { + ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", + "description": "value of label", + "minLength": 1, + "maxLength": 64 + } + } }, "id": { "anyOf": [{ - "maxLength": 64, - "minLength": 1, "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 64 }, { - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }] }, - "k8s_deployment_info": { - "anyOf": [{ - "required": ["deploy_name", "namespace", "port"] - }, { - "required": ["namespace", "port", "service_name"] - }], + "desc": { + "type": "string", + "maxLength": 256 + }, + "discovery_type": { + "type": "string", + "description": "discovery type" + }, + "name": { + "minLength": 1, + "type": "string", + "maxLength": 100 + }, + "pass_host": { + "default": "pass", + "description": "mod of host passing", + "type": "string", + "enum": ["pass", "node", "rewrite"] + }, + "timeout": { "properties": { - "backend_type": { - "default": "pod", - "description": "k8s service name", - "enum": ["pod", "svc"], - "type": "string" - }, - "deploy_name": { - "description": "k8s deployment name", - "type": "string" - }, - "namespace": { - "description": "k8s namespace", - "type": "string" + "connect": { + "type": "number", + "minimum": 0 }, - "port": { - "minimum": 0, - "type": "number" + "read": { + "type": "number", + "minimum": 0 }, - "service_name": { - "description": "k8s service name", - "type": "string" + "send": { + "type": "number", + "minimum": 0 } }, - "type": "object" + "type": "object", + "required": ["connect", "send", "read"] + } + }, + "type": "object", + "anyOf": [{ + "required": ["type", "nodes"] + }, { + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] + }] + }, + "ip_def": [{ + "title": "IPv4", + "type": "string", + "format": "ipv4" + }, { + "title": "IPv4\/CIDR", + "type": "string", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + }, { + "title": "IPv6", + "type": "string", + "format": "ipv6" + }, { + "title": "IPv6\/CIDR", + "type": "string", + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" + }], + "plugin_disable_schema": { + "disable": { + "type": "boolean" + } + }, + "uri_def": { + "type": "string", + "pattern": "^[^\\\/]+:\\\/\\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?" + }, + "plugins": { + "type": "array", + "items": { + "properties": { + "stream": { + "type": "boolean" + }, + "name": { + "type": "string", + "minLength": 1 + }, + "additionalProperties": false }, - "key": { - "description": "the key of chash for dynamic load balancing", - "type": "string" + "type": "object", + "required": ["name"] + } + }, + "host_def": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "route": { + "properties": { + "host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "service_id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] + }, + "filter_func": { + "minLength": 10, + "type": "string", + "pattern": "^function" + }, + "create_time": { + "type": "integer" + }, + "uri": { + "minLength": 1, + "type": "string", + "maxLength": 4096 + }, + "desc": { + "type": "string", + "maxLength": 256 }, "labels": { - "description": "key/value pairs to specify attributes", "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", "patternProperties": { ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", - "maxLength": 64, "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" + "maxLength": 64 } - }, - "type": "object" - }, - "name": { - "maxLength": 100, - "minLength": 1, - "type": "string" + } }, - "nodes": { - "anyOf": [{ - "minProperties": 1, - "patternProperties": { - ".*": { - "description": "weight of node", - "minimum": 0, - "type": "integer" - } + "upstream": { + "additionalProperties": false, + "properties": { + "retries": { + "type": "integer", + "minimum": 0 }, - "type": "object" - }, { - "items": { + "type": { + "description": "algorithms of load balancing", + "type": "string", + "enum": ["chash", "roundrobin", "ewma"] + }, + "hash_on": { + "default": "vars", + "type": "string", + "enum": ["vars", "header", "cookie", "consumer"] + }, + "k8s_deployment_info": { "properties": { - "host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" + "deploy_name": { + "type": "string", + "description": "k8s deployment name" }, - "metadata": { - "description": "metadata of node", - "type": "object" + "namespace": { + "type": "string", + "description": "k8s namespace" + }, + "service_name": { + "type": "string", + "description": "k8s service name" }, "port": { - "description": "port of node", - "minimum": 1, - "type": "integer" + "type": "number", + "minimum": 0 }, - "weight": { - "description": "weight of node", - "minimum": 0, - "type": "integer" + "backend_type": { + "enum": ["svc", "pod"], + "default": "pod", + "type": "string", + "description": "k8s service name" } }, - "required": ["host", "port", "weight"], - "type": "object" + "type": "object", + "anyOf": [{ + "required": ["namespace", "deploy_name", "port"] + }, { + "required": ["namespace", "service_name", "port"] + }] }, - "minItems": 1, + "create_time": { + "type": "integer" + }, + "upstream_host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "service_name": { + "minLength": 1, + "type": "string", + "maxLength": 100 + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "type": "object", + "patternProperties": { + ".*": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + } + } + }, { + "minItems": 1, + "type": "array", + "items": { + "properties": { + "host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "weight": { + "description": "weight of node", + "type": "integer", + "minimum": 0 + }, + "metadata": { + "type": "object", + "description": "metadata of node" + }, + "port": { + "description": "port of node", + "type": "integer", + "minimum": 1 + } + }, + "type": "object", + "required": ["host", "port", "weight"] + } + }] + }, + "key": { + "type": "string", + "description": "the key of chash for dynamic load balancing" + }, + "enable_websocket": { + "type": "boolean", + "description": "enable websocket for request" + }, + "checks": { + "additionalProperties": false, + "properties": { + "passive": { + "type": "object", + "properties": { + "healthy": { + "type": "object", + "properties": { + "successes": { + "maximum": 254, + "default": 5, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 200 + }, + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "type": "array", + "minItems": 1, + "uniqueItems": true + } + } + }, + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] + }, + "unhealthy": { + "type": "object", + "properties": { + "timeouts": { + "maximum": 254, + "default": 7, + "type": "integer", + "minimum": 1 + }, + "tcp_failures": { + "maximum": 254, + "default": 2, + "type": "integer", + "minimum": 1 + }, + "http_failures": { + "maximum": 254, + "default": 5, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 200 + }, + "default": [429, 500, 503], + "type": "array", + "minItems": 1, + "uniqueItems": true + } + } + } + } + }, + "active": { + "type": "object", + "properties": { + "host": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "type": { + "default": "http", + "type": "string", + "enum": ["http", "https", "tcp"] + }, + "port": { + "maximum": 65535, + "type": "integer", + "minimum": 1 + }, + "req_headers": { + "minItems": 1, + "type": "array", + "items": { + "type": "string", + "uniqueItems": true + } + }, + "timeout": { + "type": "number", + "default": 1 + }, + "concurrency": { + "type": "integer", + "default": 10 + }, + "https_verify_certificate": { + "type": "boolean", + "default": true + }, + "healthy": { + "type": "object", + "properties": { + "successes": { + "maximum": 254, + "default": 2, + "type": "integer", + "minimum": 1 + }, + "interval": { + "default": 0, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 200 + }, + "default": [200, 302], + "type": "array", + "minItems": 1, + "uniqueItems": true + } + } + }, + "http_path": { + "type": "string", + "default": "\/" + }, + "unhealthy": { + "type": "object", + "properties": { + "http_failures": { + "maximum": 254, + "default": 5, + "type": "integer", + "minimum": 1 + }, + "timeouts": { + "maximum": 254, + "default": 3, + "type": "integer", + "minimum": 1 + }, + "tcp_failures": { + "maximum": 254, + "default": 2, + "type": "integer", + "minimum": 1 + }, + "interval": { + "default": 0, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 200 + }, + "default": [429, 404, 500, 501, 502, 503, 504, 505], + "type": "array", + "minItems": 1, + "uniqueItems": true + } + } + } + } + } + }, + "type": "object", + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }] + }, + "update_time": { + "type": "integer" + }, + "labels": { + "maxProperties": 16, + "description": "key\/value pairs to specify attributes", + "type": "object", + "patternProperties": { + ".*": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_.]+$", + "description": "value of label", + "minLength": 1, + "maxLength": 64 + } + } + }, + "id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] + }, + "desc": { + "type": "string", + "maxLength": 256 + }, + "discovery_type": { + "type": "string", + "description": "discovery type" + }, + "name": { + "minLength": 1, + "type": "string", + "maxLength": 100 + }, + "pass_host": { + "default": "pass", + "description": "mod of host passing", + "type": "string", + "enum": ["pass", "node", "rewrite"] + }, + "timeout": { + "properties": { + "connect": { + "type": "number", + "minimum": 0 + }, + "read": { + "type": "number", + "minimum": 0 + }, + "send": { + "type": "number", + "minimum": 0 + } + }, + "type": "object", + "required": ["connect", "send", "read"] + } + }, + "type": "object", + "anyOf": [{ + "required": ["type", "nodes"] + }, { + "required": ["type", "k8s_deployment_info"] + }, { + "required": ["type", "service_name"] + }] + }, + "enable_websocket": { + "type": "boolean", + "description": "enable websocket for request" + }, + "vars": { + "type": "array", + "items": { + "items": { + "minItems": 2, + "maxItems": 3, + "anyOf": [{ + "type": "string" + }, { + "type": "number" + }] + }, + "description": "Nginx builtin variable name and value", "type": "array" + } + }, + "service_protocol": { + "enum": ["grpc", "http"] + }, + "hosts": { + "items": { + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" + }, + "uniqueItems": true, + "type": "array", + "minItems": 1 + }, + "remote_addrs": { + "items": { + "description": "client IP", + "type": "string", + "anyOf": [{ + "title": "IPv4", + "type": "string", + "format": "ipv4" + }, { + "title": "IPv4\/CIDR", + "type": "string", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + }, { + "title": "IPv6", + "type": "string", + "format": "ipv6" + }, { + "title": "IPv6\/CIDR", + "type": "string", + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" + }] + }, + "uniqueItems": true, + "type": "array", + "minItems": 1 + }, + "status": { + "default": 1, + "description": "route status, 1 to enable, 0 to disable", + "type": "integer", + "enum": [1, 0] + }, + "update_time": { + "type": "integer" + }, + "upstream_id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] + }, + "remote_addr": { + "description": "client IP", + "type": "string", + "anyOf": [{ + "title": "IPv4", + "type": "string", + "format": "ipv4" + }, { + "title": "IPv4\/CIDR", + "type": "string", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + }, { + "title": "IPv6", + "type": "string", + "format": "ipv6" + }, { + "title": "IPv6\/CIDR", + "type": "string", + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" }] }, - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "enum": ["node", "pass", "rewrite"], - "type": "string" + "id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] }, - "retries": { - "minimum": 0, - "type": "integer" + "plugins": { + "type": "object" }, - "service_name": { - "maxLength": 100, - "minLength": 1, - "type": "string" + "script": { + "minLength": 10, + "type": "string", + "maxLength": 102400 }, - "timeout": { - "properties": { - "connect": { - "minimum": 0, - "type": "number" - }, - "read": { - "minimum": 0, - "type": "number" - }, - "send": { - "minimum": 0, - "type": "number" - } + "methods": { + "items": { + "description": "HTTP method", + "type": "string", + "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] }, - "required": ["connect", "read", "send"], - "type": "object" + "type": "array", + "uniqueItems": true }, - "type": { - "description": "algorithms of load balancing", - "enum": ["chash", "ewma", "roundrobin"], - "type": "string" + "name": { + "minLength": 1, + "type": "string", + "maxLength": 100 }, - "update_time": { - "type": "integer" + "uris": { + "items": { + "type": "string", + "description": "HTTP uri" + }, + "uniqueItems": true, + "type": "array", + "minItems": 1 }, - "upstream_host": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" + "priority": { + "type": "integer", + "default": 0 } }, - "type": "object" - }, - "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" - }, - "uri_def": { - "pattern": "^[^\\/]+:\\/\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?", - "type": "string" - }, - "version": 0.5 + "type": "object", + "not": { + "anyOf": [{ + "required": ["script", "plugins"] + }] + }, + "additionalProperties": false, + "allOf": [{ + "oneOf": [{ + "required": ["uri"] + }, { + "required": ["uris"] + }] + }, { + "oneOf": [{ + "not": { + "anyOf": [{ + "required": ["host"] + }, { + "required": ["hosts"] + }] + } + }, { + "required": ["host"] + }, { + "required": ["hosts"] + }] + }, { + "oneOf": [{ + "not": { + "anyOf": [{ + "required": ["remote_addr"] + }, { + "required": ["remote_addrs"] + }] + } + }, { + "required": ["remote_addr"] + }, { + "required": ["remote_addrs"] + }] + }], + "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"] + }] + } }, "plugins": { - "api-breaker": { - "schema": { - "properties": { - "break_response_code": { - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "healthy": { - "default": { - "http_statuses": [200], - "successes": 3 - }, - "properties": { - "http_statuses": { - "default": [200], - "items": { - "maximum": 499, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "successes": { - "default": 3, - "minimum": 1, - "type": "integer" - } - }, - "type": "object" - }, - "max_breaker_sec": { - "default": 300, - "minimum": 3, - "type": "integer" - }, - "unhealthy": { - "default": { - "failures": 3, - "http_statuses": [500] - }, - "properties": { - "failures": { - "default": 3, - "minimum": 1, - "type": "integer" - }, - "http_statuses": { - "default": [500], - "items": { - "maximum": 599, - "minimum": 500, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - } - }, - "type": "object" - } - }, - "required": ["break_response_code"], - "type": "object" - } - }, - "authz-keycloak": { + "request-id": { "schema": { + "type": "object", "properties": { - "audience": { - "maxLength": 100, - "minLength": 1, - "type": "string" - }, - "grant_type": { - "default": "urn:ietf:params:oauth:grant-type:uma-ticket", - "enum": ["urn:ietf:params:oauth:grant-type:uma-ticket"], - "maxLength": 100, - "minLength": 1, - "type": "string" - }, - "keepalive": { - "default": true, - "type": "boolean" - }, - "keepalive_pool": { - "default": 5, - "minimum": 1, - "type": "integer" - }, - "keepalive_timeout": { - "default": 60000, - "minimum": 1000, - "type": "integer" - }, - "permissions": { - "items": { - "maxLength": 100, - "minLength": 1, - "type": "string" - }, - "type": "array", - "uniqueItems": true - }, - "policy_enforcement_mode": { - "default": "ENFORCING", - "enum": ["ENFORCING", "PERMISSIVE"], - "type": "string" - }, - "ssl_verify": { - "default": true, - "type": "boolean" - }, - "timeout": { - "default": 3000, - "minimum": 1000, - "type": "integer" - }, - "token_endpoint": { - "maxLength": 4096, - "minLength": 1, - "type": "string" - } - }, - "required": ["token_endpoint"], - "type": "object" - } - }, - "basic-auth": { - "consumer_schema": { - "additionalProperties": false, - "properties": { - "password": { - "type": "string" + "include_in_response": { + "type": "boolean", + "default": true }, - "username": { - "type": "string" + "header_name": { + "type": "string", + "default": "X-Request-Id" } - }, - "required": ["password", "username"], - "title": "work with consumer object", - "type": "object" - }, - "schema": { - "additionalProperties": false, - "properties": {}, - "title": "work with route or service object", - "type": "object" - } - }, - "batch-requests": { - "schema": { - "additionalProperties": false, - "type": "object" + } } }, "consumer-restriction": { "schema": { + "type": "object", "oneOf": [{ + "title": "blacklist", + "required": ["blacklist"], "properties": { "blacklist": { + "minItems": 1, + "type": "array", "items": { "type": "string" - }, - "minItems": 1, - "type": "array" - }, - "rejected_code": { - "default": 403, - "minimum": 200, - "type": "integer" + } }, "type": { "default": "consumer_name", - "enum": ["consumer_name", "service_id"], - "type": "string" + "type": "string", + "enum": ["consumer_name", "service_id"] + }, + "rejected_code": { + "default": 403, + "type": "integer", + "minimum": 200 } - }, - "required": ["blacklist"], - "title": "blacklist" + } }, { + "title": "whitelist", + "required": ["whitelist"], "properties": { "rejected_code": { "default": 403, - "minimum": 200, - "type": "integer" + "type": "integer", + "minimum": 200 }, "type": { "default": "consumer_name", - "enum": ["consumer_name", "service_id"], - "type": "string" + "type": "string", + "enum": ["consumer_name", "service_id"] }, "whitelist": { - "items": { - "type": "string" - }, "minItems": 1, - "type": "array" + "type": "array", + "items": { + "type": "string" + } } - }, - "required": ["whitelist"], - "title": "whitelist" - }], - "type": "object" + } + }] } }, - "cors": { + "sls-logger": { "schema": { "properties": { - "allow_credential": { - "default": false, - "description": "allow client append credential. according to CORS specification, if you set this option to 'true', you can not use '*' for other options.", - "type": "boolean" - }, - "allow_headers": { - "default": "*", - "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: *.", + "host": { "type": "string" }, - "allow_methods": { - "default": "*", - "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" + "inactive_timeout": { + "default": 5, + "type": "integer", + "minimum": 1 }, - "allow_origins": { - "default": "*", - "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: *.", + "max_retry_count": { + "default": 0, + "type": "integer", + "minimum": 0 + }, + "access_key_secret": { "type": "string" }, - "expose_headers": { - "default": "*", - "description": "you can use '*' to expose all header when no credentials,multiple header use ',' to split. default: *.", + "timeout": { + "default": 5000, + "type": "integer", + "minimum": 1 + }, + "buffer_duration": { + "default": 60, + "type": "integer", + "minimum": 1 + }, + "logstore": { "type": "string" }, - "max_age": { - "default": 5, - "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.", + "name": { + "type": "string", + "default": "sls-logger" + }, + "port": { "type": "integer" + }, + "access_key_id": { + "type": "string" + }, + "retry_delay": { + "default": 1, + "type": "integer", + "minimum": 0 + }, + "include_req_body": { + "type": "boolean", + "default": false + }, + "batch_max_size": { + "default": 1000, + "type": "integer", + "minimum": 1 + }, + "project": { + "type": "string" } }, - "type": "object" + "type": "object", + "required": ["host", "port", "project", "logstore", "access_key_id", "access_key_secret"] } }, - "echo": { - "schema": { + "key-auth": { + "consumer_schema": { + "required": ["key"], "additionalProperties": false, - "anyOf": [{ - "required": ["before_body"] - }, { - "required": ["body"] - }, { - "required": ["after_body"] - }], - "minProperties": 1, + "type": "object", "properties": { - "after_body": { - "description": "body after the modification of filter phase.", - "type": "string" - }, - "auth_value": { - "description": "auth value", - "type": "string" - }, - "before_body": { - "description": "body before the filter phase.", - "type": "string" - }, - "body": { - "description": "body to replace upstream response.", + "key": { "type": "string" - }, - "headers": { - "description": "new headers for response", - "minProperties": 1, - "type": "object" } - }, - "type": "object" + } + }, + "schema": { + "additionalProperties": false, + "type": "object", + "properties": {} } }, "example-plugin": { "schema": { "properties": { - "i": { - "minimum": 0, - "type": "number" - }, - "ip": { + "s": { "type": "string" }, + "t": { + "type": "array", + "minItems": 1 + }, "port": { "type": "integer" }, - "s": { + "i": { + "type": "number", + "minimum": 0 + }, + "ip": { "type": "string" + } + }, + "type": "object", + "required": ["i"] + } + }, + "request-validation": { + "schema": { + "type": "object", + "anyOf": [{ + "title": "Body schema", + "required": ["body_schema"], + "properties": { + "body_schema": { + "type": "object" + } + } + }, { + "title": "Header schema", + "required": ["header_schema"], + "properties": { + "header_schema": { + "type": "object" + } + } + }] + } + }, + "redirect": { + "schema": { + "properties": { + "ret_code": { + "default": 302, + "type": "integer", + "minimum": 200 }, - "t": { - "minItems": 1, - "type": "array" + "uri": { + "type": "string", + "minLength": 2 + }, + "http_to_https": { + "type": "boolean" } }, - "required": ["i"], - "type": "object" + "type": "object", + "oneOf": [{ + "required": ["uri"] + }, { + "required": ["http_to_https"] + }] } }, - "fault-injection": { + "proxy-rewrite": { "schema": { - "minProperties": 1, + "additionalProperties": false, "properties": { - "abort": { - "minProperties": 1, - "properties": { - "body": { - "minLength": 0, - "type": "string" - }, - "http_status": { - "minimum": 200, - "type": "integer" - }, - "percentage": { - "maximum": 100, - "minimum": 0, - "type": "integer" - } - }, - "type": "object" + "host": { + "description": "new host for upstream", + "type": "string", + "pattern": "^[0-9a-zA-Z-.]+$" }, - "delay": { - "minProperties": 1, - "properties": { - "duration": { - "minimum": 0, - "type": "number" - }, - "percentage": { - "maximum": 100, - "minimum": 0, - "type": "integer" - } + "regex_uri": { + "items": { + "type": "string", + "description": "regex uri" }, - "type": "object" + "type": "array", + "minItems": 2, + "description": "new uri that substitute from client uri for upstream, lower priority than uri property", + "maxItems": 2 + }, + "uri": { + "type": "string", + "pattern": "^\\\/.*", + "description": "new uri for upstream", + "minLength": 1, + "maxLength": 4096 + }, + "headers": { + "description": "new headers for request", + "type": "object", + "minProperties": 1 + }, + "scheme": { + "description": "new scheme for upstream", + "type": "string", + "enum": ["http", "https"] } }, - "type": "object" + "type": "object", + "minProperties": 1 } }, - "grpc-transcode": { + "kafka-logger": { "schema": { - "additionalProperties": true, "properties": { - "deadline": { + "inactive_timeout": { + "default": 5, + "type": "integer", + "minimum": 1 + }, + "max_retry_count": { "default": 0, - "description": "deadline for grpc, millisecond", - "type": "number" + "type": "integer", + "minimum": 0 }, - "method": { - "description": "the method name in the grpc service.", + "meta_format": { + "default": "default", + "type": "string", + "enum": ["default", "origin"] + }, + "timeout": { + "default": 3, + "type": "integer", + "minimum": 1 + }, + "include_req_body": { + "type": "boolean", + "default": false + }, + "kafka_topic": { "type": "string" }, - "pb_option": { - "items": { - "anyOf": [{ - "description": "enum as result", - "enum": ["int64_as_hexstring", "int64_as_number", "int64_as_string"], - "type": "string" - }, { - "description": "int64 as result", - "enum": ["enum_as_value", "ienum_as_name"], - "type": "string" - }, { - "description": "default values option", - "enum": ["auto_default_values", "no_default_values", "use_default_metatable", "use_default_values"], - "type": "string" - }, { - "description": "hooks option", - "enum": ["disable_hooks", "enable_hooks"], - "type": "string" - }], - "type": "string" - }, - "minItems": 1, - "type": "array" + "buffer_duration": { + "default": 60, + "type": "integer", + "minimum": 1 }, - "proto_id": { - "anyOf": [{ - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9-_.]+$", - "type": "string" - }, { - "minimum": 1, - "type": "integer" - }] + "name": { + "type": "string", + "default": "kafka logger" }, - "service": { - "description": "the grpc service name", + "retry_delay": { + "default": 1, + "type": "integer", + "minimum": 0 + }, + "broker_list": { + "type": "object" + }, + "batch_max_size": { + "default": 1000, + "type": "integer", + "minimum": 1 + }, + "key": { "type": "string" } }, - "required": ["method", "proto_id", "service"], - "type": "object" + "type": "object", + "required": ["broker_list", "kafka_topic"] } }, - "hmac-auth": { - "consumer_schema": { - "additionalProperties": false, + "authz-keycloak": { + "schema": { "properties": { - "access_key": { - "maxLength": 256, + "grant_type": { + "default": "urn:ietf:params:oauth:grant-type:uma-ticket", + "type": "string", "minLength": 1, - "type": "string" + "enum": ["urn:ietf:params:oauth:grant-type:uma-ticket"], + "maxLength": 100 + }, + "permissions": { + "items": { + "minLength": 1, + "type": "string", + "maxLength": 100 + }, + "type": "array", + "uniqueItems": true }, - "algorithm": { - "default": "hmac-sha256", - "enum": ["hmac-sha1", "hmac-sha256", "hmac-sha512"], - "type": "string" + "keepalive_pool": { + "default": 5, + "type": "integer", + "minimum": 1 }, - "clock_skew": { - "default": 0, - "type": "integer" + "token_endpoint": { + "minLength": 1, + "type": "string", + "maxLength": 4096 }, - "encode_uri_params": { - "default": true, - "title": "Whether to escape the uri parameter", - "type": "boolean" + "policy_enforcement_mode": { + "default": "ENFORCING", + "type": "string", + "enum": ["ENFORCING", "PERMISSIVE"] }, - "keep_headers": { - "default": false, - "title": "whether to keep the http request header", - "type": "boolean" + "timeout": { + "default": 3000, + "type": "integer", + "minimum": 1000 }, - "secret_key": { - "maxLength": 256, + "audience": { "minLength": 1, - "type": "string" + "type": "string", + "maxLength": 100 }, - "signed_headers": { - "items": { - "maxLength": 50, - "minLength": 1, - "type": "string" - }, - "type": "array" + "keepalive_timeout": { + "default": 60000, + "type": "integer", + "minimum": 1000 + }, + "ssl_verify": { + "type": "boolean", + "default": true + }, + "keepalive": { + "type": "boolean", + "default": true } }, - "required": ["access_key", "secret_key"], - "title": "work with consumer object", - "type": "object" - }, - "schema": { - "additionalProperties": false, - "properties": {}, - "title": "work with route or service object", - "type": "object" + "type": "object", + "required": ["token_endpoint"] } }, - "http-logger": { + "proxy-cache": { "schema": { + "type": "object", "properties": { - "auth_header": { - "default": "", - "type": "string" - }, - "batch_max_size": { - "default": 1000, - "minimum": 1, - "type": "integer" - }, - "buffer_duration": { - "default": 60, - "minimum": 1, - "type": "integer" - }, - "concat_method": { - "default": "json", - "enum": ["json", "new_line"], - "type": "string" - }, - "inactive_timeout": { - "default": 5, - "minimum": 1, - "type": "integer" + "no_cache": { + "minItems": 1, + "type": "array", + "items": { + "type": "string", + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" + } }, - "include_req_body": { - "default": false, - "type": "boolean" + "cache_bypass": { + "minItems": 1, + "type": "array", + "items": { + "type": "string", + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" + } }, - "max_retry_count": { - "default": 0, - "minimum": 0, - "type": "integer" + "cache_http_status": { + "items": { + "maximum": 599, + "description": "http response status", + "type": "integer", + "minimum": 200 + }, + "default": [200, 301, 404], + "type": "array", + "minItems": 1, + "uniqueItems": true }, - "name": { - "default": "http logger", - "type": "string" + "cache_key": { + "minItems": 1, + "default": ["$host", "$request_uri"], + "type": "array", + "items": { + "description": "a key for caching", + "type": "string", + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" + } }, - "retry_delay": { - "default": 1, - "minimum": 0, - "type": "integer" + "cache_method": { + "items": { + "description": "http method", + "type": "string", + "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] + }, + "default": ["GET", "HEAD"], + "type": "array", + "minItems": 1, + "uniqueItems": true }, - "timeout": { - "default": 3, - "minimum": 1, - "type": "integer" + "hide_cache_headers": { + "type": "boolean", + "default": false }, - "uri": { - "pattern": "^[^\\/]+:\\/\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?", - "type": "string" + "cache_zone": { + "default": "disk_cache_one", + "minLength": 1, + "type": "string", + "maxLength": 100 } - }, - "required": ["uri"], - "type": "object" + } } }, "ip-restriction": { "schema": { + "type": "object", "oneOf": [{ "additionalProperties": false, + "title": "whitelist", + "required": ["whitelist"], "properties": { "whitelist": { "items": { "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", "title": "IPv4", - "type": "string" + "type": "string", + "format": "ipv4" }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "title": "IPv4/CIDR", - "type": "string" + "title": "IPv4\/CIDR", + "type": "string", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", "title": "IPv6", - "type": "string" + "type": "string", + "format": "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}$", - "title": "IPv6/CIDR", - "type": "string" + "title": "IPv6\/CIDR", + "type": "string", + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" }] }, - "minItems": 1, - "type": "array" + "type": "array", + "minItems": 1 } - }, - "required": ["whitelist"], - "title": "whitelist" + } }, { "additionalProperties": false, + "title": "blacklist", + "required": ["blacklist"], "properties": { "blacklist": { "items": { "anyOf": [{ - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", "title": "IPv4", - "type": "string" + "type": "string", + "format": "ipv4" }, { - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", - "title": "IPv4/CIDR", - "type": "string" + "title": "IPv4\/CIDR", + "type": "string", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" }, { - "pattern": "^([a-fA-F0-9]{0,4}:){0,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?$", "title": "IPv6", - "type": "string" + "type": "string", + "format": "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}$", - "title": "IPv6/CIDR", - "type": "string" + "title": "IPv6\/CIDR", + "type": "string", + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" }] }, - "minItems": 1, - "type": "array" + "type": "array", + "minItems": 1 } - }, - "required": ["blacklist"], - "title": "blacklist" - }], - "type": "object" + } + }] } }, - "jwt-auth": { - "consumer_schema": { - "additionalProperties": false, + "limit-conn": { + "schema": { "properties": { - "algorithm": { - "default": "HS256", - "enum": ["HS256", "HS512", "RS256"], - "type": "string" - }, - "base64_secret": { - "default": false, - "type": "boolean" - }, - "exp": { - "default": 86400, - "minimum": 1, - "type": "integer" + "default_conn_delay": { + "type": "number", + "exclusiveMinimum": 0 }, - "key": { - "type": "string" + "burst": { + "type": "integer", + "minimum": 0 }, - "private_key": { - "type": "string" + "conn": { + "type": "integer", + "exclusiveMinimum": 0 }, - "public_key": { - "type": "string" + "rejected_code": { + "default": 503, + "type": "integer", + "minimum": 200 }, - "secret": { - "type": "string" + "key": { + "type": "string", + "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] } }, - "required": ["key"], - "type": "object" - }, + "type": "object", + "required": ["conn", "burst", "default_conn_delay", "key"] + } + }, + "skywalking": { "schema": { - "additionalProperties": false, - "properties": {}, - "type": "object" + "properties": { + "sample_ratio": { + "maximum": 1, + "default": 1, + "type": "number", + "minimum": 1e-05 + } + }, + "type": "object", + "additionalProperties": false } }, - "kafka-logger": { + "fault-injection": { "schema": { "properties": { - "batch_max_size": { - "default": 1000, - "minimum": 1, - "type": "integer" - }, - "broker_list": { - "type": "object" - }, - "buffer_duration": { - "default": 60, - "minimum": 1, - "type": "integer" - }, - "inactive_timeout": { - "default": 5, - "minimum": 1, - "type": "integer" - }, - "include_req_body": { - "default": false, - "type": "boolean" - }, - "kafka_topic": { - "type": "string" - }, - "key": { - "type": "string" - }, - "max_retry_count": { - "default": 0, - "minimum": 0, - "type": "integer" + "delay": { + "properties": { + "duration": { + "type": "number", + "minimum": 0 + }, + "percentage": { + "maximum": 100, + "type": "integer", + "minimum": 0 + } + }, + "type": "object", + "required": ["duration"] }, - "meta_format": { - "default": "default", - "enum": ["default", "origin"], - "type": "string" + "abort": { + "properties": { + "http_status": { + "type": "integer", + "minimum": 200 + }, + "body": { + "type": "string", + "minLength": 0 + }, + "percentage": { + "maximum": 100, + "type": "integer", + "minimum": 0 + } + }, + "type": "object", + "required": ["http_status"] + } + }, + "type": "object", + "minProperties": 1 + } + }, + "grpc-transcode": { + "schema": { + "required": ["proto_id", "service", "method"], + "properties": { + "pb_option": { + "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"] + }] + }, + "type": "array", + "minItems": 1 }, - "name": { - "default": "kafka logger", - "type": "string" + "proto_id": { + "anyOf": [{ + "pattern": "^[a-zA-Z0-9-_.]+$", + "minLength": 1, + "type": "string", + "maxLength": 64 + }, { + "type": "integer", + "minimum": 1 + }] }, - "retry_delay": { - "default": 1, - "minimum": 0, - "type": "integer" + "service": { + "type": "string", + "description": "the grpc service name" }, - "timeout": { - "default": 3, - "minimum": 1, - "type": "integer" + "deadline": { + "description": "deadline for grpc, millisecond", + "type": "number", + "default": 0 + }, + "method": { + "type": "string", + "description": "the method name in the grpc service." } }, - "required": ["broker_list", "kafka_topic"], - "type": "object" + "type": "object", + "additionalProperties": true } }, - "key-auth": { - "consumer_schema": { - "additionalProperties": false, - "properties": { - "key": { - "type": "string" - } - }, - "required": ["key"], - "type": "object" - }, + "server-info": { "schema": { - "additionalProperties": false, - "properties": {}, - "type": "object" + "type": "object", + "additionalProperties": false } }, - "limit-conn": { + "prometheus": { "schema": { - "properties": { - "burst": { - "minimum": 0, - "type": "integer" - }, - "conn": { - "exclusiveMinimum": 0, - "type": "integer" - }, - "default_conn_delay": { - "exclusiveMinimum": 0, - "type": "number" - }, - "key": { - "enum": ["consumer_name", "http_x_forwarded_for", "http_x_real_ip", "remote_addr", "server_addr"], - "type": "string" - }, - "rejected_code": { - "default": 503, - "minimum": 200, - "type": "integer" - } - }, - "required": ["burst", "conn", "default_conn_delay", "key"], - "type": "object" + "type": "object", + "additionalProperties": false } }, "limit-count": { @@ -2833,430 +2813,384 @@ } } }, { + "required": ["redis_host"], "properties": { - "policy": { - "enum": ["redis"] - }, "redis_host": { - "minLength": 2, - "type": "string" + "type": "string", + "minLength": 2 }, "redis_password": { - "minLength": 0, - "type": "string" + "type": "string", + "minLength": 0 }, "redis_port": { "default": 6379, - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 + }, + "policy": { + "enum": ["redis"] }, "redis_timeout": { "default": 1000, - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 } - }, - "required": ["redis_host"] + } }, { + "required": ["redis_cluster_nodes"], "properties": { + "redis_timeout": { + "default": 1000, + "type": "integer", + "minimum": 1 + }, "policy": { "enum": ["redis-cluster"] }, "redis_cluster_nodes": { + "minItems": 2, + "type": "array", "items": { - "maxLength": 100, "minLength": 2, - "type": "string" - }, - "minItems": 2, - "type": "array" + "type": "string", + "maxLength": 100 + } }, "redis_password": { - "minLength": 0, - "type": "string" - }, - "redis_timeout": { - "default": 1000, - "minimum": 1, - "type": "integer" + "type": "string", + "minLength": 0 } - }, - "required": ["redis_cluster_nodes"] + } }] } }, "properties": { - "count": { - "minimum": 0, - "type": "integer" + "time_window": { + "type": "integer", + "minimum": 0 }, - "key": { - "enum": ["consumer_name", "http_x_forwarded_for", "http_x_real_ip", "remote_addr", "server_addr", "service_id"], - "type": "string" + "count": { + "type": "integer", + "minimum": 0 }, "policy": { "default": "local", - "enum": ["local", "redis", "redis-cluster"], - "type": "string" + "type": "string", + "enum": ["local", "redis", "redis-cluster"] }, "rejected_code": { - "default": 503, "maximum": 600, - "minimum": 200, - "type": "integer" + "default": 503, + "type": "integer", + "minimum": 200 }, - "time_window": { - "minimum": 0, - "type": "integer" + "key": { + "default": "remote_addr", + "type": "string", + "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name", "service_id"] } }, - "required": ["count", "key", "time_window"], - "type": "object" + "type": "object", + "required": ["count", "time_window"] } }, - "limit-req": { + "proxy-mirror": { "schema": { + "required": ["host"], "properties": { - "burst": { - "minimum": 0, - "type": "number" - }, - "key": { - "enum": ["consumer_name", "http_x_forwarded_for", "http_x_real_ip", "remote_addr", "server_addr"], - "type": "string" - }, - "rate": { - "minimum": 0, - "type": "number" - }, - "rejected_code": { - "default": 503, - "minimum": 200, - "type": "integer" + "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})?$" } }, - "required": ["burst", "key", "rate"], - "type": "object" - } - }, - "log-rotate": { - "schema": { - "additionalProperties": false, - "properties": {}, - "type": "object" + "type": "object", + "minProperties": 1 } }, - "node-status": { - "schema": { - "additionalProperties": false, - "type": "object" - } - }, - "openid-connect": { + "wolf-rbac": { "schema": { + "type": "object", "properties": { - "bearer_only": { - "type": "boolean" - }, - "client_id": { - "type": "string" - }, - "client_secret": { - "type": "string" - }, - "discovery": { - "type": "string" - }, - "introspection_endpoint": { - "type": "string" - }, - "introspection_endpoint_auth_method": { - "type": "string" - }, - "logout_path": { - "type": "string" - }, - "public_key": { - "type": "string" - }, - "realm": { - "type": "string" - }, - "redirect_uri": { - "type": "string" - }, - "scope": { - "type": "string" - }, - "ssl_verify": { - "type": "boolean" + "appid": { + "type": "string", + "default": "unset" }, - "timeout": { - "minimum": 1, - "type": "integer" + "header_prefix": { + "type": "string", + "default": "X-" }, - "token_signing_alg_values_expected": { - "type": "string" + "server": { + "type": "string", + "default": "http:\/\/127.0.0.1:10080" } - }, - "required": ["client_id", "client_secret", "discovery"], - "type": "object" - } - }, - "prometheus": { - "schema": { - "additionalProperties": false, - "type": "object" + } } }, - "proxy-cache": { + "serverless-post-function": { "schema": { "properties": { - "cache_bypass": { - "items": { - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", - "type": "string" - }, - "minItems": 1, - "type": "array" - }, - "cache_http_status": { - "default": [200, 301, 404], - "items": { - "description": "http response status", - "maximum": 599, - "minimum": 200, - "type": "integer" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "cache_key": { - "default": ["$host", "$request_uri"], - "items": { - "description": "a key for caching", - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", - "type": "string" - }, - "minItems": 1, - "type": "array" - }, - "cache_method": { - "default": ["GET", "HEAD"], + "functions": { "items": { - "description": "http method", - "enum": ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"], "type": "string" }, - "minItems": 1, "type": "array", - "uniqueItems": true - }, - "cache_zone": { - "default": "disk_cache_one", - "maxLength": 100, - "minLength": 1, - "type": "string" + "minItems": 1 }, - "hide_cache_headers": { - "default": false, - "type": "boolean" - }, - "no_cache": { - "items": { - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", - "type": "string" - }, - "minItems": 1, - "type": "array" - } - }, - "type": "object" - } - }, - "proxy-mirror": { - "schema": { - "minProperties": 1, - "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" + "phase": { + "type": "string", + "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"] } }, - "required": ["host"], - "type": "object" + "type": "object", + "required": ["functions"] } }, - "proxy-rewrite": { + "uri-blocker": { "schema": { - "additionalProperties": false, - "minProperties": 1, "properties": { - "headers": { - "description": "new headers for request", - "minProperties": 1, - "type": "object" - }, - "host": { - "description": "new host for upstream", - "pattern": "^[0-9a-zA-Z-.]+$", - "type": "string" + "rejected_code": { + "default": 403, + "type": "integer", + "minimum": 200 }, - "regex_uri": { - "description": "new uri that substitute from client uri for upstream, lower priority than uri property", + "block_rules": { "items": { - "description": "regex uri", - "type": "string" + "minLength": 1, + "type": "string", + "maxLength": 4096 }, - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "scheme": { - "description": "new scheme for upstream", - "enum": ["http", "https"], - "type": "string" - }, - "uri": { - "description": "new uri for upstream", - "maxLength": 4096, - "minLength": 1, - "pattern": "^\\/.*", - "type": "string" - } - }, - "type": "object" - } - }, - "redirect": { - "schema": { - "oneOf": [{ - "required": ["uri"] - }, { - "required": ["http_to_https"] - }], - "properties": { - "http_to_https": { - "type": "boolean" - }, - "ret_code": { - "default": 302, - "minimum": 200, - "type": "integer" - }, - "uri": { - "minLength": 2, - "type": "string" + "type": "array", + "uniqueItems": true } }, - "type": "object" + "type": "object", + "required": ["block_rules"] } }, - "referer-restriction": { + "batch-requests": { + "schema": { + "type": "object", + "additionalProperties": false + } + }, + "echo": { "schema": { - "additionalProperties": false, "properties": { - "bypass_missing": { - "default": false, - "type": "boolean" + "auth_value": { + "type": "string", + "description": "auth value" }, - "whitelist": { - "items": { - "pattern": "^\\*?[0-9a-zA-Z-.]+$", - "type": "string" - }, - "minItems": 1, - "type": "array" + "headers": { + "description": "new headers for response", + "type": "object", + "minProperties": 1 + }, + "before_body": { + "type": "string", + "description": "body before the filter phase." + }, + "body": { + "type": "string", + "description": "body to replace upstream response." + }, + "after_body": { + "type": "string", + "description": "body after the modification of filter phase." } }, - "required": ["whitelist"], - "type": "object" + "type": "object", + "minProperties": 1, + "additionalProperties": false, + "anyOf": [{ + "required": ["before_body"] + }, { + "required": ["body"] + }, { + "required": ["after_body"] + }] } }, - "request-id": { + "zipkin": { "schema": { "properties": { - "header_name": { - "default": "X-Request-Id", + "endpoint": { "type": "string" }, - "include_in_response": { - "default": true, - "type": "boolean" + "server_addr": { + "description": "default is $server_addr, you can specify 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" + }, + "sample_ratio": { + "maximum": 1, + "type": "number", + "minimum": 1e-05 } }, - "type": "object" + "type": "object", + "required": ["endpoint", "sample_ratio"] } }, - "request-validation": { + "udp-logger": { "schema": { - "anyOf": [{ - "properties": { - "body_schema": { - "type": "object" - } + "properties": { + "host": { + "type": "string" }, - "required": ["body_schema"], - "title": "Body schema" - }, { - "properties": { - "header_schema": { - "type": "object" - } + "include_req_body": { + "type": "boolean", + "default": false }, - "required": ["header_schema"], - "title": "Header schema" - }], - "type": "object" + "inactive_timeout": { + "default": 5, + "type": "integer", + "minimum": 1 + }, + "port": { + "type": "integer", + "minimum": 0 + }, + "buffer_duration": { + "default": 60, + "type": "integer", + "minimum": 1 + }, + "name": { + "type": "string", + "default": "udp logger" + }, + "timeout": { + "default": 3, + "type": "integer", + "minimum": 1 + }, + "batch_max_size": { + "default": 1000, + "type": "integer", + "minimum": 1 + } + }, + "type": "object", + "required": ["host", "port"] } }, - "response-rewrite": { + "tcp-logger": { "schema": { - "additionalProperties": false, - "minProperties": 1, "properties": { - "body": { - "description": "new body for response", + "host": { "type": "string" }, - "body_base64": { - "default": false, - "description": "whether new body for response need base64 decode before return", - "type": "boolean" + "tls": { + "type": "boolean", + "default": false }, - "headers": { - "description": "new headers for response", - "minProperties": 1, - "type": "object" + "port": { + "type": "integer", + "minimum": 0 }, - "status_code": { - "description": "new status code for response", - "maximum": 598, - "minimum": 200, - "type": "integer" + "timeout": { + "default": 1000, + "type": "integer", + "minimum": 1 + }, + "include_req_body": { + "type": "boolean", + "default": false + }, + "max_retry_count": { + "default": 0, + "type": "integer", + "minimum": 0 + }, + "inactive_timeout": { + "default": 5, + "type": "integer", + "minimum": 1 + }, + "buffer_duration": { + "default": 60, + "type": "integer", + "minimum": 1 + }, + "retry_delay": { + "default": 1, + "type": "integer", + "minimum": 0 + }, + "name": { + "type": "string", + "default": "tcp logger" + }, + "batch_max_size": { + "default": 1000, + "type": "integer", + "minimum": 1 + }, + "tls_options": { + "type": "string" } }, - "type": "object" + "type": "object", + "required": ["host", "port"] } }, - "serverless-post-function": { - "schema": { + "hmac-auth": { + "consumer_schema": { "properties": { - "functions": { - "items": { - "type": "string" - }, - "minItems": 1, - "type": "array" + "algorithm": { + "default": "hmac-sha256", + "type": "string", + "enum": ["hmac-sha1", "hmac-sha256", "hmac-sha512"] }, - "phase": { - "enum": ["access", "balancer", "body_filter", "header_filter", "log", "rewrite"], - "type": "string" + "secret_key": { + "minLength": 1, + "type": "string", + "maxLength": 256 + }, + "keep_headers": { + "title": "whether to keep the http request header", + "type": "boolean", + "default": false + }, + "clock_skew": { + "type": "integer", + "default": 0 + }, + "access_key": { + "minLength": 1, + "type": "string", + "maxLength": 256 + }, + "encode_uri_params": { + "title": "Whether to escape the uri parameter", + "type": "boolean", + "default": true + }, + "signed_headers": { + "type": "array", + "items": { + "minLength": 1, + "type": "string", + "maxLength": 50 + } } }, - "required": ["functions"], - "type": "object" + "type": "object", + "title": "work with consumer object", + "additionalProperties": false, + "required": ["access_key", "secret_key"] + }, + "schema": { + "additionalProperties": false, + "title": "work with route or service object", + "type": "object", + "properties": {} } }, "serverless-pre-function": { @@ -3266,334 +3200,451 @@ "items": { "type": "string" }, - "minItems": 1, - "type": "array" + "type": "array", + "minItems": 1 }, "phase": { - "enum": ["access", "balancer", "body_filter", "header_filter", "log", "rewrite"], - "type": "string" + "type": "string", + "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"] } }, - "required": ["functions"], - "type": "object" + "type": "object", + "required": ["functions"] } }, - "skywalking": { + "log-rotate": { "schema": { - "additionalProperties": false, - "properties": { - "sample_ratio": { - "default": 1, - "maximum": 1, - "minimum": 0.00001, - "type": "number" - } - }, - "type": "object" + "properties": {}, + "type": "object", + "additionalProperties": false } }, - "sls-logger": { + "syslog": { "schema": { "properties": { - "access_key_id": { + "host": { "type": "string" }, - "access_key_secret": { - "type": "string" + "pool_size": { + "default": 5, + "type": "integer", + "minimum": 5 }, - "batch_max_size": { - "default": 1000, - "minimum": 1, - "type": "integer" + "tls": { + "type": "boolean", + "default": false }, - "buffer_duration": { - "default": 60, - "minimum": 1, + "port": { "type": "integer" }, - "host": { - "type": "string" + "drop_limit": { + "type": "integer", + "default": 1048576 }, - "inactive_timeout": { - "default": 5, - "minimum": 1, - "type": "integer" + "timeout": { + "default": 3, + "type": "integer", + "minimum": 1 }, "include_req_body": { - "default": false, - "type": "boolean" + "type": "boolean", + "default": false }, - "logstore": { - "type": "string" + "max_retry_times": { + "default": 1, + "type": "integer", + "minimum": 1 }, - "max_retry_count": { - "default": 0, - "minimum": 0, - "type": "integer" + "buffer_duration": { + "default": 60, + "type": "integer", + "minimum": 1 }, - "name": { - "default": "sls-logger", - "type": "string" + "sock_type": { + "default": "tcp", + "type": "string", + "enum": ["tcp", "udp"] }, - "port": { - "type": "integer" + "flush_limit": { + "default": 4096, + "type": "integer", + "minimum": 1 }, - "project": { - "type": "string" + "name": { + "type": "string", + "default": "sys logger" }, - "retry_delay": { - "default": 1, - "minimum": 0, - "type": "integer" + "batch_max_size": { + "default": 1000, + "type": "integer", + "minimum": 1 }, - "timeout": { - "default": 5000, - "minimum": 1, - "type": "integer" + "retry_interval": { + "default": 1, + "type": "integer", + "minimum": 0 } }, - "required": ["access_key_id", "access_key_secret", "host", "logstore", "port", "project"], - "type": "object" + "type": "object", + "required": ["host", "port"] } }, - "syslog": { + "openid-connect": { "schema": { "properties": { - "batch_max_size": { - "default": 1000, - "minimum": 1, - "type": "integer" - }, - "buffer_duration": { - "default": 60, - "minimum": 1, - "type": "integer" + "client_id": { + "type": "string" }, - "drop_limit": { - "default": 1048576, - "type": "integer" + "redirect_uri": { + "type": "string" }, - "flush_limit": { - "default": 4096, - "minimum": 1, - "type": "integer" + "introspection_endpoint_auth_method": { + "type": "string" }, - "host": { + "public_key": { "type": "string" }, - "include_req_body": { - "default": false, + "timeout": { + "type": "integer", + "minimum": 1 + }, + "bearer_only": { "type": "boolean" }, - "max_retry_times": { - "default": 1, - "minimum": 1, - "type": "integer" - }, - "name": { - "default": "sys logger", + "token_signing_alg_values_expected": { "type": "string" }, - "pool_size": { - "default": 5, - "minimum": 5, - "type": "integer" + "realm": { + "type": "string" }, - "port": { - "type": "integer" + "discovery": { + "type": "string" }, - "retry_interval": { - "default": 1, - "minimum": 0, - "type": "integer" + "logout_path": { + "type": "string" }, - "sock_type": { - "default": "tcp", - "enum": ["tcp", "udp"], + "scope": { "type": "string" }, - "timeout": { - "default": 3, - "minimum": 1, - "type": "integer" + "introspection_endpoint": { + "type": "string" }, - "tls": { - "default": false, + "ssl_verify": { "type": "boolean" + }, + "client_secret": { + "type": "string" } }, - "required": ["host", "port"], - "type": "object" + "type": "object", + "required": ["client_id", "client_secret", "discovery"] } }, - "tcp-logger": { + "http-logger": { "schema": { "properties": { - "batch_max_size": { - "default": 1000, - "minimum": 1, - "type": "integer" - }, - "buffer_duration": { - "default": 60, - "minimum": 1, - "type": "integer" - }, - "host": { - "type": "string" + "auth_header": { + "type": "string", + "default": "" }, "inactive_timeout": { "default": 5, - "minimum": 1, - "type": "integer" - }, - "include_req_body": { - "default": false, - "type": "boolean" + "type": "integer", + "minimum": 1 }, "max_retry_count": { "default": 0, - "minimum": 0, - "type": "integer" + "type": "integer", + "minimum": 0 }, - "name": { - "default": "tcp logger", - "type": "string" + "concat_method": { + "default": "json", + "type": "string", + "enum": ["json", "new_line"] }, - "port": { - "minimum": 0, - "type": "integer" + "timeout": { + "default": 3, + "type": "integer", + "minimum": 1 + }, + "uri": { + "type": "string", + "pattern": "^[^\\\/]+:\\\/\\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?" + }, + "include_req_body": { + "type": "boolean", + "default": false }, "retry_delay": { "default": 1, - "minimum": 0, - "type": "integer" + "type": "integer", + "minimum": 0 }, - "timeout": { + "name": { + "type": "string", + "default": "http logger" + }, + "batch_max_size": { "default": 1000, - "minimum": 1, - "type": "integer" + "type": "integer", + "minimum": 1 }, - "tls": { - "default": false, - "type": "boolean" + "buffer_duration": { + "default": 60, + "type": "integer", + "minimum": 1 + } + }, + "type": "object", + "required": ["uri"] + } + }, + "basic-auth": { + "consumer_schema": { + "properties": { + "password": { + "type": "string" }, - "tls_options": { + "username": { "type": "string" } }, - "required": ["host", "port"], - "type": "object" + "type": "object", + "title": "work with consumer object", + "additionalProperties": false, + "required": ["username", "password"] + }, + "schema": { + "additionalProperties": false, + "title": "work with route or service object", + "type": "object", + "properties": {} } }, - "udp-logger": { + "api-breaker": { "schema": { "properties": { - "batch_max_size": { - "default": 1000, - "minimum": 1, - "type": "integer" - }, - "buffer_duration": { - "default": 60, - "minimum": 1, - "type": "integer" + "break_response_code": { + "maximum": 599, + "type": "integer", + "minimum": 200 }, - "host": { - "type": "string" + "healthy": { + "properties": { + "successes": { + "default": 3, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 499, + "type": "integer", + "minimum": 200 + }, + "default": [200], + "type": "array", + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "default": { + "successes": 3, + "http_statuses": [200] + } }, - "inactive_timeout": { - "default": 5, - "minimum": 1, - "type": "integer" + "max_breaker_sec": { + "default": 300, + "type": "integer", + "minimum": 3 }, - "include_req_body": { - "default": false, - "type": "boolean" + "unhealthy": { + "properties": { + "failures": { + "default": 3, + "type": "integer", + "minimum": 1 + }, + "http_statuses": { + "items": { + "maximum": 599, + "type": "integer", + "minimum": 500 + }, + "default": [500], + "type": "array", + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "default": { + "failures": 3, + "http_statuses": [500] + } + } + }, + "type": "object", + "required": ["break_response_code"] + } + }, + "node-status": { + "schema": { + "type": "object", + "additionalProperties": false + } + }, + "response-rewrite": { + "schema": { + "additionalProperties": false, + "properties": { + "body": { + "type": "string", + "description": "new body for response" }, - "name": { - "default": "udp logger", - "type": "string" + "body_base64": { + "description": "whether new body for response need base64 decode before return", + "type": "boolean", + "default": false }, - "port": { - "minimum": 0, - "type": "integer" + "headers": { + "description": "new headers for response", + "type": "object", + "minProperties": 1 }, - "timeout": { - "default": 3, - "minimum": 1, - "type": "integer" + "status_code": { + "maximum": 598, + "description": "new status code for response", + "type": "integer", + "minimum": 200 } }, - "required": ["host", "port"], - "type": "object" + "type": "object", + "minProperties": 1 } }, - "uri-blocker": { + "referer-restriction": { "schema": { + "additionalProperties": false, "properties": { - "block_rules": { + "whitelist": { "items": { - "maxLength": 4096, - "minLength": 1, - "type": "string" + "type": "string", + "pattern": "^\\*?[0-9a-zA-Z-.]+$" }, "type": "array", - "uniqueItems": true + "minItems": 1 }, - "rejected_code": { - "default": 403, - "minimum": 200, - "type": "integer" + "bypass_missing": { + "type": "boolean", + "default": false } }, - "required": ["block_rules"], - "type": "object" + "type": "object", + "required": ["whitelist"] } }, - "wolf-rbac": { - "schema": { + "jwt-auth": { + "consumer_schema": { + "required": ["key"], + "additionalProperties": false, + "type": "object", "properties": { - "appid": { - "default": "unset", + "algorithm": { + "default": "HS256", + "type": "string", + "enum": ["HS256", "HS512", "RS256"] + }, + "exp": { + "default": 86400, + "type": "integer", + "minimum": 1 + }, + "private_key": { "type": "string" }, - "header_prefix": { - "default": "X-", + "base64_secret": { + "type": "boolean", + "default": false + }, + "public_key": { "type": "string" }, - "server": { - "default": "http://127.0.0.1:10080", + "secret": { + "type": "string" + }, + "key": { "type": "string" } - }, - "type": "object" + } + }, + "schema": { + "additionalProperties": false, + "type": "object", + "properties": {} } }, - "zipkin": { + "limit-req": { "schema": { "properties": { - "endpoint": { - "type": "string" + "rate": { + "type": "number", + "minimum": 0 }, - "sample_ratio": { - "maximum": 1, - "minimum": 0.00001, - "type": "number" + "rejected_code": { + "default": 503, + "type": "integer", + "minimum": 200 }, - "server_addr": { - "description": "default is $server_addr, you can specify your external ip address", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", - "type": "string" + "burst": { + "type": "number", + "minimum": 0 }, - "service_name": { - "default": "APISIX", - "description": "service name for zipkin reporter", - "type": "string" + "key": { + "type": "string", + "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] } }, - "required": ["endpoint", "sample_ratio"], - "type": "object" + "type": "object", + "required": ["rate", "burst", "key"] + } + }, + "cors": { + "schema": { + "type": "object", + "properties": { + "allow_credential": { + "description": "allow client append credential. according to CORS specification,if you set this option to 'true', you can not use '*' for other options.", + "type": "boolean", + "default": false + }, + "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": "*" + }, + "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_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": "*" + }, + "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": "*" + } + } } } } From 27a3380217e3318d839810d1345358b99f86b464 Mon Sep 17 00:00:00 2001 From: nic-chen Date: Fri, 18 Dec 2020 10:46:22 +0800 Subject: [PATCH 2/4] fix: sort schema.json --- api/conf/schema.json | 5638 +++++++++++++++++++++--------------------- 1 file changed, 2819 insertions(+), 2819 deletions(-) diff --git a/api/conf/schema.json b/api/conf/schema.json index 1b685dc787..76560bbfa3 100644 --- a/api/conf/schema.json +++ b/api/conf/schema.json @@ -1,2805 +1,2869 @@ { "main": { - "proto": { - "additionalProperties": false, - "properties": { - "content": { - "minLength": 1, - "type": "string", - "maxLength": 1048576 - } - }, - "type": "object", - "required": ["content"] - }, - "upstream_hash_header_schema": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_]+$" - }, - "ssl": { + "consumer": { "additionalProperties": false, "properties": { - "validity_start": { - "type": "integer" - }, - "keys": { - "type": "array", - "items": { - "minLength": 128, - "type": "string", - "maxLength": 65536 - } - }, - "validity_end": { + "create_time": { "type": "integer" }, - "certs": { - "type": "array", - "items": { - "minLength": 128, - "type": "string", - "maxLength": 65536 - } - }, - "snis": { - "type": "array", - "items": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - } + "desc": { + "maxLength": 256, + "type": "string" }, - "cert": { - "minLength": 128, - "type": "string", - "maxLength": 65536 + "id": { + "anyOf": [{ + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + }, { + "minimum": 1, + "type": "integer" + }] }, "labels": { + "description": "key/value pairs to specify attributes", "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", "patternProperties": { ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", + "maxLength": 64, "minLength": 1, - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" } - } + }, + "type": "object" + }, + "plugins": { + "type": "object" + }, + "update_time": { + "type": "integer" }, + "username": { + "maxLength": 32, + "minLength": 1, + "pattern": "^[a-zA-Z0-9_]+$", + "type": "string" + } + }, + "required": ["username"], + "type": "object" + }, + "global_rule": { + "additionalProperties": false, + "properties": { "id": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64, "minLength": 1, - "type": "string", - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }] }, - "update_time": { - "type": "integer" - }, - "create_time": { - "type": "integer" - }, - "status": { - "default": 1, - "description": "ssl status, 1 to enable, 0 to disable", - "type": "integer", - "enum": [1, 0] - }, - "exptime": { - "type": "integer", - "minimum": 1588262400 - }, - "sni": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "key": { - "minLength": 128, - "type": "string", - "maxLength": 65536 + "plugins": { + "type": "object" } }, - "type": "object", - "oneOf": [{ - "required": ["sni", "key", "cert"] - }, { - "required": ["snis", "key", "cert"] - }] + "required": ["plugins"], + "type": "object" + }, + "host_def": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" }, "id_schema": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64, "minLength": 1, - "type": "string", - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }] }, - "global_rule": { + "ip_def": [{ + "format": "ipv4", + "title": "IPv4", + "type": "string" + }, { + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", + "title": "IPv4/CIDR", + "type": "string" + }, { + "format": "ipv6", + "title": "IPv6", + "type": "string" + }, { + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", + "title": "IPv6/CIDR", + "type": "string" + }], + "label_value_def": { + "description": "value of label", + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + }, + "plugin_disable_schema": { + "disable": { + "type": "boolean" + } + }, + "plugins": { + "items": { + "properties": { + "additionalProperties": false, + "name": { + "minLength": 1, + "type": "string" + }, + "stream": { + "type": "boolean" + } + }, + "required": ["name"], + "type": "object" + }, + "type": "array" + }, + "proto": { "additionalProperties": false, "properties": { - "plugins": { - "type": "object" + "content": { + "maxLength": 1048576, + "minLength": 1, + "type": "string" + } + }, + "required": ["content"], + "type": "object" + }, + "route": { + "additionalProperties": false, + "allOf": [{ + "oneOf": [{ + "required": ["uri"] + }, { + "required": ["uris"] + }] + }, { + "oneOf": [{ + "not": { + "anyOf": [{ + "required": ["host"] + }, { + "required": ["hosts"] + }] + } + }, { + "required": ["host"] + }, { + "required": ["hosts"] + }] + }, { + "oneOf": [{ + "not": { + "anyOf": [{ + "required": ["remote_addr"] + }, { + "required": ["remote_addrs"] + }] + } + }, { + "required": ["remote_addr"] + }, { + "required": ["remote_addrs"] + }] + }], + "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"] + }], + "not": { + "anyOf": [{ + "required": ["plugins", "script"] + }] + }, + "properties": { + "create_time": { + "type": "integer" + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" + }, + "filter_func": { + "minLength": 10, + "pattern": "^function", + "type": "string" + }, + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "hosts": { + "items": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true }, "id": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64, "minLength": 1, - "type": "string", - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }] - } - }, - "type": "object", - "required": ["plugins"] - }, - "consumer": { - "additionalProperties": false, - "properties": { + }, "labels": { + "description": "key/value pairs to specify attributes", "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", "patternProperties": { ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", + "maxLength": 64, "minLength": 1, - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" } - } + }, + "type": "object" }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] + "methods": { + "items": { + "description": "HTTP method", + "enum": ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"], + "type": "string" + }, + "type": "array", + "uniqueItems": true }, - "username": { - "pattern": "^[a-zA-Z0-9_]+$", + "name": { + "maxLength": 100, "minLength": 1, - "type": "string", - "maxLength": 32 - }, - "desc": { - "type": "string", - "maxLength": 256 + "type": "string" }, "plugins": { "type": "object" }, - "update_time": { + "priority": { + "default": 0, "type": "integer" }, - "create_time": { - "type": "integer" - } - }, - "type": "object", - "required": ["username"] - }, - "service": { - "properties": { - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" + "remote_addr": { + "anyOf": [{ + "format": "ipv4", + "title": "IPv4", + "type": "string" + }, { + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", + "title": "IPv4/CIDR", + "type": "string" + }, { + "format": "ipv6", + "title": "IPv6", + "type": "string" + }, { + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", + "title": "IPv6/CIDR", + "type": "string" + }], + "description": "client IP", + "type": "string" + }, + "remote_addrs": { + "items": { + "anyOf": [{ + "format": "ipv4", + "title": "IPv4", + "type": "string" + }, { + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", + "title": "IPv4/CIDR", + "type": "string" + }, { + "format": "ipv6", + "title": "IPv6", + "type": "string" + }, { + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", + "title": "IPv6/CIDR", + "type": "string" + }], + "description": "client IP", + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "script": { + "maxLength": 102400, + "minLength": 10, + "type": "string" + }, + "service_id": { + "anyOf": [{ + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + }, { + "minimum": 1, + "type": "integer" + }] + }, + "service_protocol": { + "enum": ["grpc", "http"] + }, + "status": { + "default": 1, + "description": "route status, 1 to enable, 0 to disable", + "enum": [0, 1], + "type": "integer" + }, + "update_time": { + "type": "integer" }, "upstream": { "additionalProperties": false, + "anyOf": [{ + "required": ["nodes", "type"] + }, { + "required": ["k8s_deployment_info", "type"] + }, { + "required": ["service_name", "type"] + }], "properties": { - "retries": { - "type": "integer", - "minimum": 0 - }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] - }, - "hash_on": { - "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] - }, - "k8s_deployment_info": { - "properties": { - "deploy_name": { - "type": "string", - "description": "k8s deployment name" - }, - "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "service_name": { - "type": "string", - "description": "k8s service name" - }, - "port": { - "type": "number", - "minimum": 0 - }, - "backend_type": { - "enum": ["svc", "pod"], - "default": "pod", - "type": "string", - "description": "k8s service name" - } - }, - "type": "object", - "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] - }, { - "required": ["namespace", "service_name", "port"] - }] - }, - "create_time": { - "type": "integer" - }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "service_name": { - "minLength": 1, - "type": "string", - "maxLength": 100 - }, - "nodes": { - "anyOf": [{ - "minProperties": 1, - "type": "object", - "patternProperties": { - ".*": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - } - } - }, { - "minItems": 1, - "type": "array", - "items": { - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - }, - "metadata": { - "type": "object", - "description": "metadata of node" - }, - "port": { - "description": "port of node", - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["host", "port", "weight"] - } - }] - }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" - }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" - }, "checks": { "additionalProperties": false, + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }], "properties": { - "passive": { - "type": "object", + "active": { "properties": { + "concurrency": { + "default": 10, + "type": "integer" + }, "healthy": { - "type": "object", "properties": { - "successes": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, "http_statuses": { + "default": [200, 302], "items": { "maximum": 599, - "type": "integer", - "minimum": 200 + "minimum": 200, + "type": "integer" }, - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "type": "array", "minItems": 1, + "type": "array", "uniqueItems": true - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "unhealthy": { - "type": "object", - "properties": { - "timeouts": { - "maximum": 254, - "default": 7, - "type": "integer", - "minimum": 1 }, - "tcp_failures": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 + "interval": { + "default": 0, + "minimum": 1, + "type": "integer" }, - "http_failures": { + "successes": { + "default": 2, "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 - }, - "default": [429, 500, 503], - "type": "array", - "minItems": 1, - "uniqueItems": true + "minimum": 1, + "type": "integer" } - } - } - } - }, - "active": { - "type": "object", - "properties": { + }, + "type": "object" + }, "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] + "http_path": { + "default": "/", + "type": "string" + }, + "https_verify_certificate": { + "default": true, + "type": "boolean" }, "port": { "maximum": 65535, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }, "req_headers": { - "minItems": 1, - "type": "array", "items": { "type": "string", "uniqueItems": true - } + }, + "minItems": 1, + "type": "array" }, "timeout": { - "type": "number", - "default": 1 - }, - "concurrency": { - "type": "integer", - "default": 10 + "default": 1, + "type": "number" }, - "https_verify_certificate": { - "type": "boolean", - "default": true + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" }, - "healthy": { - "type": "object", + "unhealthy": { "properties": { - "successes": { + "http_failures": { + "default": 5, "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" + }, + "http_statuses": { + "default": [404, 429, 500, 501, 502, 503, 504, 505], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true }, "interval": { "default": 0, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" }, + "timeouts": { + "default": 3, + "maximum": 254, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "passive": { + "properties": { + "healthy": { + "properties": { "http_statuses": { + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "items": { "maximum": 599, - "type": "integer", - "minimum": 200 + "minimum": 200, + "type": "integer" }, - "default": [200, 302], - "type": "array", "minItems": 1, + "type": "array", "uniqueItems": true + }, + "successes": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" } - } + }, + "type": "object" }, - "http_path": { - "type": "string", - "default": "\/" + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" }, "unhealthy": { - "type": "object", "properties": { "http_failures": { - "maximum": 254, "default": 5, - "type": "integer", - "minimum": 1 - }, - "timeouts": { - "maximum": 254, - "default": 3, - "type": "integer", - "minimum": 1 - }, - "tcp_failures": { "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 - }, - "interval": { - "default": 0, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }, "http_statuses": { + "default": [429, 500, 503], "items": { "maximum": 599, - "type": "integer", - "minimum": 200 + "minimum": 200, + "type": "integer" }, - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "type": "array", "minItems": 1, + "type": "array", "uniqueItems": true + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "timeouts": { + "default": 7, + "maximum": 254, + "minimum": 1, + "type": "integer" } - } + }, + "type": "object" } - } + }, + "type": "object" } }, - "type": "object", + "type": "object" + }, + "create_time": { + "type": "integer" + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "discovery_type": { + "description": "discovery type", + "type": "string" + }, + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" + }, + "hash_on": { + "default": "vars", + "enum": ["consumer", "cookie", "header", "vars"], + "type": "string" + }, + "id": { "anyOf": [{ - "required": ["active"] + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "required": ["active", "passive"] + "minimum": 1, + "type": "integer" }] }, - "update_time": { - "type": "integer" + "k8s_deployment_info": { + "anyOf": [{ + "required": ["deploy_name", "namespace", "port"] + }, { + "required": ["namespace", "port", "service_name"] + }], + "properties": { + "backend_type": { + "default": "pod", + "description": "k8s service name", + "enum": ["pod", "svc"], + "type": "string" + }, + "deploy_name": { + "description": "k8s deployment name", + "type": "string" + }, + "namespace": { + "description": "k8s namespace", + "type": "string" + }, + "port": { + "minimum": 0, + "type": "number" + }, + "service_name": { + "description": "k8s service name", + "type": "string" + } + }, + "type": "object" + }, + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" }, "labels": { + "description": "key/value pairs to specify attributes", "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", "patternProperties": { ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", + "maxLength": 64, "minLength": 1, - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" } - } + }, + "type": "object" }, - "id": { + "name": { + "maxLength": 100, + "minLength": 1, + "type": "string" + }, + "nodes": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 + "minProperties": 1, + "patternProperties": { + ".*": { + "description": "weight of node", + "minimum": 0, + "type": "integer" + } + }, + "type": "object" }, { - "type": "integer", - "minimum": 1 + "items": { + "properties": { + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "metadata": { + "description": "metadata of node", + "type": "object" + }, + "port": { + "description": "port of node", + "minimum": 1, + "type": "integer" + }, + "weight": { + "description": "weight of node", + "minimum": 0, + "type": "integer" + } + }, + "required": ["host", "port", "weight"], + "type": "object" + }, + "minItems": 1, + "type": "array" }] }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "discovery_type": { - "type": "string", - "description": "discovery type" - }, - "name": { - "minLength": 1, - "type": "string", - "maxLength": 100 - }, "pass_host": { "default": "pass", "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] + "enum": ["node", "pass", "rewrite"], + "type": "string" + }, + "retries": { + "minimum": 0, + "type": "integer" + }, + "service_name": { + "maxLength": 100, + "minLength": 1, + "type": "string" }, "timeout": { "properties": { "connect": { - "type": "number", - "minimum": 0 + "minimum": 0, + "type": "number" }, "read": { - "type": "number", - "minimum": 0 + "minimum": 0, + "type": "number" }, "send": { - "type": "number", - "minimum": 0 + "minimum": 0, + "type": "number" } }, - "type": "object", - "required": ["connect", "send", "read"] + "required": ["connect", "read", "send"], + "type": "object" + }, + "type": { + "description": "algorithms of load balancing", + "enum": ["chash", "ewma", "roundrobin"], + "type": "string" + }, + "update_time": { + "type": "integer" + }, + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" } }, - "type": "object", + "type": "object" + }, + "upstream_id": { "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "required": ["type", "service_name"] + "minimum": 1, + "type": "integer" }] }, - "script": { - "minLength": 10, - "type": "string", - "maxLength": 102400 + "uri": { + "maxLength": 4096, + "minLength": 1, + "type": "string" }, - "update_time": { + "uris": { + "items": { + "description": "HTTP uri", + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "vars": { + "items": { + "description": "Nginx builtin variable name and value", + "items": { + "anyOf": [{ + "type": "string" + }, { + "type": "number" + }], + "maxItems": 3, + "minItems": 2 + }, + "type": "array" + }, + "type": "array" + } + }, + "type": "object" + }, + "service": { + "additionalProperties": false, + "properties": { + "create_time": { "type": "integer" }, - "upstream_id": { + "desc": { + "maxLength": 256, + "type": "string" + }, + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" + }, + "id": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64, "minLength": 1, - "type": "string", - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }] }, "labels": { + "description": "key/value pairs to specify attributes", "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", "patternProperties": { ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", + "maxLength": 64, "minLength": 1, - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" } - } - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "create_time": { - "type": "integer" - }, - "plugins": { + }, "type": "object" }, - "desc": { - "type": "string", - "maxLength": 256 - }, "name": { + "maxLength": 100, "minLength": 1, - "type": "string", - "maxLength": 100 - } - }, - "type": "object", - "additionalProperties": false - }, - "stream_route": { - "type": "object", - "properties": { - "remote_addr": { - "description": "client IP", - "type": "string", - "anyOf": [{ - "title": "IPv4", - "type": "string", - "format": "ipv4" - }, { - "title": "IPv4\/CIDR", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" - }, { - "title": "IPv6", - "type": "string", - "format": "ipv6" - }, { - "title": "IPv6\/CIDR", - "type": "string", - "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" - }] - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "server_addr": { - "description": "server IP", - "type": "string", - "anyOf": [{ - "title": "IPv4", - "type": "string", - "format": "ipv4" - }, { - "title": "IPv4\/CIDR", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" - }, { - "title": "IPv6", - "type": "string", - "format": "ipv6" - }, { - "title": "IPv6\/CIDR", - "type": "string", - "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" - }] + "type": "string" }, "plugins": { "type": "object" }, - "server_port": { - "type": "integer", - "description": "server port" + "script": { + "maxLength": 102400, + "minLength": 10, + "type": "string" + }, + "update_time": { + "type": "integer" }, "upstream": { "additionalProperties": false, + "anyOf": [{ + "required": ["nodes", "type"] + }, { + "required": ["k8s_deployment_info", "type"] + }, { + "required": ["service_name", "type"] + }], "properties": { - "retries": { - "type": "integer", - "minimum": 0 - }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] - }, - "hash_on": { - "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] - }, - "k8s_deployment_info": { - "properties": { - "deploy_name": { - "type": "string", - "description": "k8s deployment name" - }, - "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "service_name": { - "type": "string", - "description": "k8s service name" - }, - "port": { - "type": "number", - "minimum": 0 - }, - "backend_type": { - "enum": ["svc", "pod"], - "default": "pod", - "type": "string", - "description": "k8s service name" - } - }, - "type": "object", + "checks": { + "additionalProperties": false, "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] + "required": ["active"] }, { - "required": ["namespace", "service_name", "port"] - }] - }, - "create_time": { - "type": "integer" - }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "service_name": { - "minLength": 1, - "type": "string", - "maxLength": 100 - }, - "nodes": { - "anyOf": [{ - "minProperties": 1, - "type": "object", - "patternProperties": { - ".*": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - } - } - }, { - "minItems": 1, - "type": "array", - "items": { - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - }, - "metadata": { - "type": "object", - "description": "metadata of node" - }, - "port": { - "description": "port of node", - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["host", "port", "weight"] - } - }] - }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" - }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" - }, - "checks": { - "additionalProperties": false, + "required": ["active", "passive"] + }], "properties": { - "passive": { - "type": "object", + "active": { "properties": { + "concurrency": { + "default": 10, + "type": "integer" + }, "healthy": { - "type": "object", "properties": { - "successes": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, "http_statuses": { + "default": [200, 302], "items": { "maximum": 599, - "type": "integer", - "minimum": 200 + "minimum": 200, + "type": "integer" }, - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "type": "array", "minItems": 1, + "type": "array", "uniqueItems": true - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "unhealthy": { - "type": "object", - "properties": { - "timeouts": { - "maximum": 254, - "default": 7, - "type": "integer", - "minimum": 1 }, - "tcp_failures": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 + "interval": { + "default": 0, + "minimum": 1, + "type": "integer" }, - "http_failures": { + "successes": { + "default": 2, "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 - }, - "default": [429, 500, 503], - "type": "array", - "minItems": 1, - "uniqueItems": true + "minimum": 1, + "type": "integer" } - } - } - } - }, - "active": { - "type": "object", - "properties": { + }, + "type": "object" + }, "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] + "http_path": { + "default": "/", + "type": "string" + }, + "https_verify_certificate": { + "default": true, + "type": "boolean" }, "port": { "maximum": 65535, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }, "req_headers": { - "minItems": 1, - "type": "array", "items": { "type": "string", "uniqueItems": true - } + }, + "minItems": 1, + "type": "array" }, "timeout": { - "type": "number", - "default": 1 - }, - "concurrency": { - "type": "integer", - "default": 10 + "default": 1, + "type": "number" }, - "https_verify_certificate": { - "type": "boolean", - "default": true + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" }, - "healthy": { - "type": "object", + "unhealthy": { "properties": { - "successes": { + "http_failures": { + "default": 5, "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" + }, + "http_statuses": { + "default": [404, 429, 500, 501, 502, 503, 504, 505], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true }, "interval": { "default": 0, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" }, + "timeouts": { + "default": 3, + "maximum": 254, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "passive": { + "properties": { + "healthy": { + "properties": { "http_statuses": { + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "items": { "maximum": 599, - "type": "integer", - "minimum": 200 + "minimum": 200, + "type": "integer" }, - "default": [200, 302], - "type": "array", "minItems": 1, + "type": "array", "uniqueItems": true + }, + "successes": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" } - } + }, + "type": "object" }, - "http_path": { - "type": "string", - "default": "\/" + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" }, "unhealthy": { - "type": "object", "properties": { "http_failures": { - "maximum": 254, "default": 5, - "type": "integer", - "minimum": 1 - }, - "timeouts": { - "maximum": 254, - "default": 3, - "type": "integer", - "minimum": 1 - }, - "tcp_failures": { "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 - }, - "interval": { - "default": 0, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }, "http_statuses": { + "default": [429, 500, 503], "items": { "maximum": 599, - "type": "integer", - "minimum": 200 + "minimum": 200, + "type": "integer" }, - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "type": "array", "minItems": 1, + "type": "array", "uniqueItems": true + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "timeouts": { + "default": 7, + "maximum": 254, + "minimum": 1, + "type": "integer" } - } + }, + "type": "object" } - } + }, + "type": "object" } }, - "type": "object", + "type": "object" + }, + "create_time": { + "type": "integer" + }, + "desc": { + "maxLength": 256, + "type": "string" + }, + "discovery_type": { + "description": "discovery type", + "type": "string" + }, + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" + }, + "hash_on": { + "default": "vars", + "enum": ["consumer", "cookie", "header", "vars"], + "type": "string" + }, + "id": { "anyOf": [{ - "required": ["active"] + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "required": ["active", "passive"] + "minimum": 1, + "type": "integer" }] }, - "update_time": { - "type": "integer" + "k8s_deployment_info": { + "anyOf": [{ + "required": ["deploy_name", "namespace", "port"] + }, { + "required": ["namespace", "port", "service_name"] + }], + "properties": { + "backend_type": { + "default": "pod", + "description": "k8s service name", + "enum": ["pod", "svc"], + "type": "string" + }, + "deploy_name": { + "description": "k8s deployment name", + "type": "string" + }, + "namespace": { + "description": "k8s namespace", + "type": "string" + }, + "port": { + "minimum": 0, + "type": "number" + }, + "service_name": { + "description": "k8s service name", + "type": "string" + } + }, + "type": "object" + }, + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" }, "labels": { + "description": "key/value pairs to specify attributes", "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", "patternProperties": { ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", "description": "value of label", + "maxLength": 64, "minLength": 1, - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" } - } + }, + "type": "object" }, - "id": { + "name": { + "maxLength": 100, + "minLength": 1, + "type": "string" + }, + "nodes": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 + "minProperties": 1, + "patternProperties": { + ".*": { + "description": "weight of node", + "minimum": 0, + "type": "integer" + } + }, + "type": "object" }, { - "type": "integer", - "minimum": 1 + "items": { + "properties": { + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "metadata": { + "description": "metadata of node", + "type": "object" + }, + "port": { + "description": "port of node", + "minimum": 1, + "type": "integer" + }, + "weight": { + "description": "weight of node", + "minimum": 0, + "type": "integer" + } + }, + "required": ["host", "port", "weight"], + "type": "object" + }, + "minItems": 1, + "type": "array" }] }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "discovery_type": { - "type": "string", - "description": "discovery type" - }, - "name": { - "minLength": 1, - "type": "string", - "maxLength": 100 - }, "pass_host": { "default": "pass", "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] + "enum": ["node", "pass", "rewrite"], + "type": "string" + }, + "retries": { + "minimum": 0, + "type": "integer" + }, + "service_name": { + "maxLength": 100, + "minLength": 1, + "type": "string" }, "timeout": { "properties": { "connect": { - "type": "number", - "minimum": 0 + "minimum": 0, + "type": "number" }, "read": { - "type": "number", - "minimum": 0 + "minimum": 0, + "type": "number" }, "send": { - "type": "number", - "minimum": 0 + "minimum": 0, + "type": "number" } }, - "type": "object", - "required": ["connect", "send", "read"] - } - }, - "type": "object", - "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] - }, { - "required": ["type", "service_name"] - }] - }, + "required": ["connect", "read", "send"], + "type": "object" + }, + "type": { + "description": "algorithms of load balancing", + "enum": ["chash", "ewma", "roundrobin"], + "type": "string" + }, + "update_time": { + "type": "integer" + }, + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + } + }, + "type": "object" + }, "upstream_id": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64, "minLength": 1, - "type": "string", - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }] } - } - }, - "label_value_def": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", - "description": "value of label", - "minLength": 1, - "maxLength": 64 - }, - "version": 0.5, - "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_-]+)$" + }, + "type": "object" }, - "upstream": { + "ssl": { "additionalProperties": false, + "oneOf": [{ + "required": ["cert", "key", "sni"] + }, { + "required": ["cert", "key", "snis"] + }], "properties": { - "retries": { - "type": "integer", - "minimum": 0 + "cert": { + "maxLength": 65536, + "minLength": 128, + "type": "string" }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] + "certs": { + "items": { + "maxLength": 65536, + "minLength": 128, + "type": "string" + }, + "type": "array" }, - "hash_on": { - "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] + "create_time": { + "type": "integer" }, - "k8s_deployment_info": { - "properties": { - "deploy_name": { - "type": "string", - "description": "k8s deployment name" - }, - "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "service_name": { - "type": "string", - "description": "k8s service name" - }, - "port": { - "type": "number", - "minimum": 0 - }, - "backend_type": { - "enum": ["svc", "pod"], - "default": "pod", - "type": "string", - "description": "k8s service name" - } - }, - "type": "object", + "exptime": { + "minimum": 1588262400, + "type": "integer" + }, + "id": { "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "required": ["namespace", "service_name", "port"] + "minimum": 1, + "type": "integer" }] }, - "create_time": { + "key": { + "maxLength": 65536, + "minLength": 128, + "type": "string" + }, + "keys": { + "items": { + "maxLength": 65536, + "minLength": 128, + "type": "string" + }, + "type": "array" + }, + "labels": { + "description": "key/value pairs to specify attributes", + "maxProperties": 16, + "patternProperties": { + ".*": { + "description": "value of label", + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + } + }, + "type": "object" + }, + "sni": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "snis": { + "items": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "type": "array" + }, + "status": { + "default": 1, + "description": "ssl status, 1 to enable, 0 to disable", + "enum": [0, 1], "type": "integer" }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" + "update_time": { + "type": "integer" }, - "service_name": { - "minLength": 1, - "type": "string", - "maxLength": 100 + "validity_end": { + "type": "integer" }, - "nodes": { + "validity_start": { + "type": "integer" + } + }, + "type": "object" + }, + "stream_route": { + "properties": { + "id": { "anyOf": [{ - "minProperties": 1, - "type": "object", - "patternProperties": { - ".*": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - } - } + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "minItems": 1, - "type": "array", - "items": { - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 - }, - "metadata": { - "type": "object", - "description": "metadata of node" - }, - "port": { - "description": "port of node", - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["host", "port", "weight"] - } + "minimum": 1, + "type": "integer" }] }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" + "plugins": { + "type": "object" }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" + "remote_addr": { + "anyOf": [{ + "format": "ipv4", + "title": "IPv4", + "type": "string" + }, { + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", + "title": "IPv4/CIDR", + "type": "string" + }, { + "format": "ipv6", + "title": "IPv6", + "type": "string" + }, { + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", + "title": "IPv6/CIDR", + "type": "string" + }], + "description": "client IP", + "type": "string" }, - "checks": { + "server_addr": { + "anyOf": [{ + "format": "ipv4", + "title": "IPv4", + "type": "string" + }, { + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", + "title": "IPv4/CIDR", + "type": "string" + }, { + "format": "ipv6", + "title": "IPv6", + "type": "string" + }, { + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", + "title": "IPv6/CIDR", + "type": "string" + }], + "description": "server IP", + "type": "string" + }, + "server_port": { + "description": "server port", + "type": "integer" + }, + "upstream": { "additionalProperties": false, + "anyOf": [{ + "required": ["nodes", "type"] + }, { + "required": ["k8s_deployment_info", "type"] + }, { + "required": ["service_name", "type"] + }], "properties": { - "passive": { - "type": "object", + "checks": { + "additionalProperties": false, + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }], "properties": { - "healthy": { - "type": "object", + "active": { "properties": { - "successes": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 + "concurrency": { + "default": 10, + "type": "integer" }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 + "healthy": { + "properties": { + "http_statuses": { + "default": [200, 302], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "interval": { + "default": 0, + "minimum": 1, + "type": "integer" + }, + "successes": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + } }, - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "type": "array", - "minItems": 1, - "uniqueItems": true - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "unhealthy": { - "type": "object", - "properties": { - "timeouts": { - "maximum": 254, - "default": 7, - "type": "integer", - "minimum": 1 + "type": "object" }, - "tcp_failures": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" }, - "http_failures": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 + "http_path": { + "default": "/", + "type": "string" }, - "http_statuses": { + "https_verify_certificate": { + "default": true, + "type": "boolean" + }, + "port": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + }, + "req_headers": { "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 + "type": "string", + "uniqueItems": true }, - "default": [429, 500, 503], - "type": "array", "minItems": 1, - "uniqueItems": true - } - } - } - } - }, - "active": { - "type": "object", - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "port": { - "maximum": 65535, - "type": "integer", - "minimum": 1 - }, - "req_headers": { - "minItems": 1, - "type": "array", - "items": { - "type": "string", - "uniqueItems": true - } - }, - "timeout": { - "type": "number", - "default": 1 - }, - "concurrency": { - "type": "integer", - "default": 10 - }, - "https_verify_certificate": { - "type": "boolean", - "default": true - }, - "healthy": { - "type": "object", - "properties": { - "successes": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 + "type": "array" }, - "interval": { - "default": 0, - "type": "integer", - "minimum": 1 + "timeout": { + "default": 1, + "type": "number" }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" + }, + "unhealthy": { + "properties": { + "http_failures": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "http_statuses": { + "default": [404, 429, 500, 501, 502, 503, 504, 505], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "interval": { + "default": 0, + "minimum": 1, + "type": "integer" + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "timeouts": { + "default": 3, + "maximum": 254, + "minimum": 1, + "type": "integer" + } }, - "default": [200, 302], - "type": "array", - "minItems": 1, - "uniqueItems": true + "type": "object" } - } - }, - "http_path": { - "type": "string", - "default": "\/" + }, + "type": "object" }, - "unhealthy": { - "type": "object", + "passive": { "properties": { - "http_failures": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, - "timeouts": { - "maximum": 254, - "default": 3, - "type": "integer", - "minimum": 1 - }, - "tcp_failures": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 + "healthy": { + "properties": { + "http_statuses": { + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "successes": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" }, - "interval": { - "default": 0, - "type": "integer", - "minimum": 1 + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 + "unhealthy": { + "properties": { + "http_failures": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "http_statuses": { + "default": [429, 500, 503], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "timeouts": { + "default": 7, + "maximum": 254, + "minimum": 1, + "type": "integer" + } }, - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "type": "array", - "minItems": 1, - "uniqueItems": true + "type": "object" } - } + }, + "type": "object" } - } - } - }, - "type": "object", - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }] - }, - "update_time": { - "type": "integer" - }, - "labels": { - "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", - "patternProperties": { - ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", - "description": "value of label", - "minLength": 1, - "maxLength": 64 - } - } - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "discovery_type": { - "type": "string", - "description": "discovery type" - }, - "name": { - "minLength": 1, - "type": "string", - "maxLength": 100 - }, - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] - }, - "timeout": { - "properties": { - "connect": { - "type": "number", - "minimum": 0 + }, + "type": "object" }, - "read": { - "type": "number", - "minimum": 0 + "create_time": { + "type": "integer" }, - "send": { - "type": "number", - "minimum": 0 - } - }, - "type": "object", - "required": ["connect", "send", "read"] - } - }, - "type": "object", - "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] - }, { - "required": ["type", "service_name"] - }] - }, - "ip_def": [{ - "title": "IPv4", - "type": "string", - "format": "ipv4" - }, { - "title": "IPv4\/CIDR", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" - }, { - "title": "IPv6", - "type": "string", - "format": "ipv6" - }, { - "title": "IPv6\/CIDR", - "type": "string", - "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" - }], - "plugin_disable_schema": { - "disable": { - "type": "boolean" - } - }, - "uri_def": { - "type": "string", - "pattern": "^[^\\\/]+:\\\/\\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?" - }, - "plugins": { - "type": "array", - "items": { - "properties": { - "stream": { - "type": "boolean" - }, - "name": { - "type": "string", - "minLength": 1 - }, - "additionalProperties": false - }, - "type": "object", - "required": ["name"] - } - }, - "host_def": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "route": { - "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "service_id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "filter_func": { - "minLength": 10, - "type": "string", - "pattern": "^function" - }, - "create_time": { - "type": "integer" - }, - "uri": { - "minLength": 1, - "type": "string", - "maxLength": 4096 - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "labels": { - "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", - "patternProperties": { - ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", - "description": "value of label", - "minLength": 1, - "maxLength": 64 - } - } - }, - "upstream": { - "additionalProperties": false, - "properties": { - "retries": { - "type": "integer", - "minimum": 0 + "desc": { + "maxLength": 256, + "type": "string" }, - "type": { - "description": "algorithms of load balancing", - "type": "string", - "enum": ["chash", "roundrobin", "ewma"] + "discovery_type": { + "description": "discovery type", + "type": "string" + }, + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" }, "hash_on": { "default": "vars", - "type": "string", - "enum": ["vars", "header", "cookie", "consumer"] + "enum": ["consumer", "cookie", "header", "vars"], + "type": "string" + }, + "id": { + "anyOf": [{ + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + }, { + "minimum": 1, + "type": "integer" + }] }, "k8s_deployment_info": { + "anyOf": [{ + "required": ["deploy_name", "namespace", "port"] + }, { + "required": ["namespace", "port", "service_name"] + }], "properties": { + "backend_type": { + "default": "pod", + "description": "k8s service name", + "enum": ["pod", "svc"], + "type": "string" + }, "deploy_name": { - "type": "string", - "description": "k8s deployment name" + "description": "k8s deployment name", + "type": "string" }, "namespace": { - "type": "string", - "description": "k8s namespace" - }, - "service_name": { - "type": "string", - "description": "k8s service name" + "description": "k8s namespace", + "type": "string" }, "port": { - "type": "number", - "minimum": 0 + "minimum": 0, + "type": "number" }, - "backend_type": { - "enum": ["svc", "pod"], - "default": "pod", - "type": "string", - "description": "k8s service name" + "service_name": { + "description": "k8s service name", + "type": "string" } }, - "type": "object", - "anyOf": [{ - "required": ["namespace", "deploy_name", "port"] - }, { - "required": ["namespace", "service_name", "port"] - }] + "type": "object" }, - "create_time": { - "type": "integer" + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" }, - "upstream_host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" + "labels": { + "description": "key/value pairs to specify attributes", + "maxProperties": 16, + "patternProperties": { + ".*": { + "description": "value of label", + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + } + }, + "type": "object" }, - "service_name": { + "name": { + "maxLength": 100, "minLength": 1, - "type": "string", - "maxLength": 100 + "type": "string" }, "nodes": { "anyOf": [{ "minProperties": 1, - "type": "object", "patternProperties": { ".*": { "description": "weight of node", - "type": "integer", - "minimum": 0 + "minimum": 0, + "type": "integer" } - } + }, + "type": "object" }, { - "minItems": 1, - "type": "array", "items": { "properties": { "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "weight": { - "description": "weight of node", - "type": "integer", - "minimum": 0 + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" }, "metadata": { - "type": "object", - "description": "metadata of node" + "description": "metadata of node", + "type": "object" }, "port": { "description": "port of node", - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" + }, + "weight": { + "description": "weight of node", + "minimum": 0, + "type": "integer" } }, - "type": "object", - "required": ["host", "port", "weight"] - } + "required": ["host", "port", "weight"], + "type": "object" + }, + "minItems": 1, + "type": "array" }] }, - "key": { - "type": "string", - "description": "the key of chash for dynamic load balancing" + "pass_host": { + "default": "pass", + "description": "mod of host passing", + "enum": ["node", "pass", "rewrite"], + "type": "string" }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" + "retries": { + "minimum": 0, + "type": "integer" }, - "checks": { - "additionalProperties": false, + "service_name": { + "maxLength": 100, + "minLength": 1, + "type": "string" + }, + "timeout": { "properties": { - "passive": { - "type": "object", - "properties": { - "healthy": { - "type": "object", - "properties": { - "successes": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 - }, - "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], - "type": "array", - "minItems": 1, - "uniqueItems": true - } - } - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "unhealthy": { - "type": "object", - "properties": { - "timeouts": { - "maximum": 254, - "default": 7, - "type": "integer", - "minimum": 1 - }, - "tcp_failures": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 - }, - "http_failures": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 - }, - "default": [429, 500, 503], - "type": "array", - "minItems": 1, - "uniqueItems": true - } - } - } - } + "connect": { + "minimum": 0, + "type": "number" }, - "active": { - "type": "object", + "read": { + "minimum": 0, + "type": "number" + }, + "send": { + "minimum": 0, + "type": "number" + } + }, + "required": ["connect", "read", "send"], + "type": "object" + }, + "type": { + "description": "algorithms of load balancing", + "enum": ["chash", "ewma", "roundrobin"], + "type": "string" + }, + "update_time": { + "type": "integer" + }, + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + } + }, + "type": "object" + }, + "upstream_id": { + "anyOf": [{ + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + }, { + "minimum": 1, + "type": "integer" + }] + } + }, + "type": "object" + }, + "upstream": { + "additionalProperties": false, + "anyOf": [{ + "required": ["nodes", "type"] + }, { + "required": ["k8s_deployment_info", "type"] + }, { + "required": ["service_name", "type"] + }], + "properties": { + "checks": { + "additionalProperties": false, + "anyOf": [{ + "required": ["active"] + }, { + "required": ["active", "passive"] + }], + "properties": { + "active": { + "properties": { + "concurrency": { + "default": 10, + "type": "integer" + }, + "healthy": { "properties": { - "host": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "type": { - "default": "http", - "type": "string", - "enum": ["http", "https", "tcp"] - }, - "port": { - "maximum": 65535, - "type": "integer", - "minimum": 1 - }, - "req_headers": { + "http_statuses": { + "default": [200, 302], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, "minItems": 1, "type": "array", - "items": { - "type": "string", - "uniqueItems": true - } - }, - "timeout": { - "type": "number", - "default": 1 - }, - "concurrency": { - "type": "integer", - "default": 10 + "uniqueItems": true }, - "https_verify_certificate": { - "type": "boolean", - "default": true + "interval": { + "default": 0, + "minimum": 1, + "type": "integer" }, - "healthy": { - "type": "object", - "properties": { - "successes": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 - }, - "interval": { - "default": 0, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 - }, - "default": [200, 302], - "type": "array", - "minItems": 1, - "uniqueItems": true - } - } + "successes": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" + }, + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "http_path": { + "default": "/", + "type": "string" + }, + "https_verify_certificate": { + "default": true, + "type": "boolean" + }, + "port": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + }, + "req_headers": { + "items": { + "type": "string", + "uniqueItems": true + }, + "minItems": 1, + "type": "array" + }, + "timeout": { + "default": 1, + "type": "number" + }, + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" + }, + "unhealthy": { + "properties": { + "http_failures": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" }, - "http_path": { - "type": "string", - "default": "\/" + "http_statuses": { + "default": [404, 429, 500, 501, 502, 503, 504, 505], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true }, - "unhealthy": { - "type": "object", - "properties": { - "http_failures": { - "maximum": 254, - "default": 5, - "type": "integer", - "minimum": 1 - }, - "timeouts": { - "maximum": 254, - "default": 3, - "type": "integer", - "minimum": 1 - }, - "tcp_failures": { - "maximum": 254, - "default": 2, - "type": "integer", - "minimum": 1 - }, - "interval": { - "default": 0, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 200 - }, - "default": [429, 404, 500, 501, 502, 503, 504, 505], - "type": "array", - "minItems": 1, - "uniqueItems": true - } - } + "interval": { + "default": 0, + "minimum": 1, + "type": "integer" + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "timeouts": { + "default": 3, + "maximum": 254, + "minimum": 1, + "type": "integer" } - } + }, + "type": "object" } }, - "type": "object", - "anyOf": [{ - "required": ["active"] - }, { - "required": ["active", "passive"] - }] - }, - "update_time": { - "type": "integer" - }, - "labels": { - "maxProperties": 16, - "description": "key\/value pairs to specify attributes", - "type": "object", - "patternProperties": { - ".*": { - "type": "string", - "pattern": "^[a-zA-Z0-9-_.]+$", - "description": "value of label", - "minLength": 1, - "maxLength": 64 - } - } - }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] - }, - "desc": { - "type": "string", - "maxLength": 256 - }, - "discovery_type": { - "type": "string", - "description": "discovery type" - }, - "name": { - "minLength": 1, - "type": "string", - "maxLength": 100 - }, - "pass_host": { - "default": "pass", - "description": "mod of host passing", - "type": "string", - "enum": ["pass", "node", "rewrite"] + "type": "object" }, - "timeout": { + "passive": { "properties": { - "connect": { - "type": "number", - "minimum": 0 + "healthy": { + "properties": { + "http_statuses": { + "default": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "successes": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" }, - "read": { - "type": "number", - "minimum": 0 + "type": { + "default": "http", + "enum": ["http", "https", "tcp"], + "type": "string" }, - "send": { - "type": "number", - "minimum": 0 + "unhealthy": { + "properties": { + "http_failures": { + "default": 5, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "http_statuses": { + "default": [429, 500, 503], + "items": { + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "tcp_failures": { + "default": 2, + "maximum": 254, + "minimum": 1, + "type": "integer" + }, + "timeouts": { + "default": 7, + "maximum": 254, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" } }, - "type": "object", - "required": ["connect", "send", "read"] + "type": "object" } }, - "type": "object", - "anyOf": [{ - "required": ["type", "nodes"] - }, { - "required": ["type", "k8s_deployment_info"] - }, { - "required": ["type", "service_name"] - }] - }, - "enable_websocket": { - "type": "boolean", - "description": "enable websocket for request" - }, - "vars": { - "type": "array", - "items": { - "items": { - "minItems": 2, - "maxItems": 3, - "anyOf": [{ - "type": "string" - }, { - "type": "number" - }] - }, - "description": "Nginx builtin variable name and value", - "type": "array" - } + "type": "object" }, - "service_protocol": { - "enum": ["grpc", "http"] + "create_time": { + "type": "integer" }, - "hosts": { - "items": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" - }, - "uniqueItems": true, - "type": "array", - "minItems": 1 + "desc": { + "maxLength": 256, + "type": "string" }, - "remote_addrs": { - "items": { - "description": "client IP", - "type": "string", - "anyOf": [{ - "title": "IPv4", - "type": "string", - "format": "ipv4" - }, { - "title": "IPv4\/CIDR", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" - }, { - "title": "IPv6", - "type": "string", - "format": "ipv6" - }, { - "title": "IPv6\/CIDR", - "type": "string", - "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" - }] - }, - "uniqueItems": true, - "type": "array", - "minItems": 1 + "discovery_type": { + "description": "discovery type", + "type": "string" }, - "status": { - "default": 1, - "description": "route status, 1 to enable, 0 to disable", - "type": "integer", - "enum": [1, 0] + "enable_websocket": { + "description": "enable websocket for request", + "type": "boolean" }, - "update_time": { - "type": "integer" + "hash_on": { + "default": "vars", + "enum": ["consumer", "cookie", "header", "vars"], + "type": "string" }, - "upstream_id": { + "id": { "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", + "maxLength": 64, "minLength": 1, - "type": "string", - "maxLength": 64 + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" }, { - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }] }, - "remote_addr": { - "description": "client IP", - "type": "string", + "k8s_deployment_info": { "anyOf": [{ - "title": "IPv4", - "type": "string", - "format": "ipv4" - }, { - "title": "IPv4\/CIDR", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + "required": ["deploy_name", "namespace", "port"] }, { - "title": "IPv6", - "type": "string", - "format": "ipv6" + "required": ["namespace", "port", "service_name"] + }], + "properties": { + "backend_type": { + "default": "pod", + "description": "k8s service name", + "enum": ["pod", "svc"], + "type": "string" + }, + "deploy_name": { + "description": "k8s deployment name", + "type": "string" + }, + "namespace": { + "description": "k8s namespace", + "type": "string" + }, + "port": { + "minimum": 0, + "type": "number" + }, + "service_name": { + "description": "k8s service name", + "type": "string" + } + }, + "type": "object" + }, + "key": { + "description": "the key of chash for dynamic load balancing", + "type": "string" + }, + "labels": { + "description": "key/value pairs to specify attributes", + "maxProperties": 16, + "patternProperties": { + ".*": { + "description": "value of label", + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "maxLength": 100, + "minLength": 1, + "type": "string" + }, + "nodes": { + "anyOf": [{ + "minProperties": 1, + "patternProperties": { + ".*": { + "description": "weight of node", + "minimum": 0, + "type": "integer" + } + }, + "type": "object" }, { - "title": "IPv6\/CIDR", - "type": "string", - "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" + "items": { + "properties": { + "host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "metadata": { + "description": "metadata of node", + "type": "object" + }, + "port": { + "description": "port of node", + "minimum": 1, + "type": "integer" + }, + "weight": { + "description": "weight of node", + "minimum": 0, + "type": "integer" + } + }, + "required": ["host", "port", "weight"], + "type": "object" + }, + "minItems": 1, + "type": "array" }] }, - "id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] + "pass_host": { + "default": "pass", + "description": "mod of host passing", + "enum": ["node", "pass", "rewrite"], + "type": "string" }, - "plugins": { - "type": "object" + "retries": { + "minimum": 0, + "type": "integer" }, - "script": { - "minLength": 10, - "type": "string", - "maxLength": 102400 + "service_name": { + "maxLength": 100, + "minLength": 1, + "type": "string" }, - "methods": { - "items": { - "description": "HTTP method", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] + "timeout": { + "properties": { + "connect": { + "minimum": 0, + "type": "number" + }, + "read": { + "minimum": 0, + "type": "number" + }, + "send": { + "minimum": 0, + "type": "number" + } }, - "type": "array", - "uniqueItems": true + "required": ["connect", "read", "send"], + "type": "object" }, - "name": { - "minLength": 1, - "type": "string", - "maxLength": 100 + "type": { + "description": "algorithms of load balancing", + "enum": ["chash", "ewma", "roundrobin"], + "type": "string" }, - "uris": { - "items": { - "type": "string", - "description": "HTTP uri" - }, - "uniqueItems": true, - "type": "array", - "minItems": 1 + "update_time": { + "type": "integer" }, - "priority": { - "type": "integer", - "default": 0 + "upstream_host": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" } }, - "type": "object", - "not": { - "anyOf": [{ - "required": ["script", "plugins"] - }] - }, - "additionalProperties": false, - "allOf": [{ - "oneOf": [{ - "required": ["uri"] - }, { - "required": ["uris"] - }] - }, { - "oneOf": [{ - "not": { - "anyOf": [{ - "required": ["host"] - }, { - "required": ["hosts"] - }] - } - }, { - "required": ["host"] - }, { - "required": ["hosts"] - }] - }, { - "oneOf": [{ - "not": { - "anyOf": [{ - "required": ["remote_addr"] - }, { - "required": ["remote_addrs"] - }] - } - }, { - "required": ["remote_addr"] - }, { - "required": ["remote_addrs"] - }] - }], - "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"] - }] - } + "type": "object" + }, + "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" + }, + "uri_def": { + "pattern": "^[^\\/]+:\\/\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?", + "type": "string" + }, + "version": 0.5 }, "plugins": { - "request-id": { + "api-breaker": { "schema": { - "type": "object", "properties": { - "include_in_response": { - "type": "boolean", - "default": true + "break_response_code": { + "maximum": 599, + "minimum": 200, + "type": "integer" }, - "header_name": { - "type": "string", - "default": "X-Request-Id" - } - } - } - }, - "consumer-restriction": { - "schema": { - "type": "object", - "oneOf": [{ - "title": "blacklist", - "required": ["blacklist"], - "properties": { - "blacklist": { - "minItems": 1, - "type": "array", - "items": { - "type": "string" - } - }, - "type": { - "default": "consumer_name", - "type": "string", - "enum": ["consumer_name", "service_id"] + "healthy": { + "default": { + "http_statuses": [200], + "successes": 3 }, - "rejected_code": { - "default": 403, - "type": "integer", - "minimum": 200 - } - } - }, { - "title": "whitelist", - "required": ["whitelist"], - "properties": { - "rejected_code": { - "default": 403, - "type": "integer", - "minimum": 200 + "properties": { + "http_statuses": { + "default": [200], + "items": { + "maximum": 499, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "successes": { + "default": 3, + "minimum": 1, + "type": "integer" + } }, - "type": { - "default": "consumer_name", - "type": "string", - "enum": ["consumer_name", "service_id"] + "type": "object" + }, + "max_breaker_sec": { + "default": 300, + "minimum": 3, + "type": "integer" + }, + "unhealthy": { + "default": { + "failures": 3, + "http_statuses": [500] }, - "whitelist": { - "minItems": 1, - "type": "array", - "items": { - "type": "string" + "properties": { + "failures": { + "default": 3, + "minimum": 1, + "type": "integer" + }, + "http_statuses": { + "default": [500], + "items": { + "maximum": 599, + "minimum": 500, + "type": "integer" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true } - } + }, + "type": "object" } - }] + }, + "required": ["break_response_code"], + "type": "object" } }, - "sls-logger": { + "authz-keycloak": { "schema": { "properties": { - "host": { + "audience": { + "maxLength": 100, + "minLength": 1, "type": "string" }, - "inactive_timeout": { - "default": 5, - "type": "integer", - "minimum": 1 - }, - "max_retry_count": { - "default": 0, - "type": "integer", - "minimum": 0 - }, - "access_key_secret": { + "grant_type": { + "default": "urn:ietf:params:oauth:grant-type:uma-ticket", + "enum": ["urn:ietf:params:oauth:grant-type:uma-ticket"], + "maxLength": 100, + "minLength": 1, "type": "string" }, - "timeout": { - "default": 5000, - "type": "integer", - "minimum": 1 - }, - "buffer_duration": { - "default": 60, - "type": "integer", - "minimum": 1 - }, - "logstore": { - "type": "string" + "keepalive": { + "default": true, + "type": "boolean" }, - "name": { - "type": "string", - "default": "sls-logger" + "keepalive_pool": { + "default": 5, + "minimum": 1, + "type": "integer" }, - "port": { + "keepalive_timeout": { + "default": 60000, + "minimum": 1000, "type": "integer" }, - "access_key_id": { - "type": "string" + "permissions": { + "items": { + "maxLength": 100, + "minLength": 1, + "type": "string" + }, + "type": "array", + "uniqueItems": true }, - "retry_delay": { - "default": 1, - "type": "integer", - "minimum": 0 + "policy_enforcement_mode": { + "default": "ENFORCING", + "enum": ["ENFORCING", "PERMISSIVE"], + "type": "string" }, - "include_req_body": { - "type": "boolean", - "default": false + "ssl_verify": { + "default": true, + "type": "boolean" }, - "batch_max_size": { - "default": 1000, - "type": "integer", - "minimum": 1 + "timeout": { + "default": 3000, + "minimum": 1000, + "type": "integer" }, - "project": { + "token_endpoint": { + "maxLength": 4096, + "minLength": 1, "type": "string" } }, - "type": "object", - "required": ["host", "port", "project", "logstore", "access_key_id", "access_key_secret"] + "required": ["token_endpoint"], + "type": "object" } }, - "key-auth": { + "basic-auth": { "consumer_schema": { - "required": ["key"], "additionalProperties": false, - "type": "object", "properties": { - "key": { + "password": { + "type": "string" + }, + "username": { "type": "string" } - } + }, + "required": ["password", "username"], + "title": "work with consumer object", + "type": "object" }, "schema": { "additionalProperties": false, - "type": "object", - "properties": {} + "properties": {}, + "title": "work with route or service object", + "type": "object" } }, - "example-plugin": { + "batch-requests": { "schema": { - "properties": { - "s": { - "type": "string" - }, - "t": { - "type": "array", - "minItems": 1 - }, - "port": { - "type": "integer" - }, - "i": { - "type": "number", - "minimum": 0 - }, - "ip": { - "type": "string" - } - }, - "type": "object", - "required": ["i"] + "additionalProperties": false, + "type": "object" } }, - "request-validation": { + "consumer-restriction": { "schema": { - "type": "object", - "anyOf": [{ - "title": "Body schema", - "required": ["body_schema"], + "oneOf": [{ "properties": { - "body_schema": { - "type": "object" + "blacklist": { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array" + }, + "rejected_code": { + "default": 403, + "minimum": 200, + "type": "integer" + }, + "type": { + "default": "consumer_name", + "enum": ["consumer_name", "service_id"], + "type": "string" } - } + }, + "required": ["blacklist"], + "title": "blacklist" }, { - "title": "Header schema", - "required": ["header_schema"], "properties": { - "header_schema": { - "type": "object" + "rejected_code": { + "default": 403, + "minimum": 200, + "type": "integer" + }, + "type": { + "default": "consumer_name", + "enum": ["consumer_name", "service_id"], + "type": "string" + }, + "whitelist": { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array" } - } - }] + }, + "required": ["whitelist"], + "title": "whitelist" + }], + "type": "object" } }, - "redirect": { + "cors": { "schema": { "properties": { - "ret_code": { - "default": 302, - "type": "integer", - "minimum": 200 + "allow_credential": { + "default": false, + "description": "allow client append credential. according to CORS specification,if you set this option to 'true', you can not use '*' for other options.", + "type": "boolean" }, - "uri": { - "type": "string", - "minLength": 2 + "allow_headers": { + "default": "*", + "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" }, - "http_to_https": { - "type": "boolean" + "allow_methods": { + "default": "*", + "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" + }, + "allow_origins": { + "default": "*", + "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" + }, + "expose_headers": { + "default": "*", + "description": "you can use '*' to expose all header when no credentials,multiple header use ',' to split. default: *.", + "type": "string" + }, + "max_age": { + "default": 5, + "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" } }, - "type": "object", - "oneOf": [{ - "required": ["uri"] - }, { - "required": ["http_to_https"] - }] + "type": "object" } }, - "proxy-rewrite": { + "echo": { "schema": { "additionalProperties": false, + "anyOf": [{ + "required": ["before_body"] + }, { + "required": ["body"] + }, { + "required": ["after_body"] + }], + "minProperties": 1, "properties": { - "host": { - "description": "new host for upstream", - "type": "string", - "pattern": "^[0-9a-zA-Z-.]+$" + "after_body": { + "description": "body after the modification of filter phase.", + "type": "string" }, - "regex_uri": { - "items": { - "type": "string", - "description": "regex uri" - }, - "type": "array", - "minItems": 2, - "description": "new uri that substitute from client uri for upstream, lower priority than uri property", - "maxItems": 2 + "auth_value": { + "description": "auth value", + "type": "string" }, - "uri": { - "type": "string", - "pattern": "^\\\/.*", - "description": "new uri for upstream", - "minLength": 1, - "maxLength": 4096 + "before_body": { + "description": "body before the filter phase.", + "type": "string" }, - "headers": { - "description": "new headers for request", - "type": "object", - "minProperties": 1 + "body": { + "description": "body to replace upstream response.", + "type": "string" }, - "scheme": { - "description": "new scheme for upstream", - "type": "string", - "enum": ["http", "https"] + "headers": { + "description": "new headers for response", + "minProperties": 1, + "type": "object" } }, - "type": "object", - "minProperties": 1 + "type": "object" } }, - "kafka-logger": { + "example-plugin": { "schema": { "properties": { - "inactive_timeout": { - "default": 5, - "type": "integer", - "minimum": 1 - }, - "max_retry_count": { - "default": 0, - "type": "integer", - "minimum": 0 - }, - "meta_format": { - "default": "default", - "type": "string", - "enum": ["default", "origin"] - }, - "timeout": { - "default": 3, - "type": "integer", - "minimum": 1 - }, - "include_req_body": { - "type": "boolean", - "default": false + "i": { + "minimum": 0, + "type": "number" }, - "kafka_topic": { + "ip": { "type": "string" }, - "buffer_duration": { - "default": 60, - "type": "integer", - "minimum": 1 - }, - "name": { - "type": "string", - "default": "kafka logger" + "port": { + "type": "integer" }, - "retry_delay": { - "default": 1, - "type": "integer", - "minimum": 0 + "s": { + "type": "string" }, - "broker_list": { + "t": { + "minItems": 1, + "type": "array" + } + }, + "required": ["i"], + "type": "object" + } + }, + "fault-injection": { + "schema": { + "minProperties": 1, + "properties": { + "abort": { + "properties": { + "body": { + "minLength": 0, + "type": "string" + }, + "http_status": { + "minimum": 200, + "type": "integer" + }, + "percentage": { + "maximum": 100, + "minimum": 0, + "type": "integer" + } + }, + "required": ["http_status"], "type": "object" }, - "batch_max_size": { - "default": 1000, - "type": "integer", - "minimum": 1 - }, - "key": { - "type": "string" + "delay": { + "properties": { + "duration": { + "minimum": 0, + "type": "number" + }, + "percentage": { + "maximum": 100, + "minimum": 0, + "type": "integer" + } + }, + "required": ["duration"], + "type": "object" } }, - "type": "object", - "required": ["broker_list", "kafka_topic"] + "type": "object" } }, - "authz-keycloak": { + "grpc-transcode": { "schema": { + "additionalProperties": true, "properties": { - "grant_type": { - "default": "urn:ietf:params:oauth:grant-type:uma-ticket", - "type": "string", - "minLength": 1, - "enum": ["urn:ietf:params:oauth:grant-type:uma-ticket"], - "maxLength": 100 + "deadline": { + "default": 0, + "description": "deadline for grpc, millisecond", + "type": "number" }, - "permissions": { + "method": { + "description": "the method name in the grpc service.", + "type": "string" + }, + "pb_option": { "items": { - "minLength": 1, - "type": "string", - "maxLength": 100 + "anyOf": [{ + "description": "enum as result", + "enum": ["int64_as_hexstring", "int64_as_number", "int64_as_string"], + "type": "string" + }, { + "description": "int64 as result", + "enum": ["enum_as_value", "ienum_as_name"], + "type": "string" + }, { + "description": "default values option", + "enum": ["auto_default_values", "no_default_values", "use_default_metatable", "use_default_values"], + "type": "string" + }, { + "description": "hooks option", + "enum": ["disable_hooks", "enable_hooks"], + "type": "string" + }], + "type": "string" }, - "type": "array", - "uniqueItems": true + "minItems": 1, + "type": "array" }, - "keepalive_pool": { - "default": 5, - "type": "integer", - "minimum": 1 + "proto_id": { + "anyOf": [{ + "maxLength": 64, + "minLength": 1, + "pattern": "^[a-zA-Z0-9-_.]+$", + "type": "string" + }, { + "minimum": 1, + "type": "integer" + }] }, - "token_endpoint": { + "service": { + "description": "the grpc service name", + "type": "string" + } + }, + "required": ["method", "proto_id", "service"], + "type": "object" + } + }, + "hmac-auth": { + "consumer_schema": { + "additionalProperties": false, + "properties": { + "access_key": { + "maxLength": 256, "minLength": 1, - "type": "string", - "maxLength": 4096 + "type": "string" }, - "policy_enforcement_mode": { - "default": "ENFORCING", - "type": "string", - "enum": ["ENFORCING", "PERMISSIVE"] + "algorithm": { + "default": "hmac-sha256", + "enum": ["hmac-sha1", "hmac-sha256", "hmac-sha512"], + "type": "string" }, - "timeout": { - "default": 3000, - "type": "integer", - "minimum": 1000 + "clock_skew": { + "default": 0, + "type": "integer" }, - "audience": { - "minLength": 1, - "type": "string", - "maxLength": 100 + "encode_uri_params": { + "default": true, + "title": "Whether to escape the uri parameter", + "type": "boolean" }, - "keepalive_timeout": { - "default": 60000, - "type": "integer", - "minimum": 1000 + "keep_headers": { + "default": false, + "title": "whether to keep the http request header", + "type": "boolean" }, - "ssl_verify": { - "type": "boolean", - "default": true + "secret_key": { + "maxLength": 256, + "minLength": 1, + "type": "string" }, - "keepalive": { - "type": "boolean", - "default": true + "signed_headers": { + "items": { + "maxLength": 50, + "minLength": 1, + "type": "string" + }, + "type": "array" } }, - "type": "object", - "required": ["token_endpoint"] + "required": ["access_key", "secret_key"], + "title": "work with consumer object", + "type": "object" + }, + "schema": { + "additionalProperties": false, + "properties": {}, + "title": "work with route or service object", + "type": "object" } }, - "proxy-cache": { + "http-logger": { "schema": { - "type": "object", "properties": { - "no_cache": { - "minItems": 1, - "type": "array", - "items": { - "type": "string", - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" - } + "auth_header": { + "default": "", + "type": "string" }, - "cache_bypass": { - "minItems": 1, - "type": "array", - "items": { - "type": "string", - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" - } + "batch_max_size": { + "default": 1000, + "minimum": 1, + "type": "integer" }, - "cache_http_status": { - "items": { - "maximum": 599, - "description": "http response status", - "type": "integer", - "minimum": 200 - }, - "default": [200, 301, 404], - "type": "array", - "minItems": 1, - "uniqueItems": true + "buffer_duration": { + "default": 60, + "minimum": 1, + "type": "integer" }, - "cache_key": { - "minItems": 1, - "default": ["$host", "$request_uri"], - "type": "array", - "items": { - "description": "a key for caching", - "type": "string", - "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)" - } + "concat_method": { + "default": "json", + "enum": ["json", "new_line"], + "type": "string" }, - "cache_method": { - "items": { - "description": "http method", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] - }, - "default": ["GET", "HEAD"], - "type": "array", - "minItems": 1, - "uniqueItems": true + "inactive_timeout": { + "default": 5, + "minimum": 1, + "type": "integer" }, - "hide_cache_headers": { - "type": "boolean", - "default": false + "include_req_body": { + "default": false, + "type": "boolean" }, - "cache_zone": { - "default": "disk_cache_one", - "minLength": 1, - "type": "string", - "maxLength": 100 + "max_retry_count": { + "default": 0, + "minimum": 0, + "type": "integer" + }, + "name": { + "default": "http logger", + "type": "string" + }, + "retry_delay": { + "default": 1, + "minimum": 0, + "type": "integer" + }, + "timeout": { + "default": 3, + "minimum": 1, + "type": "integer" + }, + "uri": { + "pattern": "^[^\\/]+:\\/\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?", + "type": "string" } - } + }, + "required": ["uri"], + "type": "object" } }, "ip-restriction": { "schema": { - "type": "object", "oneOf": [{ "additionalProperties": false, - "title": "whitelist", - "required": ["whitelist"], "properties": { "whitelist": { "items": { "anyOf": [{ + "format": "ipv4", "title": "IPv4", - "type": "string", - "format": "ipv4" + "type": "string" }, { - "title": "IPv4\/CIDR", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", + "title": "IPv4/CIDR", + "type": "string" }, { + "format": "ipv6", "title": "IPv6", - "type": "string", - "format": "ipv6" + "type": "string" }, { - "title": "IPv6\/CIDR", - "type": "string", - "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", + "title": "IPv6/CIDR", + "type": "string" }] }, - "type": "array", - "minItems": 1 + "minItems": 1, + "type": "array" } - } + }, + "required": ["whitelist"], + "title": "whitelist" }, { "additionalProperties": false, - "title": "blacklist", - "required": ["blacklist"], "properties": { "blacklist": { "items": { "anyOf": [{ + "format": "ipv4", "title": "IPv4", - "type": "string", - "format": "ipv4" + "type": "string" }, { - "title": "IPv4\/CIDR", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{1,2}$" + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}$", + "title": "IPv4/CIDR", + "type": "string" }, { + "format": "ipv6", "title": "IPv6", - "type": "string", - "format": "ipv6" + "type": "string" }, { - "title": "IPv6\/CIDR", - "type": "string", - "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?\/[0-9]{1,3}$" + "pattern": "^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$", + "title": "IPv6/CIDR", + "type": "string" }] }, - "type": "array", - "minItems": 1 + "minItems": 1, + "type": "array" } - } - }] + }, + "required": ["blacklist"], + "title": "blacklist" + }], + "type": "object" } }, - "limit-conn": { - "schema": { + "jwt-auth": { + "consumer_schema": { + "additionalProperties": false, "properties": { - "default_conn_delay": { - "type": "number", - "exclusiveMinimum": 0 - }, - "burst": { - "type": "integer", - "minimum": 0 + "algorithm": { + "default": "HS256", + "enum": ["HS256", "HS512", "RS256"], + "type": "string" }, - "conn": { - "type": "integer", - "exclusiveMinimum": 0 + "base64_secret": { + "default": false, + "type": "boolean" }, - "rejected_code": { - "default": 503, - "type": "integer", - "minimum": 200 + "exp": { + "default": 86400, + "minimum": 1, + "type": "integer" }, "key": { - "type": "string", - "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] + "type": "string" + }, + "private_key": { + "type": "string" + }, + "public_key": { + "type": "string" + }, + "secret": { + "type": "string" } }, - "type": "object", - "required": ["conn", "burst", "default_conn_delay", "key"] - } - }, - "skywalking": { + "required": ["key"], + "type": "object" + }, "schema": { - "properties": { - "sample_ratio": { - "maximum": 1, - "default": 1, - "type": "number", - "minimum": 1e-05 - } - }, - "type": "object", - "additionalProperties": false + "additionalProperties": false, + "properties": {}, + "type": "object" } }, - "fault-injection": { + "kafka-logger": { "schema": { "properties": { - "delay": { - "properties": { - "duration": { - "type": "number", - "minimum": 0 - }, - "percentage": { - "maximum": 100, - "type": "integer", - "minimum": 0 - } - }, - "type": "object", - "required": ["duration"] + "batch_max_size": { + "default": 1000, + "minimum": 1, + "type": "integer" }, - "abort": { - "properties": { - "http_status": { - "type": "integer", - "minimum": 200 - }, - "body": { - "type": "string", - "minLength": 0 - }, - "percentage": { - "maximum": 100, - "type": "integer", - "minimum": 0 - } - }, - "type": "object", - "required": ["http_status"] - } - }, - "type": "object", - "minProperties": 1 - } - }, - "grpc-transcode": { - "schema": { - "required": ["proto_id", "service", "method"], - "properties": { - "pb_option": { - "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"] - }] - }, - "type": "array", - "minItems": 1 + "broker_list": { + "type": "object" }, - "proto_id": { - "anyOf": [{ - "pattern": "^[a-zA-Z0-9-_.]+$", - "minLength": 1, - "type": "string", - "maxLength": 64 - }, { - "type": "integer", - "minimum": 1 - }] + "buffer_duration": { + "default": 60, + "minimum": 1, + "type": "integer" }, - "service": { - "type": "string", - "description": "the grpc service name" + "inactive_timeout": { + "default": 5, + "minimum": 1, + "type": "integer" }, - "deadline": { - "description": "deadline for grpc, millisecond", - "type": "number", - "default": 0 + "include_req_body": { + "default": false, + "type": "boolean" + }, + "kafka_topic": { + "type": "string" + }, + "key": { + "type": "string" + }, + "max_retry_count": { + "default": 0, + "minimum": 0, + "type": "integer" + }, + "meta_format": { + "default": "default", + "enum": ["default", "origin"], + "type": "string" + }, + "name": { + "default": "kafka logger", + "type": "string" + }, + "retry_delay": { + "default": 1, + "minimum": 0, + "type": "integer" }, - "method": { - "type": "string", - "description": "the method name in the grpc service." + "timeout": { + "default": 3, + "minimum": 1, + "type": "integer" } }, - "type": "object", - "additionalProperties": true + "required": ["broker_list", "kafka_topic"], + "type": "object" } }, - "server-info": { + "key-auth": { + "consumer_schema": { + "additionalProperties": false, + "properties": { + "key": { + "type": "string" + } + }, + "required": ["key"], + "type": "object" + }, "schema": { - "type": "object", - "additionalProperties": false + "additionalProperties": false, + "properties": {}, + "type": "object" } }, - "prometheus": { + "limit-conn": { "schema": { - "type": "object", - "additionalProperties": false + "properties": { + "burst": { + "minimum": 0, + "type": "integer" + }, + "conn": { + "exclusiveMinimum": 0, + "type": "integer" + }, + "default_conn_delay": { + "exclusiveMinimum": 0, + "type": "number" + }, + "key": { + "enum": ["consumer_name", "http_x_forwarded_for", "http_x_real_ip", "remote_addr", "server_addr"], + "type": "string" + }, + "rejected_code": { + "default": 503, + "minimum": 200, + "type": "integer" + } + }, + "required": ["burst", "conn", "default_conn_delay", "key"], + "type": "object" } }, "limit-count": { @@ -2813,384 +2877,437 @@ } } }, { - "required": ["redis_host"], "properties": { + "policy": { + "enum": ["redis"] + }, "redis_host": { - "type": "string", - "minLength": 2 + "minLength": 2, + "type": "string" }, "redis_password": { - "type": "string", - "minLength": 0 + "minLength": 0, + "type": "string" }, "redis_port": { "default": 6379, - "type": "integer", - "minimum": 1 - }, - "policy": { - "enum": ["redis"] + "minimum": 1, + "type": "integer" }, "redis_timeout": { "default": 1000, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" } - } + }, + "required": ["redis_host"] }, { - "required": ["redis_cluster_nodes"], "properties": { - "redis_timeout": { - "default": 1000, - "type": "integer", - "minimum": 1 - }, "policy": { "enum": ["redis-cluster"] }, "redis_cluster_nodes": { - "minItems": 2, - "type": "array", "items": { + "maxLength": 100, "minLength": 2, - "type": "string", - "maxLength": 100 - } + "type": "string" + }, + "minItems": 2, + "type": "array" }, "redis_password": { - "type": "string", - "minLength": 0 + "minLength": 0, + "type": "string" + }, + "redis_timeout": { + "default": 1000, + "minimum": 1, + "type": "integer" } - } + }, + "required": ["redis_cluster_nodes"] }] } }, "properties": { - "time_window": { - "type": "integer", - "minimum": 0 - }, "count": { - "type": "integer", - "minimum": 0 + "minimum": 0, + "type": "integer" + }, + "key": { + "default": "remote_addr", + "enum": ["consumer_name", "http_x_forwarded_for", "http_x_real_ip", "remote_addr", "server_addr", "service_id"], + "type": "string" }, "policy": { "default": "local", - "type": "string", - "enum": ["local", "redis", "redis-cluster"] + "enum": ["local", "redis", "redis-cluster"], + "type": "string" }, "rejected_code": { - "maximum": 600, "default": 503, - "type": "integer", - "minimum": 200 + "maximum": 600, + "minimum": 200, + "type": "integer" }, - "key": { - "default": "remote_addr", - "type": "string", - "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name", "service_id"] + "time_window": { + "minimum": 0, + "type": "integer" } }, - "type": "object", - "required": ["count", "time_window"] + "required": ["count", "time_window"], + "type": "object" } }, - "proxy-mirror": { + "limit-req": { "schema": { - "required": ["host"], "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})?$" + "burst": { + "minimum": 0, + "type": "number" + }, + "key": { + "enum": ["consumer_name", "http_x_forwarded_for", "http_x_real_ip", "remote_addr", "server_addr"], + "type": "string" + }, + "rate": { + "minimum": 0, + "type": "number" + }, + "rejected_code": { + "default": 503, + "minimum": 200, + "type": "integer" } }, - "type": "object", - "minProperties": 1 + "required": ["burst", "key", "rate"], + "type": "object" } }, - "wolf-rbac": { + "log-rotate": { + "schema": { + "additionalProperties": false, + "properties": {}, + "type": "object" + } + }, + "node-status": { + "schema": { + "additionalProperties": false, + "type": "object" + } + }, + "openid-connect": { "schema": { - "type": "object", "properties": { - "appid": { - "type": "string", - "default": "unset" + "bearer_only": { + "type": "boolean" }, - "header_prefix": { - "type": "string", - "default": "X-" + "client_id": { + "type": "string" }, - "server": { - "type": "string", - "default": "http:\/\/127.0.0.1:10080" + "client_secret": { + "type": "string" + }, + "discovery": { + "type": "string" + }, + "introspection_endpoint": { + "type": "string" + }, + "introspection_endpoint_auth_method": { + "type": "string" + }, + "logout_path": { + "type": "string" + }, + "public_key": { + "type": "string" + }, + "realm": { + "type": "string" + }, + "redirect_uri": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "ssl_verify": { + "type": "boolean" + }, + "timeout": { + "minimum": 1, + "type": "integer" + }, + "token_signing_alg_values_expected": { + "type": "string" } - } + }, + "required": ["client_id", "client_secret", "discovery"], + "type": "object" } }, - "serverless-post-function": { + "prometheus": { + "schema": { + "additionalProperties": false, + "type": "object" + } + }, + "proxy-cache": { "schema": { "properties": { - "functions": { + "cache_bypass": { "items": { + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", "type": "string" }, + "minItems": 1, + "type": "array" + }, + "cache_http_status": { + "default": [200, 301, 404], + "items": { + "description": "http response status", + "maximum": 599, + "minimum": 200, + "type": "integer" + }, + "minItems": 1, "type": "array", - "minItems": 1 + "uniqueItems": true }, - "phase": { - "type": "string", - "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"] - } - }, - "type": "object", - "required": ["functions"] - } - }, - "uri-blocker": { - "schema": { - "properties": { - "rejected_code": { - "default": 403, - "type": "integer", - "minimum": 200 + "cache_key": { + "default": ["$host", "$request_uri"], + "items": { + "description": "a key for caching", + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", + "type": "string" + }, + "minItems": 1, + "type": "array" }, - "block_rules": { + "cache_method": { + "default": ["GET", "HEAD"], "items": { - "minLength": 1, - "type": "string", - "maxLength": 4096 + "description": "http method", + "enum": ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"], + "type": "string" }, + "minItems": 1, "type": "array", "uniqueItems": true + }, + "cache_zone": { + "default": "disk_cache_one", + "maxLength": 100, + "minLength": 1, + "type": "string" + }, + "hide_cache_headers": { + "default": false, + "type": "boolean" + }, + "no_cache": { + "items": { + "pattern": "(^[^\\$].+$|^\\$[0-9a-zA-Z_]+$)", + "type": "string" + }, + "minItems": 1, + "type": "array" } }, - "type": "object", - "required": ["block_rules"] + "type": "object" } }, - "batch-requests": { + "proxy-mirror": { "schema": { - "type": "object", - "additionalProperties": false + "minProperties": 1, + "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" + } + }, + "required": ["host"], + "type": "object" } }, - "echo": { + "proxy-rewrite": { "schema": { + "additionalProperties": false, + "minProperties": 1, "properties": { - "auth_value": { - "type": "string", - "description": "auth value" - }, "headers": { - "description": "new headers for response", - "type": "object", - "minProperties": 1 + "description": "new headers for request", + "minProperties": 1, + "type": "object" }, - "before_body": { - "type": "string", - "description": "body before the filter phase." + "host": { + "description": "new host for upstream", + "pattern": "^[0-9a-zA-Z-.]+$", + "type": "string" }, - "body": { - "type": "string", - "description": "body to replace upstream response." + "regex_uri": { + "description": "new uri that substitute from client uri for upstream, lower priority than uri property", + "items": { + "description": "regex uri", + "type": "string" + }, + "maxItems": 2, + "minItems": 2, + "type": "array" }, - "after_body": { - "type": "string", - "description": "body after the modification of filter phase." + "scheme": { + "description": "new scheme for upstream", + "enum": ["http", "https"], + "type": "string" + }, + "uri": { + "description": "new uri for upstream", + "maxLength": 4096, + "minLength": 1, + "pattern": "^\\/.*", + "type": "string" } - }, - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "anyOf": [{ - "required": ["before_body"] - }, { - "required": ["body"] - }, { - "required": ["after_body"] - }] + }, + "type": "object" } }, - "zipkin": { + "redirect": { "schema": { + "oneOf": [{ + "required": ["uri"] + }, { + "required": ["http_to_https"] + }], "properties": { - "endpoint": { - "type": "string" - }, - "server_addr": { - "description": "default is $server_addr, you can specify your external ip address", - "type": "string", - "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" + "http_to_https": { + "type": "boolean" }, - "service_name": { - "description": "service name for zipkin reporter", - "type": "string", - "default": "APISIX" + "ret_code": { + "default": 302, + "minimum": 200, + "type": "integer" }, - "sample_ratio": { - "maximum": 1, - "type": "number", - "minimum": 1e-05 + "uri": { + "minLength": 2, + "type": "string" } }, - "type": "object", - "required": ["endpoint", "sample_ratio"] + "type": "object" } }, - "udp-logger": { + "referer-restriction": { "schema": { + "additionalProperties": false, "properties": { - "host": { - "type": "string" - }, - "include_req_body": { - "type": "boolean", - "default": false - }, - "inactive_timeout": { - "default": 5, - "type": "integer", - "minimum": 1 - }, - "port": { - "type": "integer", - "minimum": 0 - }, - "buffer_duration": { - "default": 60, - "type": "integer", - "minimum": 1 - }, - "name": { - "type": "string", - "default": "udp logger" - }, - "timeout": { - "default": 3, - "type": "integer", - "minimum": 1 + "bypass_missing": { + "default": false, + "type": "boolean" }, - "batch_max_size": { - "default": 1000, - "type": "integer", - "minimum": 1 + "whitelist": { + "items": { + "pattern": "^\\*?[0-9a-zA-Z-.]+$", + "type": "string" + }, + "minItems": 1, + "type": "array" } }, - "type": "object", - "required": ["host", "port"] + "required": ["whitelist"], + "type": "object" } }, - "tcp-logger": { + "request-id": { "schema": { "properties": { - "host": { + "header_name": { + "default": "X-Request-Id", "type": "string" }, - "tls": { - "type": "boolean", - "default": false - }, - "port": { - "type": "integer", - "minimum": 0 - }, - "timeout": { - "default": 1000, - "type": "integer", - "minimum": 1 - }, - "include_req_body": { - "type": "boolean", - "default": false - }, - "max_retry_count": { - "default": 0, - "type": "integer", - "minimum": 0 - }, - "inactive_timeout": { - "default": 5, - "type": "integer", - "minimum": 1 - }, - "buffer_duration": { - "default": 60, - "type": "integer", - "minimum": 1 - }, - "retry_delay": { - "default": 1, - "type": "integer", - "minimum": 0 - }, - "name": { - "type": "string", - "default": "tcp logger" - }, - "batch_max_size": { - "default": 1000, - "type": "integer", - "minimum": 1 - }, - "tls_options": { - "type": "string" + "include_in_response": { + "default": true, + "type": "boolean" } }, - "type": "object", - "required": ["host", "port"] + "type": "object" } }, - "hmac-auth": { - "consumer_schema": { - "properties": { - "algorithm": { - "default": "hmac-sha256", - "type": "string", - "enum": ["hmac-sha1", "hmac-sha256", "hmac-sha512"] - }, - "secret_key": { - "minLength": 1, - "type": "string", - "maxLength": 256 + "request-validation": { + "schema": { + "anyOf": [{ + "properties": { + "body_schema": { + "type": "object" + } }, - "keep_headers": { - "title": "whether to keep the http request header", - "type": "boolean", - "default": false + "required": ["body_schema"], + "title": "Body schema" + }, { + "properties": { + "header_schema": { + "type": "object" + } }, - "clock_skew": { - "type": "integer", - "default": 0 + "required": ["header_schema"], + "title": "Header schema" + }], + "type": "object" + } + }, + "response-rewrite": { + "schema": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "body": { + "description": "new body for response", + "type": "string" }, - "access_key": { - "minLength": 1, - "type": "string", - "maxLength": 256 + "body_base64": { + "default": false, + "description": "whether new body for response need base64 decode before return", + "type": "boolean" }, - "encode_uri_params": { - "title": "Whether to escape the uri parameter", - "type": "boolean", - "default": true + "headers": { + "description": "new headers for response", + "minProperties": 1, + "type": "object" }, - "signed_headers": { - "type": "array", - "items": { - "minLength": 1, - "type": "string", - "maxLength": 50 - } + "status_code": { + "description": "new status code for response", + "maximum": 598, + "minimum": 200, + "type": "integer" } }, - "type": "object", - "title": "work with consumer object", - "additionalProperties": false, - "required": ["access_key", "secret_key"] - }, + "type": "object" + } + }, + "server-info": { "schema": { "additionalProperties": false, - "title": "work with route or service object", - "type": "object", - "properties": {} + "type": "object" + } + }, + "serverless-post-function": { + "schema": { + "properties": { + "functions": { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array" + }, + "phase": { + "enum": ["access", "balancer", "body_filter", "header_filter", "log", "rewrite"], + "type": "string" + } + }, + "required": ["functions"], + "type": "object" } }, "serverless-pre-function": { @@ -3200,451 +3317,334 @@ "items": { "type": "string" }, - "type": "array", - "minItems": 1 + "minItems": 1, + "type": "array" }, "phase": { - "type": "string", - "enum": ["rewrite", "access", "header_filter", "body_filter", "log", "balancer"] + "enum": ["access", "balancer", "body_filter", "header_filter", "log", "rewrite"], + "type": "string" } }, - "type": "object", - "required": ["functions"] + "required": ["functions"], + "type": "object" } }, - "log-rotate": { + "skywalking": { "schema": { - "properties": {}, - "type": "object", - "additionalProperties": false + "additionalProperties": false, + "properties": { + "sample_ratio": { + "default": 1, + "maximum": 1, + "minimum": 0.00001, + "type": "number" + } + }, + "type": "object" } }, - "syslog": { + "sls-logger": { "schema": { "properties": { - "host": { + "access_key_id": { "type": "string" }, - "pool_size": { - "default": 5, - "type": "integer", - "minimum": 5 + "access_key_secret": { + "type": "string" }, - "tls": { - "type": "boolean", - "default": false + "batch_max_size": { + "default": 1000, + "minimum": 1, + "type": "integer" }, - "port": { + "buffer_duration": { + "default": 60, + "minimum": 1, "type": "integer" }, - "drop_limit": { - "type": "integer", - "default": 1048576 + "host": { + "type": "string" }, - "timeout": { - "default": 3, - "type": "integer", - "minimum": 1 + "inactive_timeout": { + "default": 5, + "minimum": 1, + "type": "integer" }, "include_req_body": { - "type": "boolean", - "default": false - }, - "max_retry_times": { - "default": 1, - "type": "integer", - "minimum": 1 - }, - "buffer_duration": { - "default": 60, - "type": "integer", - "minimum": 1 + "default": false, + "type": "boolean" }, - "sock_type": { - "default": "tcp", - "type": "string", - "enum": ["tcp", "udp"] + "logstore": { + "type": "string" }, - "flush_limit": { - "default": 4096, - "type": "integer", - "minimum": 1 + "max_retry_count": { + "default": 0, + "minimum": 0, + "type": "integer" }, "name": { - "type": "string", - "default": "sys logger" + "default": "sls-logger", + "type": "string" }, - "batch_max_size": { - "default": 1000, - "type": "integer", - "minimum": 1 + "port": { + "type": "integer" }, - "retry_interval": { + "project": { + "type": "string" + }, + "retry_delay": { "default": 1, - "type": "integer", - "minimum": 0 + "minimum": 0, + "type": "integer" + }, + "timeout": { + "default": 5000, + "minimum": 1, + "type": "integer" } }, - "type": "object", - "required": ["host", "port"] + "required": ["access_key_id", "access_key_secret", "host", "logstore", "port", "project"], + "type": "object" } }, - "openid-connect": { + "syslog": { "schema": { "properties": { - "client_id": { - "type": "string" + "batch_max_size": { + "default": 1000, + "minimum": 1, + "type": "integer" }, - "redirect_uri": { - "type": "string" + "buffer_duration": { + "default": 60, + "minimum": 1, + "type": "integer" }, - "introspection_endpoint_auth_method": { - "type": "string" + "drop_limit": { + "default": 1048576, + "type": "integer" }, - "public_key": { - "type": "string" + "flush_limit": { + "default": 4096, + "minimum": 1, + "type": "integer" }, - "timeout": { - "type": "integer", - "minimum": 1 + "host": { + "type": "string" }, - "bearer_only": { + "include_req_body": { + "default": false, "type": "boolean" }, - "token_signing_alg_values_expected": { - "type": "string" + "max_retry_times": { + "default": 1, + "minimum": 1, + "type": "integer" }, - "realm": { + "name": { + "default": "sys logger", "type": "string" }, - "discovery": { - "type": "string" + "pool_size": { + "default": 5, + "minimum": 5, + "type": "integer" }, - "logout_path": { - "type": "string" + "port": { + "type": "integer" }, - "scope": { - "type": "string" + "retry_interval": { + "default": 1, + "minimum": 0, + "type": "integer" }, - "introspection_endpoint": { + "sock_type": { + "default": "tcp", + "enum": ["tcp", "udp"], "type": "string" }, - "ssl_verify": { - "type": "boolean" + "timeout": { + "default": 3, + "minimum": 1, + "type": "integer" }, - "client_secret": { - "type": "string" + "tls": { + "default": false, + "type": "boolean" } }, - "type": "object", - "required": ["client_id", "client_secret", "discovery"] + "required": ["host", "port"], + "type": "object" } }, - "http-logger": { + "tcp-logger": { "schema": { "properties": { - "auth_header": { - "type": "string", - "default": "" + "batch_max_size": { + "default": 1000, + "minimum": 1, + "type": "integer" + }, + "buffer_duration": { + "default": 60, + "minimum": 1, + "type": "integer" + }, + "host": { + "type": "string" }, "inactive_timeout": { "default": 5, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" + }, + "include_req_body": { + "default": false, + "type": "boolean" }, "max_retry_count": { "default": 0, - "type": "integer", - "minimum": 0 - }, - "concat_method": { - "default": "json", - "type": "string", - "enum": ["json", "new_line"] - }, - "timeout": { - "default": 3, - "type": "integer", - "minimum": 1 + "minimum": 0, + "type": "integer" }, - "uri": { - "type": "string", - "pattern": "^[^\\\/]+:\\\/\\\/([\\da-zA-Z.-]+|\\[[\\da-fA-F:]+\\])(:\\d+)?" + "name": { + "default": "tcp logger", + "type": "string" }, - "include_req_body": { - "type": "boolean", - "default": false + "port": { + "minimum": 0, + "type": "integer" }, "retry_delay": { "default": 1, - "type": "integer", - "minimum": 0 - }, - "name": { - "type": "string", - "default": "http logger" + "minimum": 0, + "type": "integer" }, - "batch_max_size": { + "timeout": { "default": 1000, - "type": "integer", - "minimum": 1 + "minimum": 1, + "type": "integer" }, - "buffer_duration": { - "default": 60, - "type": "integer", - "minimum": 1 - } - }, - "type": "object", - "required": ["uri"] - } - }, - "basic-auth": { - "consumer_schema": { - "properties": { - "password": { - "type": "string" + "tls": { + "default": false, + "type": "boolean" }, - "username": { + "tls_options": { "type": "string" } }, - "type": "object", - "title": "work with consumer object", - "additionalProperties": false, - "required": ["username", "password"] - }, - "schema": { - "additionalProperties": false, - "title": "work with route or service object", - "type": "object", - "properties": {} + "required": ["host", "port"], + "type": "object" } }, - "api-breaker": { + "udp-logger": { "schema": { "properties": { - "break_response_code": { - "maximum": 599, - "type": "integer", - "minimum": 200 + "batch_max_size": { + "default": 1000, + "minimum": 1, + "type": "integer" }, - "healthy": { - "properties": { - "successes": { - "default": 3, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 499, - "type": "integer", - "minimum": 200 - }, - "default": [200], - "type": "array", - "minItems": 1, - "uniqueItems": true - } - }, - "type": "object", - "default": { - "successes": 3, - "http_statuses": [200] - } + "buffer_duration": { + "default": 60, + "minimum": 1, + "type": "integer" }, - "max_breaker_sec": { - "default": 300, - "type": "integer", - "minimum": 3 + "host": { + "type": "string" }, - "unhealthy": { - "properties": { - "failures": { - "default": 3, - "type": "integer", - "minimum": 1 - }, - "http_statuses": { - "items": { - "maximum": 599, - "type": "integer", - "minimum": 500 - }, - "default": [500], - "type": "array", - "minItems": 1, - "uniqueItems": true - } - }, - "type": "object", - "default": { - "failures": 3, - "http_statuses": [500] - } - } - }, - "type": "object", - "required": ["break_response_code"] - } - }, - "node-status": { - "schema": { - "type": "object", - "additionalProperties": false - } - }, - "response-rewrite": { - "schema": { - "additionalProperties": false, - "properties": { - "body": { - "type": "string", - "description": "new body for response" + "inactive_timeout": { + "default": 5, + "minimum": 1, + "type": "integer" }, - "body_base64": { - "description": "whether new body for response need base64 decode before return", - "type": "boolean", - "default": false + "include_req_body": { + "default": false, + "type": "boolean" }, - "headers": { - "description": "new headers for response", - "type": "object", - "minProperties": 1 + "name": { + "default": "udp logger", + "type": "string" }, - "status_code": { - "maximum": 598, - "description": "new status code for response", - "type": "integer", - "minimum": 200 + "port": { + "minimum": 0, + "type": "integer" + }, + "timeout": { + "default": 3, + "minimum": 1, + "type": "integer" } }, - "type": "object", - "minProperties": 1 + "required": ["host", "port"], + "type": "object" } }, - "referer-restriction": { + "uri-blocker": { "schema": { - "additionalProperties": false, "properties": { - "whitelist": { + "block_rules": { "items": { - "type": "string", - "pattern": "^\\*?[0-9a-zA-Z-.]+$" + "maxLength": 4096, + "minLength": 1, + "type": "string" }, "type": "array", - "minItems": 1 + "uniqueItems": true }, - "bypass_missing": { - "type": "boolean", - "default": false + "rejected_code": { + "default": 403, + "minimum": 200, + "type": "integer" } }, - "type": "object", - "required": ["whitelist"] + "required": ["block_rules"], + "type": "object" } }, - "jwt-auth": { - "consumer_schema": { - "required": ["key"], - "additionalProperties": false, - "type": "object", + "wolf-rbac": { + "schema": { "properties": { - "algorithm": { - "default": "HS256", - "type": "string", - "enum": ["HS256", "HS512", "RS256"] - }, - "exp": { - "default": 86400, - "type": "integer", - "minimum": 1 - }, - "private_key": { - "type": "string" - }, - "base64_secret": { - "type": "boolean", - "default": false - }, - "public_key": { + "appid": { + "default": "unset", "type": "string" }, - "secret": { + "header_prefix": { + "default": "X-", "type": "string" }, - "key": { + "server": { + "default": "http://127.0.0.1:10080", "type": "string" } - } - }, - "schema": { - "additionalProperties": false, - "type": "object", - "properties": {} - } - }, - "limit-req": { - "schema": { - "properties": { - "rate": { - "type": "number", - "minimum": 0 - }, - "rejected_code": { - "default": 503, - "type": "integer", - "minimum": 200 - }, - "burst": { - "type": "number", - "minimum": 0 - }, - "key": { - "type": "string", - "enum": ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] - } }, - "type": "object", - "required": ["rate", "burst", "key"] + "type": "object" } }, - "cors": { + "zipkin": { "schema": { - "type": "object", "properties": { - "allow_credential": { - "description": "allow client append credential. according to CORS specification,if you set this option to 'true', you can not use '*' for other options.", - "type": "boolean", - "default": false - }, - "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": "*" - }, - "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 + "endpoint": { + "type": "string" }, - "expose_headers": { - "description": "you can use '*' to expose all header when no credentials,multiple header use ',' to split. default: *.", - "type": "string", - "default": "*" + "sample_ratio": { + "maximum": 1, + "minimum": 0.00001, + "type": "number" }, - "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": "*" + "server_addr": { + "description": "default is $server_addr, you can specify your external ip address", + "pattern": "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", + "type": "string" }, - "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": "*" + "service_name": { + "default": "APISIX", + "description": "service name for zipkin reporter", + "type": "string" } - } + }, + "required": ["endpoint", "sample_ratio"], + "type": "object" } } } From 0298d916b0c83086e874d4d7ce34dbef54ea372f Mon Sep 17 00:00:00 2001 From: liuxiran Date: Fri, 18 Dec 2020 14:38:26 +0800 Subject: [PATCH 3/4] fix: unit test remote_addr validate pattern --- api/internal/core/store/validate_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/internal/core/store/validate_test.go b/api/internal/core/store/validate_test.go index fd38dbfc4e..53da1adbc4 100644 --- a/api/internal/core/store/validate_test.go +++ b/api/internal/core/store/validate_test.go @@ -362,7 +362,7 @@ func TestAPISIXJsonSchemaValidator_Route_checkRemoteAddr(t *testing.T) { }, "remote_addr": "127.0.0." }`, - wantValidateErr: fmt.Errorf("schema validate failed: remote_addr: Must validate at least one schema (anyOf)\nremote_addr: Does not match pattern '^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$'"), + wantValidateErr: fmt.Errorf("schema validate failed: remote_addr: Must validate at least one schema (anyOf)\nremote_addr: Does not match pattern 'ipv4'"), }, { caseDesc: "correct remote_addrs", @@ -395,7 +395,7 @@ func TestAPISIXJsonSchemaValidator_Route_checkRemoteAddr(t *testing.T) { }, "remote_addrs": ["127.0.0.", "192.0.0.0/128", "::1"] }`, - wantValidateErr: fmt.Errorf("schema validate failed: remote_addrs.0: Must validate at least one schema (anyOf)\nremote_addrs.0: Does not match pattern '^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$'\nremote_addrs.1: Must validate at least one schema (anyOf)\nremote_addrs.1: Does not match pattern '^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$'"), + wantValidateErr: fmt.Errorf("schema validate failed: remote_addrs.0: Must validate at least one schema (anyOf)\nremote_addrs.0: Does not match pattern 'ipv4'\nremote_addrs.1: Must validate at least one schema (anyOf)\nremote_addrs.1: Does not match pattern 'ipv4'"), }, { caseDesc: "invalid remote_addrs (an empty string item)", From 7321b77fa63462260a34d66ace9a9e7a7ffb2e31 Mon Sep 17 00:00:00 2001 From: liuxiran Date: Fri, 18 Dec 2020 14:55:20 +0800 Subject: [PATCH 4/4] fix: update remote_addr validate failed msg --- api/internal/core/store/validate_test.go | 6 +++--- api/test/e2e/route_remote_addr_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/internal/core/store/validate_test.go b/api/internal/core/store/validate_test.go index 53da1adbc4..b50586d258 100644 --- a/api/internal/core/store/validate_test.go +++ b/api/internal/core/store/validate_test.go @@ -362,7 +362,7 @@ func TestAPISIXJsonSchemaValidator_Route_checkRemoteAddr(t *testing.T) { }, "remote_addr": "127.0.0." }`, - wantValidateErr: fmt.Errorf("schema validate failed: remote_addr: Must validate at least one schema (anyOf)\nremote_addr: Does not match pattern 'ipv4'"), + wantValidateErr: fmt.Errorf("schema validate failed: remote_addr: Must validate at least one schema (anyOf)\nremote_addr: Does not match format 'ipv4'"), }, { caseDesc: "correct remote_addrs", @@ -395,7 +395,7 @@ func TestAPISIXJsonSchemaValidator_Route_checkRemoteAddr(t *testing.T) { }, "remote_addrs": ["127.0.0.", "192.0.0.0/128", "::1"] }`, - wantValidateErr: fmt.Errorf("schema validate failed: remote_addrs.0: Must validate at least one schema (anyOf)\nremote_addrs.0: Does not match pattern 'ipv4'\nremote_addrs.1: Must validate at least one schema (anyOf)\nremote_addrs.1: Does not match pattern 'ipv4'"), + wantValidateErr: fmt.Errorf("schema validate failed: remote_addrs.0: Must validate at least one schema (anyOf)\nremote_addrs.0: Does not match format 'ipv4'\nremote_addrs.1: Must validate at least one schema (anyOf)\nremote_addrs.1: Does not match format 'ipv4'"), }, { caseDesc: "invalid remote_addrs (an empty string item)", @@ -412,7 +412,7 @@ func TestAPISIXJsonSchemaValidator_Route_checkRemoteAddr(t *testing.T) { }, "remote_addrs": [""] }`, - wantValidateErr: fmt.Errorf("schema validate failed: invalid field remote_addrs"), + wantValidateErr: fmt.Errorf("schema validate failed: remote_addrs.0: Must validate at least one schema (anyOf)\nremote_addrs.0: Does not match format 'ipv4'"), }, } diff --git a/api/test/e2e/route_remote_addr_test.go b/api/test/e2e/route_remote_addr_test.go index 8cdf6e3225..7bceed0e79 100644 --- a/api/test/e2e/route_remote_addr_test.go +++ b/api/test/e2e/route_remote_addr_test.go @@ -42,7 +42,7 @@ func TestRoute_add_with_invalid_remote_addr(t *testing.T) { }`, Headers: map[string]string{"Authorization": token}, ExpectStatus: http.StatusBadRequest, - ExpectBody: "\"code\":10000,\"message\":\"schema validate failed: remote_addr: Must validate at least one schema (anyOf)\\nremote_addr: Does not match pattern '^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$'\"", + ExpectBody: "\"code\":10000,\"message\":\"schema validate failed: remote_addr: Must validate at least one schema (anyOf)\\nremote_addr: Does not match format 'ipv4'\"", }, { caseDesc: "verify route", @@ -72,7 +72,7 @@ func TestRoute_add_with_invalid_remote_addr(t *testing.T) { }`, Headers: map[string]string{"Authorization": token}, ExpectStatus: http.StatusBadRequest, - ExpectBody: "\"code\":10000,\"message\":\"schema validate failed: remote_addr: Must validate at least one schema (anyOf)\\nremote_addr: Does not match pattern '^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$'\"", + ExpectBody: "\"code\":10000,\"message\":\"schema validate failed: remote_addr: Must validate at least one schema (anyOf)\\nremote_addr: Does not match format 'ipv4'\"", }, { caseDesc: "verify route", @@ -102,7 +102,7 @@ func TestRoute_add_with_invalid_remote_addr(t *testing.T) { }`, Headers: map[string]string{"Authorization": token}, ExpectStatus: http.StatusBadRequest, - ExpectBody: "\"code\":10000,\"message\":\"schema validate failed: remote_addrs.1: Must validate at least one schema (anyOf)\\nremote_addrs.1: Does not match pattern '^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$'\"", + ExpectBody: "\"code\":10000,\"message\":\"schema validate failed: remote_addrs.1: Must validate at least one schema (anyOf)\\nremote_addrs.1: Does not match format 'ipv4'\"", }, { caseDesc: "verify route",