This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 02763cae0 KNOX-2746 - Add presto/presto ui support in service 
definition (#576)
02763cae0 is described below

commit 02763cae0f3f148f089d7807e49184169d2d258f
Author: Bhargavi-Sagi <[email protected]>
AuthorDate: Tue Jun 7 12:04:57 2022 +0530

    KNOX-2746 - Add presto/presto ui support in service definition (#576)
---
 .../resources/services/presto/0.261/rewrite.xml    | 36 +++++++++++++++++
 .../resources/services/presto/0.261/service.xml    | 31 +++++++++++++++
 .../resources/services/prestoui/0.261/rewrite.xml  | 45 ++++++++++++++++++++++
 .../resources/services/prestoui/0.261/service.xml  | 32 +++++++++++++++
 4 files changed, 144 insertions(+)

diff --git 
a/gateway-service-definitions/src/main/resources/services/presto/0.261/rewrite.xml
 
b/gateway-service-definitions/src/main/resources/services/presto/0.261/rewrite.xml
new file mode 100644
index 000000000..9d6e2093b
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/presto/0.261/rewrite.xml
@@ -0,0 +1,36 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<rules>
+    <rule dir="IN" name="PRESTO/presto/inbound" 
pattern="*://*:*/**/presto/{path=**}?{**}">
+      <rewrite template="{$serviceUrl[PRESTO]}/{path=**}?{**}"/>
+  </rule>
+  <rule dir="OUT" name="PRESTO/presto/uri/outbound">
+        <match pattern="*://*:*/{**}?{**}"/>
+        <rewrite template="{$frontend[url]}/presto/{**}?{**}"/>
+   </rule>
+   <filter name="PRESTO/presto/api/inbound">
+         <content type="*/*" asType="text/plain"/>
+    </filter>
+
+    <filter name="PRESTO/presto/api/outbound">
+        <content type="application/json">
+             <apply path="$.**.infoUri" rule="PRESTO/presto/uri/outbound"/>
+            <apply path="$.**.nextUri" rule="PRESTO/presto/uri/outbound"/>
+            <apply path="$.**.partialCancelUri" 
rule="PRESTO/presto/uri/outbound"/>
+        </content>
+    </filter>
+</rules>
\ No newline at end of file
diff --git 
a/gateway-service-definitions/src/main/resources/services/presto/0.261/service.xml
 
b/gateway-service-definitions/src/main/resources/services/presto/0.261/service.xml
new file mode 100644
index 000000000..74337374d
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/presto/0.261/service.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<service role="PRESTO" name="presto" version="0.261">
+    <metadata>
+        <type>API</type>
+        <context>/presto/</context>
+        <shortDesc>Presto REST API</shortDesc>
+        <description>Presto is a distributed SQL query engine designed to 
query large data sets distributed over one or more heterogeneous data 
sources</description>
+    </metadata>
+    <routes>
+        <route path="/presto/**">
+            <rewrite apply="PRESTO/presto/api/inbound" to="request.body"/>
+            <rewrite apply="PRESTO/presto/api/outbound" to="response.body"/>
+        </route>
+    </routes>
+</service>
\ No newline at end of file
diff --git 
a/gateway-service-definitions/src/main/resources/services/prestoui/0.261/rewrite.xml
 
b/gateway-service-definitions/src/main/resources/services/prestoui/0.261/rewrite.xml
new file mode 100644
index 000000000..c00359b2c
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/prestoui/0.261/rewrite.xml
@@ -0,0 +1,45 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<rules>
+    <rule dir="IN" name="PRESTOUI/prestoui/inbound" 
pattern="*://*:*/**/prestoui/">
+        <rewrite template="{$serviceUrl[PRESTOUI]}/ui/"/>
+    </rule>
+    <rule dir="IN" name="PRESTOUI/prestoui/inbound" 
pattern="*://*:*/**/prestoui/{**}">
+        <rewrite template="{$serviceUrl[PRESTOUI]}/ui/{**}"/>
+    </rule>
+        <rule dir="IN" name="PRESTOUI/prestoui/inbound/presto/vendor" 
pattern="*://*:*/**/prestoui/vendor/{**}?{**}">
+        <rewrite template="{$serviceUrl[PRESTOUI]}/ui/vendor/{**}?{**}"/>
+    </rule>
+    <rule dir="IN" name="PRESTOUI/prestoui/inbound/presto/assets" 
pattern="*://*:*/**/prestoui/assets/{**}?{**}">
+        <rewrite template="{$serviceUrl[PRESTOUI]}/ui/assets/{**}?{**}"/>
+    </rule>
+
+    <rule dir="IN" name="PRESTOUI/prestoui/inbound/presto/dist" 
pattern="*://*:*/**/prestoui/dist/{**}?{**}">
+        <rewrite template="{$serviceUrl[PRESTOUI]}/ui/dist/{**}?{**}"/>
+    </rule>
+    <rule dir="IN" name="PRESTOUI/prestoui/inbound/presto/api" 
pattern="*://*:*/**/prestoui/v1/{**}?{**}">
+        <rewrite template="{$serviceUrl[PRESTOUI]}/v1/{**}?{**}"/>
+    </rule>
+        <rule dir="OUT" name="PRESTOUI/prestoui/outbound/api" 
pattern="/v1/{**}">
+         <rewrite template="{$frontend[url]}/prestoui/v1/{**}"/>
+    </rule>
+        <filter name="PRESTOUI/prestoui/outbound/body">
+        <content type="application/javascript">
+        <apply path="/v1/[\w]+" rule="PRESTOUI/prestoui/outbound/api"/>
+        </content>
+    </filter>
+</rules>
\ No newline at end of file
diff --git 
a/gateway-service-definitions/src/main/resources/services/prestoui/0.261/service.xml
 
b/gateway-service-definitions/src/main/resources/services/prestoui/0.261/service.xml
new file mode 100644
index 000000000..f3c4114db
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/prestoui/0.261/service.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<service role="PRESTOUI" name="prestoui" version="0.261">
+    <metadata>
+        <type>UI</type>
+        <context>/presto/</context>
+        <shortDesc>Presto Web UI</shortDesc>
+        <description>Presto is a distributed SQL query engine designed to 
query large data sets distributed over one or more heterogeneous data sources. 
It provides a web UI for monitoring a Presto cluster and managing 
queries.</description>
+    </metadata>
+    <routes>
+        <route path="/prestoui/"/>
+        <route path="/prestoui/**">
+            <rewrite apply="PRESTOUI/prestoui/outbound/body"  
to="response.body"/>
+        </route>
+        <route path="/prestoui/**?**"/>
+    </routes>
+</service>
\ No newline at end of file

Reply via email to