From 3906d547efd3c011e8c0f1d72da468b64c5158c2 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Mon, 27 Nov 2017 18:19:18 -0800 Subject: [PATCH] docs: lua filter (#279) Signed-off-by: Matt Klein --- api/BUILD | 1 + api/filter/http/lua.proto | 14 +++++++++---- docs/build.sh | 1 + docs/root/api-v1/http_filters/lua_filter.rst | 21 +++++++++++++++++++ docs/root/api-v2/filter/http/http.rst | 3 ++- .../configuration/http_filters/lua_filter.rst | 16 ++------------ 6 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 docs/root/api-v1/http_filters/lua_filter.rst diff --git a/api/BUILD b/api/BUILD index d53e120f..db684cf9 100644 --- a/api/BUILD +++ b/api/BUILD @@ -147,6 +147,7 @@ proto_library( ":protocol", ":rds", "//api/filter/accesslog:accesslog", + "//api/filter/http:lua", "//api/filter/network:http_connection_manager", "//api/filter/network:mongo_proxy", ], diff --git a/api/filter/http/lua.proto b/api/filter/http/lua.proto index 53e1bd46..6bfe7937 100644 --- a/api/filter/http/lua.proto +++ b/api/filter/http/lua.proto @@ -2,9 +2,15 @@ syntax = "proto3"; package envoy.api.v2.filter.http; -// The Lua filter allows for generic scripting in an HTTP filter context. -// TODO(mattklein123): Link to filter docs. +import "validate/validate.proto"; + +// [#protodoc-title: Lua] +// Lua :ref:`configuration overview `. + message Lua { - // The Lua code to execute. - string inline_code = 1; + // The Lua code that Envoy will execute. This can be a very small script that + // further loads code from disk if desired. Note that if JSON configuration is used, the code must + // be properly escaped. YAML configuration may be easier to read since YAML supports multi-line + // strings so complex scripts can be easily expressed inline in the configuration. + string inline_code = 1 [(validate.rules).string.min_len = 1]; } diff --git a/docs/build.sh b/docs/build.sh index 9529c72c..ad34a5a1 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -38,6 +38,7 @@ PROTO_RST=" /api/sds/api/sds.proto.rst /api/filter/accesslog/accesslog/api/filter/accesslog/accesslog.proto.rst /api/filter/fault/api/filter/fault.proto.rst + /api/filter/http/lua/api/filter/http/lua.proto.rst /api/filter/network/http_connection_manager/api/filter/network/http_connection_manager.proto.rst /api/filter/network/mongo_proxy/api/filter/network/mongo_proxy.proto.rst /api/protocol/api/protocol.proto.rst diff --git a/docs/root/api-v1/http_filters/lua_filter.rst b/docs/root/api-v1/http_filters/lua_filter.rst new file mode 100644 index 00000000..bf9b15ab --- /dev/null +++ b/docs/root/api-v1/http_filters/lua_filter.rst @@ -0,0 +1,21 @@ +.. _config_http_filters_lua_v1: + +Lua +=== + +Lua :ref:`configuration overview `. + +.. code-block:: json + + { + "name": "lua", + "config": { + "inline_code": "..." + } + } + +inline_code + *(required, string)* The Lua code that Envoy will execute. This can be a very small script that + further loads code from disk if desired. Note that if JSON configuration is used, the code must + be properly escaped. YAML configuration may be easier to read since YAML supports multi-line + strings so complex scripts can be easily expressed inline in the configuration. diff --git a/docs/root/api-v2/filter/http/http.rst b/docs/root/api-v2/filter/http/http.rst index 694d234b..9347ceaf 100644 --- a/docs/root/api-v2/filter/http/http.rst +++ b/docs/root/api-v2/filter/http/http.rst @@ -8,4 +8,5 @@ HTTP filters .. toctree:: :glob: :maxdepth: 2 - + + * diff --git a/docs/root/configuration/http_filters/lua_filter.rst b/docs/root/configuration/http_filters/lua_filter.rst index 72f5ae52..a20a6643 100644 --- a/docs/root/configuration/http_filters/lua_filter.rst +++ b/docs/root/configuration/http_filters/lua_filter.rst @@ -55,20 +55,8 @@ API. Configuration ------------- -.. code-block:: json - - { - "name": "lua", - "config": { - "inline_code": "..." - } - } - -inline_code - *(required, string)* The Lua code that Envoy will execute. This can be a very small script that - further loads code from disk if desired. Note that if JSON configuration is used, the code must - be properly escaped. YAML configuration may be easier to read since YAML supports multi-line - strings so complex scripts can be easily expressed inline in the configuration. +* :ref:`v1 configuration ` +* :ref:`v2 configuration ` Script examples ---------------