From 80320193527d24c33ce67da99521a4cdd6631edc Mon Sep 17 00:00:00 2001 From: Hussein Ait-Lahcen Date: Wed, 24 Apr 2019 15:28:10 +0200 Subject: add(dhall): introduce pre-function plugin --- dhall/server/service/plugin/Config.dhall | 11 +++++------ dhall/server/service/plugin/functions.dhall | 6 ++++++ dhall/server/service/plugin/mkPreFunction.dhall | 9 +++++++++ dhall/server/service/plugin/package.dhall | 7 +------ 4 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 dhall/server/service/plugin/functions.dhall create mode 100644 dhall/server/service/plugin/mkPreFunction.dhall diff --git a/dhall/server/service/plugin/Config.dhall b/dhall/server/service/plugin/Config.dhall index ea53361..1f60080 100644 --- a/dhall/server/service/plugin/Config.dhall +++ b/dhall/server/service/plugin/Config.dhall @@ -1,9 +1,8 @@ < CorrelationId : - { header_name : Text, echo_downstream : Bool, generator : Text } -| RequestTransformer : - { add : { headers : List Text } } + { header_name : Text, echo_downstream : Bool, generator : Text } +| RequestTransformer : { add : { headers : List Text } } | RequestTermination : - { status_code : Natural, content_type : Text, body : Text } -| IPRestriction : - { whitelist : Text } + { status_code : Natural, content_type : Text, body : Text } +| IPRestriction : { whitelist : Text } +| PreFunction : { functions : List Text } > diff --git a/dhall/server/service/plugin/functions.dhall b/dhall/server/service/plugin/functions.dhall new file mode 100644 index 0000000..a7b1295 --- /dev/null +++ b/dhall/server/service/plugin/functions.dhall @@ -0,0 +1,6 @@ +{ mkRequestTermination = ./mkRequestTermination.dhall +, mkRequestTransformer = ./mkRequestTransformer.dhall +, mkIPRestriction = ./mkIPRestriction.dhall +, correlationId = ./correlationId.dhall +, mkPreFunction = ./mkPreFunction.dhall +} diff --git a/dhall/server/service/plugin/mkPreFunction.dhall b/dhall/server/service/plugin/mkPreFunction.dhall new file mode 100644 index 0000000..ff4f734 --- /dev/null +++ b/dhall/server/service/plugin/mkPreFunction.dhall @@ -0,0 +1,9 @@ +let Plugin = ./Plugin.dhall + +let config = ./Config.dhall + +in λ(functions : List Text) + → { name = "pre-function" + , config = config.PreFunction { functions = functions } + } + : Plugin diff --git a/dhall/server/service/plugin/package.dhall b/dhall/server/service/plugin/package.dhall index 872c53b..c231bc6 100644 --- a/dhall/server/service/plugin/package.dhall +++ b/dhall/server/service/plugin/package.dhall @@ -1,6 +1 @@ -{ Type = ./Plugin.dhall -, mkRequestTermination = ./mkRequestTermination.dhall -, mkRequestTransformer = ./mkRequestTransformer.dhall -, mkIPRestriction = ./mkIPRestriction.dhall -, correlationId = ./correlationId.dhall -} +{ Type = ./Plugin.dhall, functions = ./functions.dhall } -- cgit v1.2.3