diff --git a/cloud/docker-image/pom.xml b/cloud/docker-image/pom.xml index dda2c6b6a5..0b37392348 100644 --- a/cloud/docker-image/pom.xml +++ b/cloud/docker-image/pom.xml @@ -199,12 +199,6 @@ ${project.version} runtime - - ${project.groupId} - command-generate - ${project.version} - runtime - ${project.groupId} command-metrics diff --git a/cloud/docker-image/src/main/docker/zpm.json.template b/cloud/docker-image/src/main/docker/zpm.json.template index 392e048a10..46961f11bb 100644 --- a/cloud/docker-image/src/main/docker/zpm.json.template +++ b/cloud/docker-image/src/main/docker/zpm.json.template @@ -42,7 +42,6 @@ "io.aklivity.zilla:common", "io.aklivity.zilla:command", "io.aklivity.zilla:command-dump", - "io.aklivity.zilla:command-generate", "io.aklivity.zilla:command-metrics", "io.aklivity.zilla:command-start", "io.aklivity.zilla:command-stop", diff --git a/incubator/command-generate/COPYRIGHT b/incubator/command-generate/COPYRIGHT deleted file mode 100644 index 0cb10b6f62..0000000000 --- a/incubator/command-generate/COPYRIGHT +++ /dev/null @@ -1,12 +0,0 @@ -Copyright ${copyrightYears} Aklivity Inc - -Licensed under the Aklivity Community License (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - - https://www.aklivity.io/aklivity-community-license/ - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. diff --git a/incubator/command-generate/LICENSE b/incubator/command-generate/LICENSE deleted file mode 100644 index f6abb6327b..0000000000 --- a/incubator/command-generate/LICENSE +++ /dev/null @@ -1,114 +0,0 @@ - Aklivity Community License Agreement - Version 1.0 - -This Aklivity Community License Agreement Version 1.0 (the “Agreement”) sets -forth the terms on which Aklivity, Inc. (“Aklivity”) makes available certain -software made available by Aklivity under this Agreement (the “Software”). BY -INSTALLING, DOWNLOADING, ACCESSING, USING OR DISTRIBUTING ANY OF THE SOFTWARE, -YOU AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO -SUCH TERMS AND CONDITIONS, YOU MUST NOT USE THE SOFTWARE. IF YOU ARE RECEIVING -THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU -HAVE THE ACTUAL AUTHORITY TO AGREE TO THE TERMS AND CONDITIONS OF THIS -AGREEMENT ON BEHALF OF SUCH ENTITY. “Licensee” means you, an individual, or -the entity on whose behalf you are receiving the Software. - - 1. LICENSE GRANT AND CONDITIONS. - - 1.1 License. Subject to the terms and conditions of this Agreement, - Aklivity hereby grants to Licensee a non-exclusive, royalty-free, - worldwide, non-transferable, non-sublicenseable license during the term - of this Agreement to: (a) use the Software; (b) prepare modifications and - derivative works of the Software; (c) distribute the Software (including - without limitation in source code or object code form); and (d) reproduce - copies of the Software (the “License”). Licensee is not granted the - right to, and Licensee shall not, exercise the License for an Excluded - Purpose. For purposes of this Agreement, “Excluded Purpose” means making - available any software-as-a-service, platform-as-a-service, - infrastructure-as-a-service or other similar online service that competes - with Aklivity products or services that provide the Software. - - 1.2 Conditions. In consideration of the License, Licensee’s distribution - of the Software is subject to the following conditions: - - (a) Licensee must cause any Software modified by Licensee to carry - prominent notices stating that Licensee modified the Software. - - (b) On each Software copy, Licensee shall reproduce and not remove or - alter all Aklivity or third party copyright or other proprietary - notices contained in the Software, and Licensee must provide the - notice below with each copy. - - “This software is made available by Aklivity, Inc., under the - terms of the Aklivity Community License Agreement, Version 1.0 - located at http://www.Aklivity.io/Aklivity-community-license. BY - INSTALLING, DOWNLOADING, ACCESSING, USING OR DISTRIBUTING ANY OF - THE SOFTWARE, YOU AGREE TO THE TERMS OF SUCH LICENSE AGREEMENT.” - - 1.3 Licensee Modifications. Licensee may add its own copyright notices - to modifications made by Licensee and may provide additional or different - license terms and conditions for use, reproduction, or distribution of - Licensee’s modifications. While redistributing the Software or - modifications thereof, Licensee may choose to offer, for a fee or free of - charge, support, warranty, indemnity, or other obligations. Licensee, and - not Aklivity, will be responsible for any such obligations. - - 1.4 No Sublicensing. The License does not include the right to - sublicense the Software, however, each recipient to which Licensee - provides the Software may exercise the Licenses so long as such recipient - agrees to the terms and conditions of this Agreement. - - 2. TERM AND TERMINATION. This Agreement will continue unless and until - earlier terminated as set forth herein. If Licensee breaches any of its - conditions or obligations under this Agreement, this Agreement will - terminate automatically and the License will terminate automatically and - permanently. - - 3. INTELLECTUAL PROPERTY. As between the parties, Aklivity will retain all - right, title, and interest in the Software, and all intellectual property - rights therein. Aklivity hereby reserves all rights not expressly granted - to Licensee in this Agreement. Aklivity hereby reserves all rights in its - trademarks and service marks, and no licenses therein are granted in this - Agreement. - - 4. DISCLAIMER. Aklivity HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND - CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY - DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR - PURPOSE, WITH RESPECT TO THE SOFTWARE. - - 5. LIMITATION OF LIABILITY. Aklivity WILL NOT BE LIABLE FOR ANY DAMAGES OF - ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, - SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL - APPLY TO THE EXTENT PERMITTED BY APPLICABLE LAW. - - 6.GENERAL. - - 6.1 Governing Law. This Agreement will be governed by and interpreted in - accordance with the laws of the state of California, without reference to - its conflict of laws principles. If Licensee is located within the - United States, all disputes arising out of this Agreement are subject to - the exclusive jurisdiction of courts located in Santa Clara County, - California. USA. If Licensee is located outside of the United States, - any dispute, controversy or claim arising out of or relating to this - Agreement will be referred to and finally determined by arbitration in - accordance with the JAMS International Arbitration Rules. The tribunal - will consist of one arbitrator. The place of arbitration will be Palo - Alto, California. The language to be used in the arbitral proceedings - will be English. Judgment upon the award rendered by the arbitrator may - be entered in any court having jurisdiction thereof. - - 6.2 Assignment. Licensee is not authorized to assign its rights under - this Agreement to any third party. Aklivity may freely assign its rights - under this Agreement to any third party. - - 6.3 Other. This Agreement is the entire agreement between the parties - regarding the subject matter hereof. No amendment or modification of - this Agreement will be valid or binding upon the parties unless made in - writing and signed by the duly authorized representatives of both - parties. In the event that any provision, including without limitation - any condition, of this Agreement is held to be unenforceable, this - Agreement and all licenses and rights granted hereunder will immediately - terminate. Waiver by Aklivity of a breach of any provision of this - Agreement or the failure by Aklivity to exercise any right hereunder - will not be construed as a waiver of any subsequent breach of that right - or as a waiver of any other right. \ No newline at end of file diff --git a/incubator/command-generate/NOTICE b/incubator/command-generate/NOTICE deleted file mode 100644 index 17478992e3..0000000000 --- a/incubator/command-generate/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -Licensed under the Aklivity Community License (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - - https://www.aklivity.io/aklivity-community-license/ - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. - -This project includes: - Jackson-annotations under The Apache Software License, Version 2.0 - Jackson-core under The Apache Software License, Version 2.0 - jackson-databind under The Apache Software License, Version 2.0 - Jackson-dataformat-YAML under The Apache Software License, Version 2.0 - SnakeYAML under Apache License, Version 2.0 - diff --git a/incubator/command-generate/NOTICE.template b/incubator/command-generate/NOTICE.template deleted file mode 100644 index 209ca12f74..0000000000 --- a/incubator/command-generate/NOTICE.template +++ /dev/null @@ -1,13 +0,0 @@ -Licensed under the Aklivity Community License (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - - https://www.aklivity.io/aklivity-community-license/ - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. - -This project includes: -#GENERATED_NOTICES# diff --git a/incubator/command-generate/mvnw b/incubator/command-generate/mvnw deleted file mode 100755 index d2f0ea3808..0000000000 --- a/incubator/command-generate/mvnw +++ /dev/null @@ -1,310 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/incubator/command-generate/mvnw.cmd b/incubator/command-generate/mvnw.cmd deleted file mode 100644 index b26ab24f03..0000000000 --- a/incubator/command-generate/mvnw.cmd +++ /dev/null @@ -1,182 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" - -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/incubator/command-generate/pom.xml b/incubator/command-generate/pom.xml deleted file mode 100644 index 3ea2a400e7..0000000000 --- a/incubator/command-generate/pom.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - 4.0.0 - - io.aklivity.zilla - incubator - develop-SNAPSHOT - ../pom.xml - - - command-generate - zilla::incubator::command-generate - - - - Aklivity Community License Agreement - https://www.aklivity.io/aklivity-community-license/ - repo - - - - - 11 - 11 - 0.60 - 4 - - - - - ${project.groupId} - engine.spec - ${project.version} - provided - - - ${project.groupId} - engine - ${project.version} - provided - - - ${project.groupId} - command - ${project.version} - provided - - - io.aklivity.zilla - binding-http - ${project.version} - provided - - - io.aklivity.zilla - binding-mqtt - ${project.version} - provided - - - io.aklivity.zilla - binding-tcp - ${project.version} - provided - - - io.aklivity.zilla - binding-tls - ${project.version} - provided - - - io.aklivity.zilla - guard-jwt - ${project.version} - provided - - - io.aklivity.zilla - catalog-inline - ${project.version} - provided - - - io.aklivity.zilla - model-avro - ${project.version} - provided - - - io.aklivity.zilla - model-core - ${project.version} - provided - - - io.aklivity.zilla - model-json - ${project.version} - provided - - - io.aklivity.zilla - model-protobuf - ${project.version} - provided - - - io.aklivity.zilla - vault-filesystem - ${project.version} - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - 2.16.1 - - - org.junit.jupiter - junit-jupiter-engine - test - - - - - - - org.jasig.maven - maven-notice-plugin - - - com.mycila - license-maven-plugin - - - src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/**/* - src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/**/* - - - - - maven-checkstyle-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - - - org.moditect - moditect-maven-plugin - - - org.apache.maven.plugins - maven-failsafe-plugin - - - org.jacoco - jacoco-maven-plugin - - - io/aklivity/zilla/runtime/command/generate/internal/types/**/*.class - io/aklivity/zilla/runtime/command/generate/internal/openapi/model/*.class - io/aklivity/zilla/runtime/command/generate/internal/openapi/model2/*.class - io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/*.class - io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model2/*.class - - - - BUNDLE - - - INSTRUCTION - COVEREDRATIO - ${jacoco.coverage.ratio} - - - CLASS - MISSEDCOUNT - ${jacoco.missed.count} - - - - - - - - ${project.groupId} - flyweight-maven-plugin - ${project.version} - - core - io.aklivity.zilla.runtime.command.generate.internal.types - - - - - generate - - - - - - - diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/ZillaConfigCommandSpi.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/ZillaConfigCommandSpi.java deleted file mode 100644 index eb2b22b544..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/ZillaConfigCommandSpi.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal; - -import com.github.rvesse.airline.builder.CliBuilder; - -import io.aklivity.zilla.runtime.command.ZillaCommandSpi; -import io.aklivity.zilla.runtime.command.generate.internal.airline.ZillaConfigCommand; -import io.aklivity.zilla.runtime.common.feature.Incubating; - -@Incubating -public class ZillaConfigCommandSpi implements ZillaCommandSpi -{ - @Override - public void mixin( - CliBuilder builder) - { - builder.withCommand(ZillaConfigCommand.class); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ConfigGenerator.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ConfigGenerator.java deleted file mode 100644 index 836a0d113e..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ConfigGenerator.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.airline; - -import static org.agrona.LangUtil.rethrowUnchecked; - -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import jakarta.json.bind.Jsonb; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; - -import io.aklivity.zilla.runtime.engine.config.ModelConfig; -import io.aklivity.zilla.runtime.model.core.config.Int32ModelConfig; -import io.aklivity.zilla.runtime.model.core.config.StringModelConfig; - -public abstract class ConfigGenerator -{ - protected static final String INLINE_CATALOG_NAME = "catalog0"; - protected static final String INLINE_CATALOG_TYPE = "inline"; - protected static final String APPLICATION_JSON = "application/json"; - protected static final String VERSION_LATEST = "latest"; - protected static final Pattern JSON_CONTENT_TYPE = Pattern.compile("^application/(?:.+\\+)?json$"); - - protected final Map models = Map.of( - "string", StringModelConfig.builder().build(), - "integer", Int32ModelConfig.builder().build() - ); - protected final Matcher jsonContentType = JSON_CONTENT_TYPE.matcher(""); - - public abstract String generate(); - - protected static String writeSchemaYaml( - Jsonb jsonb, - YAMLMapper yaml, - Object schema) - { - String result = null; - try - { - String schemaJson = jsonb.toJson(schema); - JsonNode json = new ObjectMapper().readTree(schemaJson); - result = yaml.writeValueAsString(json); - } - catch (JsonProcessingException ex) - { - rethrowUnchecked(ex); - } - return result; - } - - protected final String unquoteEnvVars( - String yaml, - List unquotedEnvVars) - { - for (String envVar : unquotedEnvVars) - { - yaml = yaml.replaceAll( - Pattern.quote(String.format("\"${{env.%s}}\"", envVar)), - String.format("\\${{env.%s}}", envVar) - ); - } - return yaml; - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ZillaConfigCommand.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ZillaConfigCommand.java deleted file mode 100644 index c0a08a7400..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ZillaConfigCommand.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.airline; - -import static org.agrona.LangUtil.rethrowUnchecked; - -import java.io.FileInputStream; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Map; -import java.util.function.Function; - -import com.github.rvesse.airline.annotations.Command; -import com.github.rvesse.airline.annotations.Option; -import com.github.rvesse.airline.annotations.restrictions.AllowedValues; -import com.github.rvesse.airline.annotations.restrictions.Required; - -import io.aklivity.zilla.runtime.command.ZillaCommand; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.http.proxy.AsyncApiHttpProxyConfigGenerator; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.mqtt.proxy.AsyncApiMqttProxyConfigGenerator; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.http.proxy.OpenApiHttpProxyConfigGenerator; - -@Command(name = "generate", description = "Generate configuration file") -public final class ZillaConfigCommand extends ZillaCommand -{ - private static final Map> GENERATORS = Map.of( - "openapi.http.proxy", OpenApiHttpProxyConfigGenerator::new, - "asyncapi.http.proxy", AsyncApiHttpProxyConfigGenerator::new, - "asyncapi.mqtt.proxy", AsyncApiMqttProxyConfigGenerator::new - ); - - @Option(name = {"-t", "--template"}, - description = "Template name") - @Required - @AllowedValues(allowedValues = { - "openapi.http.proxy", - "asyncapi.http.proxy", - "asyncapi.mqtt.proxy" - }) - public String template; - - @Option(name = {"-i", "--input"}, - description = "Input filename", - typeConverterProvider = ZillaConfigCommandPathConverterProvider.class) - public Path input; - - @Option(name = {"-o", "--output"}, - description = "Output filename", - typeConverterProvider = ZillaConfigCommandPathConverterProvider.class) - public Path output = Paths.get("zilla.yaml"); - - @Override - public void run() - { - try (InputStream inputStream = new FileInputStream(input.toFile())) - { - ConfigGenerator generator = GENERATORS.get(template).apply(inputStream); - Files.writeString(output, generator.generate()); - } - catch (Exception ex) - { - ex.printStackTrace(); - rethrowUnchecked(ex); - } - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ZillaConfigCommandPathConverterProvider.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ZillaConfigCommandPathConverterProvider.java deleted file mode 100644 index 403fdc7755..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/airline/ZillaConfigCommandPathConverterProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.airline; - -import java.nio.file.Paths; - -import com.github.rvesse.airline.model.ArgumentsMetadata; -import com.github.rvesse.airline.model.OptionMetadata; -import com.github.rvesse.airline.parser.ParseState; -import com.github.rvesse.airline.types.TypeConverter; -import com.github.rvesse.airline.types.TypeConverterProvider; -import com.github.rvesse.airline.types.numerics.NumericTypeConverter; - -public final class ZillaConfigCommandPathConverterProvider implements TypeConverterProvider -{ - private final ZillaDumpCommandPathConverter converter = new ZillaDumpCommandPathConverter(); - - private final class ZillaDumpCommandPathConverter implements TypeConverter - { - @Override - public void setNumericConverter( - NumericTypeConverter converter) - { - } - - @Override - public Object convert( - String name, - Class type, - String value) - { - return Paths.get(value); - } - } - - @Override - public TypeConverter getTypeConverter( - OptionMetadata option, - ParseState state) - { - return converter; - } - - @Override - public TypeConverter getTypeConverter( - ArgumentsMetadata arguments, - ParseState state) - { - return converter; - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/AsyncApiConfigGenerator.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/AsyncApiConfigGenerator.java deleted file mode 100644 index 243d29dcaa..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/AsyncApiConfigGenerator.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi; - -import static com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature.MINIMIZE_QUOTES; -import static com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature.WRITE_DOC_START_MARKER; -import static org.agrona.LangUtil.rethrowUnchecked; - -import java.util.Map; - -import jakarta.json.bind.Jsonb; -import jakarta.json.bind.JsonbBuilder; - -import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; - -import io.aklivity.zilla.runtime.catalog.inline.config.InlineOptionsConfig; -import io.aklivity.zilla.runtime.catalog.inline.config.InlineSchemaConfigBuilder; -import io.aklivity.zilla.runtime.command.generate.internal.airline.ConfigGenerator; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.AsyncApi; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Message; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Schema; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view.MessageView; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view.SchemaView; -import io.aklivity.zilla.runtime.engine.config.NamespaceConfigBuilder; - -public abstract class AsyncApiConfigGenerator extends ConfigGenerator -{ - protected AsyncApi asyncApi; - - protected boolean hasJsonContentType() - { - String contentType = null; - if (asyncApi.components != null && asyncApi.components.messages != null && !asyncApi.components.messages.isEmpty()) - { - Message firstMessage = asyncApi.components.messages.entrySet().stream().findFirst().get().getValue(); - contentType = MessageView.of(asyncApi.components.messages, firstMessage).contentType(); - } - return contentType != null && jsonContentType.reset(contentType).matches(); - } - - protected NamespaceConfigBuilder injectCatalog( - NamespaceConfigBuilder namespace) - { - if (asyncApi.components != null && asyncApi.components.schemas != null && !asyncApi.components.schemas.isEmpty()) - { - namespace - .catalog() - .name(INLINE_CATALOG_NAME) - .type(INLINE_CATALOG_TYPE) - .options(InlineOptionsConfig::builder) - .subjects() - .inject(this::injectSubjects) - .build() - .build() - .build(); - - } - return namespace; - } - - protected InlineSchemaConfigBuilder injectSubjects( - InlineSchemaConfigBuilder subjects) - { - try (Jsonb jsonb = JsonbBuilder.create()) - { - YAMLMapper yaml = YAMLMapper.builder() - .disable(WRITE_DOC_START_MARKER) - .enable(MINIMIZE_QUOTES) - .build(); - for (Map.Entry entry : asyncApi.components.schemas.entrySet()) - { - SchemaView schema = SchemaView.of(asyncApi.components.schemas, entry.getValue()); - subjects - .subject(entry.getKey()) - .version(VERSION_LATEST) - .schema(writeSchemaYaml(jsonb, yaml, schema)) - .build(); - } - } - catch (Exception ex) - { - rethrowUnchecked(ex); - } - return subjects; - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/AsyncApiHttpProxyConfigGenerator.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/AsyncApiHttpProxyConfigGenerator.java deleted file mode 100644 index cba4f9c148..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/AsyncApiHttpProxyConfigGenerator.java +++ /dev/null @@ -1,604 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.http.proxy; - -import static io.aklivity.zilla.runtime.binding.http.config.HttpPolicyConfig.CROSS_ORIGIN; -import static io.aklivity.zilla.runtime.engine.config.KindConfig.CLIENT; -import static io.aklivity.zilla.runtime.engine.config.KindConfig.SERVER; -import static java.util.Objects.requireNonNull; -import static org.agrona.LangUtil.rethrowUnchecked; - -import java.io.InputStream; -import java.net.URI; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import jakarta.json.Json; -import jakarta.json.JsonPatch; -import jakarta.json.JsonPatchBuilder; -import jakarta.json.bind.Jsonb; -import jakarta.json.bind.JsonbBuilder; - -import io.aklivity.zilla.runtime.binding.http.config.HttpConditionConfig; -import io.aklivity.zilla.runtime.binding.http.config.HttpOptionsConfig; -import io.aklivity.zilla.runtime.binding.http.config.HttpOptionsConfigBuilder; -import io.aklivity.zilla.runtime.binding.http.config.HttpRequestConfig.Method; -import io.aklivity.zilla.runtime.binding.http.config.HttpRequestConfigBuilder; -import io.aklivity.zilla.runtime.binding.tcp.config.TcpConditionConfig; -import io.aklivity.zilla.runtime.binding.tcp.config.TcpOptionsConfig; -import io.aklivity.zilla.runtime.binding.tls.config.TlsOptionsConfig; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.AsyncApiConfigGenerator; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.AsyncApi; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Item; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Message; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Operation; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Parameter; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Server; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view.ChannelView; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view.MessageView; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view.ServerView; -import io.aklivity.zilla.runtime.engine.config.BindingConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.CatalogedConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.EngineConfig; -import io.aklivity.zilla.runtime.engine.config.EngineConfigWriter; -import io.aklivity.zilla.runtime.engine.config.GuardedConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.ModelConfig; -import io.aklivity.zilla.runtime.engine.config.NamespaceConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.RouteConfigBuilder; -import io.aklivity.zilla.runtime.guard.jwt.config.JwtOptionsConfig; -import io.aklivity.zilla.runtime.model.json.config.JsonModelConfig; -import io.aklivity.zilla.runtime.vault.filesystem.config.FileSystemOptionsConfig; - -public class AsyncApiHttpProxyConfigGenerator extends AsyncApiConfigGenerator -{ - private final InputStream input; - - private int[] allPorts; - private int[] httpPorts; - private int[] httpsPorts; - private boolean isPlainEnabled; - private boolean isTlsEnabled; - private Map securitySchemes; - private String authorizationHeader; - private boolean isJwtEnabled; - - public AsyncApiHttpProxyConfigGenerator( - InputStream input) - { - this.input = input; - } - - @Override - public String generate() - { - this.asyncApi = parseAsyncApi(input); - this.allPorts = resolveAllPorts(); - this.httpPorts = resolvePortsForScheme("http"); - this.httpsPorts = resolvePortsForScheme("https"); - this.isPlainEnabled = httpPorts != null; - this.isTlsEnabled = httpsPorts != null; - this.securitySchemes = resolveSecuritySchemes(); - this.authorizationHeader = resolveAuthorizationHeader(); - this.isJwtEnabled = !securitySchemes.isEmpty(); - EngineConfigWriter configWriter = new EngineConfigWriter(null); - String yaml = configWriter.write(createConfig(), createEnvVarsPatch()); - return unquoteEnvVars(yaml, unquotedEnvVars()); - } - - private AsyncApi parseAsyncApi( - InputStream inputStream) - { - AsyncApi asyncApi = null; - try (Jsonb jsonb = JsonbBuilder.create()) - { - asyncApi = jsonb.fromJson(inputStream, AsyncApi.class); - } - catch (Exception ex) - { - rethrowUnchecked(ex); - } - return asyncApi; - } - - private int[] resolveAllPorts() - { - int[] ports = new int[asyncApi.servers.size()]; - String[] keys = asyncApi.servers.keySet().toArray(String[]::new); - for (int i = 0; i < asyncApi.servers.size(); i++) - { - ServerView server = ServerView.of(asyncApi.servers.get(keys[i])); - URI url = server.url(); - ports[i] = url.getPort(); - } - return ports; - } - - private int[] resolvePortsForScheme( - String scheme) - { - requireNonNull(scheme); - int[] ports = null; - URI url = findFirstServerUrlWithScheme(scheme); - if (url != null) - { - ports = new int[] {url.getPort()}; - } - return ports; - } - - private URI findFirstServerUrlWithScheme( - String scheme) - { - requireNonNull(scheme); - URI result = null; - for (String key : asyncApi.servers.keySet()) - { - ServerView server = ServerView.of(asyncApi.servers.get(key)); - if (scheme.equals(server.url().getScheme())) - { - result = server.url(); - break; - } - } - return result; - } - - private Map resolveSecuritySchemes() - { - requireNonNull(asyncApi); - Map result = new HashMap<>(); - if (asyncApi.components != null && asyncApi.components.securitySchemes != null) - { - for (String securitySchemeName : asyncApi.components.securitySchemes.keySet()) - { - String guardType = asyncApi.components.securitySchemes.get(securitySchemeName).bearerFormat; - if ("jwt".equals(guardType)) - { - result.put(securitySchemeName, guardType); - } - } - } - return result; - } - - private String resolveAuthorizationHeader() - { - requireNonNull(asyncApi); - requireNonNull(asyncApi.components); - String result = null; - if (asyncApi.components.messages != null) - { - for (Map.Entry entry : asyncApi.components.messages.entrySet()) - { - Message message = entry.getValue(); - if (message.headers != null && message.headers.properties != null) - { - Item authorization = message.headers.properties.get("authorization"); - if (authorization != null) - { - result = authorization.description; - break; - } - } - } - } - return result; - } - - private EngineConfig createConfig() - { - return EngineConfig.builder() - .namespace() - .name("example") - .binding() - .name("tcp_server0") - .type("tcp") - .kind(SERVER) - .options(TcpOptionsConfig::builder) - .host("0.0.0.0") - .ports(allPorts) - .build() - .inject(this::injectPlainTcpRoute) - .inject(this::injectTlsTcpRoute) - .build() - .inject(this::injectTlsServer) - .binding() - .name("http_server0") - .type("http") - .kind(SERVER) - .options(HttpOptionsConfig::builder) - .access() - .policy(CROSS_ORIGIN) - .build() - .inject(this::injectHttpServerOptions) - .inject(this::injectHttpServerRequests) - .build() - .inject(this::injectHttpServerRoutes) - .build() - .binding() - .name("http_client0") - .type("http") - .kind(CLIENT) - .exit(isTlsEnabled ? "tls_client0" : "tcp_client0") - .build() - .inject(this::injectTlsClient) - .binding() - .name("tcp_client0") - .type("tcp") - .kind(CLIENT) - .options(TcpOptionsConfig::builder) - .host("") // env - .ports(new int[]{0}) // env - .build() - .build() - .inject(this::injectGuard) - .inject(this::injectVaults) - .inject(this::injectCatalog) - .build() - .build(); - } - - private BindingConfigBuilder injectPlainTcpRoute( - BindingConfigBuilder binding) - { - if (isPlainEnabled) - { - binding - .route() - .when(TcpConditionConfig::builder) - .ports(httpPorts) - .build() - .exit("http_server0") - .build(); - } - return binding; - } - - private BindingConfigBuilder injectTlsTcpRoute( - BindingConfigBuilder binding) - { - if (isTlsEnabled) - { - binding - .route() - .when(TcpConditionConfig::builder) - .ports(httpsPorts) - .build() - .exit("tls_server0") - .build(); - } - return binding; - } - - private NamespaceConfigBuilder injectTlsServer( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .binding() - .name("tls_server0") - .type("tls") - .kind(SERVER) - .options(TlsOptionsConfig::builder) - .keys(List.of("")) // env - .sni(List.of("")) // env - .alpn(List.of("")) // env - .build() - .vault("server") - .exit("http_server0") - .build(); - } - return namespace; - } - - private HttpOptionsConfigBuilder injectHttpServerOptions( - HttpOptionsConfigBuilder options) - { - if (isJwtEnabled) - { - options - .authorization() - .name("jwt0") - .credentials() - .header() - .name("authorization") - .pattern(authorizationHeader) - .build() - .build() - .build(); - } - return options; - } - - private HttpOptionsConfigBuilder injectHttpServerRequests( - HttpOptionsConfigBuilder options) - { - for (String name : asyncApi.operations.keySet()) - { - Operation operation = asyncApi.operations.get(name); - ChannelView channel = ChannelView.of(asyncApi.channels, operation.channel); - String path = channel.address(); - Method method = Method.valueOf(operation.bindings.get("http").method); - if (channel.messages() != null && !channel.messages().isEmpty() || - channel.parameters() != null && !channel.parameters().isEmpty()) - { - options - .request() - .path(path) - .method(method) - .inject(request -> injectContent(request, channel.messages())) - .inject(request -> injectPathParams(request, channel.parameters())) - .build(); - } - } - return options; - } - - private HttpRequestConfigBuilder injectContent( - HttpRequestConfigBuilder request, - Map messages) - { - if (messages != null) - { - if (hasJsonContentType()) - { - request. - content(JsonModelConfig::builder) - .catalog() - .name(INLINE_CATALOG_NAME) - .inject(catalog -> injectSchemas(catalog, messages)) - .build() - .build(); - } - } - return request; - } - - private CatalogedConfigBuilder injectSchemas( - CatalogedConfigBuilder catalog, - Map messages) - { - for (String name : messages.keySet()) - { - MessageView message = MessageView.of(asyncApi.components.messages, messages.get(name)); - String subject = message.refKey() != null ? message.refKey() : name; - catalog - .schema() - .subject(subject) - .build() - .build(); - } - return catalog; - } - - private HttpRequestConfigBuilder injectPathParams( - HttpRequestConfigBuilder request, - Map parameters) - { - if (parameters != null) - { - for (String name : parameters.keySet()) - { - Parameter parameter = parameters.get(name); - if (parameter.schema != null && parameter.schema.type != null) - { - ModelConfig model = models.get(parameter.schema.type); - if (model != null) - { - request - .pathParam() - .name(name) - .model(model) - .build(); - } - } - } - } - return request; - } - - - private BindingConfigBuilder injectHttpServerRoutes( - BindingConfigBuilder binding) - { - for (Map.Entry entry : asyncApi.servers.entrySet()) - { - ServerView server = ServerView.of(entry.getValue()); - for (String name : asyncApi.operations.keySet()) - { - Operation operation = asyncApi.operations.get(name); - ChannelView channel = ChannelView.of(asyncApi.channels, operation.channel); - String path = channel.address().replaceAll("\\{[^}]+\\}", "*"); - String method = operation.bindings.get("http").method; - binding - .route() - .exit("http_client0") - .when(HttpConditionConfig::builder) - .header(":scheme", server.scheme()) - .header(":authority", server.authority()) - .header(":path", path) - .header(":method", method) - .build() - .inject(route -> injectHttpServerRouteGuarded(route, server)) - .build(); - } - } - return binding; - } - - private RouteConfigBuilder injectHttpServerRouteGuarded( - RouteConfigBuilder route, - ServerView server) - { - if (server.security() != null) - { - for (Map> securityItem : server.security()) - { - for (String securityItemLabel : securityItem.keySet()) - { - if (isJwtEnabled && "jwt".equals(securitySchemes.get(securityItemLabel))) - { - route - .guarded() - .name("jwt0") - .inject(guarded -> injectGuardedRoles(guarded, securityItem.get(securityItemLabel))) - .build(); - break; - } - } - } - } - return route; - } - - private GuardedConfigBuilder injectGuardedRoles( - GuardedConfigBuilder guarded, - List roles) - { - for (String role : roles) - { - guarded.role(role); - } - return guarded; - } - - private NamespaceConfigBuilder injectTlsClient( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .binding() - .name("tls_client0") - .type("tls") - .kind(CLIENT) - .options(TlsOptionsConfig::builder) - .trust(List.of("")) // env - .sni(List.of("")) // env - .alpn(List.of("")) // env - .trustcacerts(true) - .build() - .vault("client") - .exit("tcp_client0") - .build(); - } - return namespace; - } - - private NamespaceConfigBuilder injectGuard( - NamespaceConfigBuilder namespace) - { - if (isJwtEnabled) - { - namespace - .guard() - .name("jwt0") - .type("jwt") - .options(JwtOptionsConfig::builder) - .issuer("") // env - .audience("") // env - .key() - .alg("").kty("").kid("").use("").n("").e("").crv("").x("").y("") // env - .build() - .build() - .build(); - } - return namespace; - } - - private NamespaceConfigBuilder injectVaults( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .vault() - .name("client") - .type("filesystem") - .options(FileSystemOptionsConfig::builder) - .trust() - .store("") // env - .type("") // env - .password("") // env - .build() - .build() - .build() - .vault() - .name("server") - .type("filesystem") - .options(FileSystemOptionsConfig::builder) - .keys() - .store("") // env - .type("") // env - .password("") //env - .build() - .build() - .build(); - } - return namespace; - } - - private JsonPatch createEnvVarsPatch() - { - JsonPatchBuilder patch = Json.createPatchBuilder(); - patch.replace("/bindings/tcp_client0/options/host", "${{env.TCP_CLIENT_HOST}}"); - patch.replace("/bindings/tcp_client0/options/port", "${{env.TCP_CLIENT_PORT}}"); - - if (isJwtEnabled) - { - // jwt0 guard - patch.replace("/guards/jwt0/options/issuer", "${{env.JWT_ISSUER}}"); - patch.replace("/guards/jwt0/options/audience", "${{env.JWT_AUDIENCE}}"); - patch.replace("/guards/jwt0/options/keys/0/alg", "${{env.JWT_ALG}}"); - patch.replace("/guards/jwt0/options/keys/0/kty", "${{env.JWT_KTY}}"); - patch.replace("/guards/jwt0/options/keys/0/kid", "${{env.JWT_KID}}"); - patch.replace("/guards/jwt0/options/keys/0/use", "${{env.JWT_USE}}"); - patch.replace("/guards/jwt0/options/keys/0/n", "${{env.JWT_N}}"); - patch.replace("/guards/jwt0/options/keys/0/e", "${{env.JWT_E}}"); - patch.replace("/guards/jwt0/options/keys/0/crv", "${{env.JWT_CRV}}"); - patch.replace("/guards/jwt0/options/keys/0/x", "${{env.JWT_X}}"); - patch.replace("/guards/jwt0/options/keys/0/y", "${{env.JWT_Y}}"); - } - - if (isTlsEnabled) - { - // tls_server0 binding - patch.replace("/bindings/tls_server0/options/keys/0", "${{env.TLS_SERVER_KEY}}"); - patch.replace("/bindings/tls_server0/options/sni/0", "${{env.TLS_SERVER_SNI}}"); - patch.replace("/bindings/tls_server0/options/alpn/0", "${{env.TLS_SERVER_ALPN}}"); - // tls_client0 binding - patch.replace("/bindings/tls_client0/options/trust/0", "${{env.TLS_CLIENT_TRUST}}"); - patch.replace("/bindings/tls_client0/options/sni/0", "${{env.TLS_CLIENT_SNI}}"); - patch.replace("/bindings/tls_client0/options/alpn/0", "${{env.TLS_CLIENT_ALPN}}"); - // client vault - patch.replace("/vaults/client/options/trust/store", "${{env.TRUSTSTORE_PATH}}"); - patch.replace("/vaults/client/options/trust/type", "${{env.TRUSTSTORE_TYPE}}"); - patch.replace("/vaults/client/options/trust/password", "${{env.TRUSTSTORE_PASSWORD}}"); - // server vault - patch.replace("/vaults/server/options/keys/store", "${{env.KEYSTORE_PATH}}"); - patch.replace("/vaults/server/options/keys/type", "${{env.KEYSTORE_TYPE}}"); - patch.replace("/vaults/server/options/keys/password", "${{env.KEYSTORE_PASSWORD}}"); - } - - return patch.build(); - } - - private List unquotedEnvVars() - { - return List.of("TCP_CLIENT_PORT"); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/AsyncApi.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/AsyncApi.java deleted file mode 100644 index 3379ddefd8..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/AsyncApi.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -import java.util.Map; - -public class AsyncApi -{ - public Map servers; - public Map channels; - public Map operations; - public Components components; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Binding.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Binding.java deleted file mode 100644 index 0e15d732e4..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Binding.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -public class Binding -{ - public String method; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Channel.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Channel.java deleted file mode 100644 index 29ed4bc9e0..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Channel.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -import java.util.LinkedHashMap; - -import jakarta.json.bind.annotation.JsonbProperty; - -public class Channel -{ - public String address; - public LinkedHashMap messages; - public LinkedHashMap parameters; - - @JsonbProperty("$ref") - public String ref; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Components.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Components.java deleted file mode 100644 index 9288e3e2a6..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Components.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -import java.util.Map; - -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.SecurityScheme; - -public class Components -{ - public Map securitySchemes; - public Map messages; - public Map schemas; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Item.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Item.java deleted file mode 100644 index 42ed3d6c2d..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Item.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -public class Item -{ - public String type; - public String description; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Message.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Message.java deleted file mode 100644 index 18011a28f6..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Message.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -import jakarta.json.bind.annotation.JsonbProperty; - -public class Message -{ - public Schema headers; - public String contentType; - - @JsonbProperty("$ref") - public String ref; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Operation.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Operation.java deleted file mode 100644 index 89551a6cc0..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Operation.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -import java.util.Map; - -public class Operation -{ - public Map bindings; - public Channel channel; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Parameter.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Parameter.java deleted file mode 100644 index 7048bf9784..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Parameter.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -public class Parameter -{ - public Schema schema; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Schema.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Schema.java deleted file mode 100644 index be52cda60e..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Schema.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -import java.util.List; -import java.util.Map; - -import jakarta.json.bind.annotation.JsonbProperty; - -public class Schema -{ - public String type; - public Schema items; - public Map properties; - public List required; - - @JsonbProperty("$ref") - public String ref; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/SecurityScheme.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/SecurityScheme.java deleted file mode 100644 index 137c290af5..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/SecurityScheme.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -public class SecurityScheme -{ - public String bearerFormat; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Server.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Server.java deleted file mode 100644 index 73e0eec68c..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/model/Server.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - -import java.util.List; -import java.util.Map; - -public class Server -{ - public String host; - public List>> security; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/AsyncApiMqttProxyConfigGenerator.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/AsyncApiMqttProxyConfigGenerator.java deleted file mode 100644 index edc1d1d971..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/AsyncApiMqttProxyConfigGenerator.java +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.mqtt.proxy; - -import static io.aklivity.zilla.runtime.engine.config.KindConfig.CLIENT; -import static io.aklivity.zilla.runtime.engine.config.KindConfig.SERVER; -import static java.util.Objects.requireNonNull; -import static org.agrona.LangUtil.rethrowUnchecked; - -import java.io.InputStream; -import java.net.URI; -import java.util.List; -import java.util.Map; - -import jakarta.json.Json; -import jakarta.json.JsonPatch; -import jakarta.json.JsonPatchBuilder; -import jakarta.json.bind.Jsonb; -import jakarta.json.bind.JsonbBuilder; - -import io.aklivity.zilla.runtime.binding.mqtt.config.MqttConditionConfig; -import io.aklivity.zilla.runtime.binding.mqtt.config.MqttOptionsConfig; -import io.aklivity.zilla.runtime.binding.tcp.config.TcpConditionConfig; -import io.aklivity.zilla.runtime.binding.tcp.config.TcpOptionsConfig; -import io.aklivity.zilla.runtime.binding.tls.config.TlsOptionsConfig; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.AsyncApiConfigGenerator; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.AsyncApi; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Channel; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Message; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view.MessageView; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view.ServerView; -import io.aklivity.zilla.runtime.engine.config.BindingConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.CatalogedConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.EngineConfig; -import io.aklivity.zilla.runtime.engine.config.EngineConfigWriter; -import io.aklivity.zilla.runtime.engine.config.NamespaceConfigBuilder; -import io.aklivity.zilla.runtime.model.json.config.JsonModelConfig; -import io.aklivity.zilla.runtime.vault.filesystem.config.FileSystemOptionsConfig; - -public class AsyncApiMqttProxyConfigGenerator extends AsyncApiConfigGenerator -{ - private final InputStream input; - - private int[] allPorts; - private int[] mqttPorts; - private int[] mqttsPorts; - private boolean isPlainEnabled; - private boolean isTlsEnabled; - - public AsyncApiMqttProxyConfigGenerator( - InputStream input) - { - this.input = input; - } - - @Override - public String generate() - { - this.asyncApi = parseAsyncApi(input); - this.allPorts = resolveAllPorts(); - this.mqttPorts = resolvePortsForScheme("mqtt"); - this.mqttsPorts = resolvePortsForScheme("mqtts"); - this.isPlainEnabled = mqttPorts != null; - this.isTlsEnabled = mqttsPorts != null; - EngineConfigWriter configWriter = new EngineConfigWriter(null); - String yaml = configWriter.write(createConfig(), createEnvVarsPatch()); - return unquoteEnvVars(yaml, unquotedEnvVars()); - } - - private AsyncApi parseAsyncApi( - InputStream inputStream) - { - AsyncApi asyncApi = null; - try (Jsonb jsonb = JsonbBuilder.create()) - { - asyncApi = jsonb.fromJson(inputStream, AsyncApi.class); - } - catch (Exception ex) - { - rethrowUnchecked(ex); - } - return asyncApi; - } - - private int[] resolveAllPorts() - { - int[] ports = new int[asyncApi.servers.size()]; - String[] keys = asyncApi.servers.keySet().toArray(String[]::new); - for (int i = 0; i < asyncApi.servers.size(); i++) - { - ServerView server = ServerView.of(asyncApi.servers.get(keys[i])); - URI url = server.url(); - ports[i] = url.getPort(); - } - return ports; - } - - private int[] resolvePortsForScheme( - String scheme) - { - requireNonNull(scheme); - int[] ports = null; - URI url = findFirstServerUrlWithScheme(scheme); - if (url != null) - { - ports = new int[] {url.getPort()}; - } - return ports; - } - - private URI findFirstServerUrlWithScheme( - String scheme) - { - requireNonNull(scheme); - URI result = null; - for (String key : asyncApi.servers.keySet()) - { - ServerView server = ServerView.of(asyncApi.servers.get(key)); - if (scheme.equals(server.url().getScheme())) - { - result = server.url(); - break; - } - } - return result; - } - - private EngineConfig createConfig() - { - return EngineConfig.builder() - .namespace() - .name("example") - .binding() - .name("tcp_server0") - .type("tcp") - .kind(SERVER) - .options(TcpOptionsConfig::builder) - .host("0.0.0.0") - .ports(allPorts) - .build() - .inject(this::injectPlainTcpRoute) - .inject(this::injectTlsTcpRoute) - .build() - .inject(this::injectTlsServer) - .binding() - .name("mqtt_server0") - .type("mqtt") - .kind(SERVER) - .inject(this::injectMqttServerOptions) - .inject(this::injectMqttServerRoutes) - .build() - .binding() - .name("mqtt_client0") - .type("mqtt") - .kind(CLIENT) - .exit(isTlsEnabled ? "tls_client0" : "tcp_client0") - .build() - .inject(this::injectTlsClient) - .binding() - .name("tcp_client0") - .type("tcp") - .kind(CLIENT) - .options(TcpOptionsConfig::builder) - .host("") // env - .ports(new int[]{0}) // env - .build() - .build() - .inject(this::injectVaults) - .inject(this::injectCatalog) - .build() - .build(); - } - - private BindingConfigBuilder injectPlainTcpRoute( - BindingConfigBuilder binding) - { - if (isPlainEnabled) - { - binding - .route() - .when(TcpConditionConfig::builder) - .ports(mqttPorts) - .build() - .exit("mqtt_server0") - .build(); - } - return binding; - } - - private BindingConfigBuilder injectTlsTcpRoute( - BindingConfigBuilder binding) - { - if (isTlsEnabled) - { - binding - .route() - .when(TcpConditionConfig::builder) - .ports(mqttsPorts) - .build() - .exit("tls_server0") - .build(); - } - return binding; - } - - private NamespaceConfigBuilder injectTlsServer( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .binding() - .name("tls_server0") - .type("tls") - .kind(SERVER) - .options(TlsOptionsConfig::builder) - .keys(List.of("")) // env - .sni(List.of("")) // env - .alpn(List.of("")) // env - .build() - .vault("server") - .exit("mqtt_server0") - .build(); - } - return namespace; - } - - private BindingConfigBuilder injectMqttServerOptions( - BindingConfigBuilder binding) - { - for (Map.Entry channelEntry : asyncApi.channels.entrySet()) - { - String topic = channelEntry.getValue().address.replaceAll("\\{[^}]+\\}", "*"); - Map messages = channelEntry.getValue().messages; - if (hasJsonContentType()) - { - binding - .options(MqttOptionsConfig::builder) - .topic() - .name(topic) - .content(JsonModelConfig::builder) - .catalog() - .name(INLINE_CATALOG_NAME) - .inject(cataloged -> injectJsonSchemas(cataloged, messages, APPLICATION_JSON)) - .build() - .build() - .build() - .build() - .build(); - } - } - return binding; - } - - private CatalogedConfigBuilder injectJsonSchemas( - CatalogedConfigBuilder cataloged, - Map messages, - String contentType) - { - for (Map.Entry messageEntry : messages.entrySet()) - { - MessageView message = MessageView.of(asyncApi.components.messages, messageEntry.getValue()); - String schema = messageEntry.getKey(); - if (message.contentType().equals(contentType)) - { - cataloged - .schema() - .subject(schema) - .build() - .build(); - } - else - { - throw new RuntimeException("Invalid content type"); - } - } - return cataloged; - } - - private BindingConfigBuilder injectMqttServerRoutes( - BindingConfigBuilder binding) - { - for (Map.Entry entry : asyncApi.channels.entrySet()) - { - String topic = entry.getValue().address.replaceAll("\\{[^}]+\\}", "*"); - binding - .route() - .when(MqttConditionConfig::builder) - .publish() - .topic(topic) - .build() - .build() - .when(MqttConditionConfig::builder) - .subscribe() - .topic(topic) - .build() - .build() - .exit("mqtt_client0") - .build(); - } - return binding; - } - - private NamespaceConfigBuilder injectTlsClient( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .binding() - .name("tls_client0") - .type("tls") - .kind(CLIENT) - .options(TlsOptionsConfig::builder) - .trust(List.of("")) // env - .sni(List.of("")) // env - .alpn(List.of("")) // env - .trustcacerts(true) - .build() - .vault("client") - .exit("tcp_client0") - .build(); - } - return namespace; - } - - private NamespaceConfigBuilder injectVaults( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .vault() - .name("client") - .type("filesystem") - .options(FileSystemOptionsConfig::builder) - .trust() - .store("") // env - .type("") // env - .password("") // env - .build() - .build() - .build() - .vault() - .name("server") - .type("filesystem") - .options(FileSystemOptionsConfig::builder) - .keys() - .store("") // env - .type("") // env - .password("") //env - .build() - .build() - .build(); - } - return namespace; - } - - private JsonPatch createEnvVarsPatch() - { - JsonPatchBuilder patch = Json.createPatchBuilder(); - patch.replace("/bindings/tcp_client0/options/host", "${{env.TCP_CLIENT_HOST}}"); - patch.replace("/bindings/tcp_client0/options/port", "${{env.TCP_CLIENT_PORT}}"); - - if (isTlsEnabled) - { - // tls_server0 binding - patch.replace("/bindings/tls_server0/options/keys/0", "${{env.TLS_SERVER_KEY}}"); - patch.replace("/bindings/tls_server0/options/sni/0", "${{env.TLS_SERVER_SNI}}"); - patch.replace("/bindings/tls_server0/options/alpn/0", "${{env.TLS_SERVER_ALPN}}"); - // tls_client0 binding - patch.replace("/bindings/tls_client0/options/trust/0", "${{env.TLS_CLIENT_TRUST}}"); - patch.replace("/bindings/tls_client0/options/sni/0", "${{env.TLS_CLIENT_SNI}}"); - patch.replace("/bindings/tls_client0/options/alpn/0", "${{env.TLS_CLIENT_ALPN}}"); - // client vault - patch.replace("/vaults/client/options/trust/store", "${{env.TRUSTSTORE_PATH}}"); - patch.replace("/vaults/client/options/trust/type", "${{env.TRUSTSTORE_TYPE}}"); - patch.replace("/vaults/client/options/trust/password", "${{env.TRUSTSTORE_PASSWORD}}"); - // server vault - patch.replace("/vaults/server/options/keys/store", "${{env.KEYSTORE_PATH}}"); - patch.replace("/vaults/server/options/keys/type", "${{env.KEYSTORE_TYPE}}"); - patch.replace("/vaults/server/options/keys/password", "${{env.KEYSTORE_PASSWORD}}"); - } - - return patch.build(); - } - - private List unquotedEnvVars() - { - return List.of("TCP_CLIENT_PORT"); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/ChannelView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/ChannelView.java deleted file mode 100644 index bd0c7140d2..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/ChannelView.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view; - -import java.util.Map; - -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Channel; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Message; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Parameter; - -public final class ChannelView extends Resolvable -{ - private final Channel channel; - - private ChannelView( - Map channels, - Channel channel) - { - super(channels, "#/channels/(\\w+)"); - this.channel = channel.ref == null ? channel : resolveRef(channel.ref); - } - - public String address() - { - return channel.address; - } - - public Map messages() - { - return channel.messages; - } - - public Map parameters() - { - return channel.parameters; - } - - public static ChannelView of( - Map channels, - Channel channel) - { - return new ChannelView(channels, channel); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/MessageView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/MessageView.java deleted file mode 100644 index 6efa633313..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/MessageView.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view; - -import java.util.Map; - -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Message; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Schema; - -public final class MessageView extends Resolvable -{ - private final Message message; - - private MessageView( - Map messages, - Message message) - { - super(messages, "#/components/messages/(\\w+)"); - this.message = message.ref == null ? message : resolveRef(message.ref); - } - - public String refKey() - { - return key; - } - - public Schema headers() - { - return message.headers; - } - - public String contentType() - { - return message.contentType; - } - - public static MessageView of( - Map messages, - Message message) - { - return new MessageView(messages, message); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/Resolvable.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/Resolvable.java deleted file mode 100644 index 70e2366cd3..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/Resolvable.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view; - -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public abstract class Resolvable -{ - private final Map map; - private final Matcher matcher; - - protected String key; - - public Resolvable( - Map map, - String regex) - { - this.map = map; - this.matcher = Pattern.compile(regex).matcher(""); - } - - protected T resolveRef( - String ref) - { - T result = null; - if (matcher.reset(ref).matches()) - { - key = matcher.group(1); - result = map.get(key); - } - return result; - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/SchemaView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/SchemaView.java deleted file mode 100644 index 71c633b2c1..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/SchemaView.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view; - -import java.util.List; -import java.util.Map; - -import jakarta.json.bind.annotation.JsonbPropertyOrder; - -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Item; -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Schema; - -@JsonbPropertyOrder({ - "type", - "items", - "properties", - "required" -}) -public final class SchemaView extends Resolvable -{ - private static final String ARRAY_TYPE = "array"; - - private final Schema schema; - private final Map schemas; - - private SchemaView( - Map schemas, - Schema schema) - { - super(schemas, "#/components/schemas/(\\w+)"); - if (schema.ref != null) - { - schema = resolveRef(schema.ref); - } - else if (ARRAY_TYPE.equals(schema.type) && schema.items != null && schema.items.ref != null) - { - schema.items = resolveRef(schema.items.ref); - } - this.schemas = schemas; - this.schema = schema; - } - - public String getType() - { - return schema.type; - } - - public SchemaView getItems() - { - return schema.items == null ? null : SchemaView.of(schemas, schema.items); - } - - public Map getProperties() - { - return schema.properties; - } - - public List getRequired() - { - return schema.required; - } - - public static SchemaView of( - Map schemas, - Schema schema) - { - return new SchemaView(schemas, schema); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/ServerView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/ServerView.java deleted file mode 100644 index 7cf4fb977d..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/view/ServerView.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view; - -import java.net.URI; -import java.util.List; -import java.util.Map; - -import io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model.Server; - -public final class ServerView -{ - private final Server server; - - private ServerView( - Server server) - { - this.server = server; - } - - public URI url() - { - return URI.create(server.host); - } - - public List>> security() - { - return server.security; - } - - public String scheme() - { - return url().getScheme(); - } - - public String authority() - { - return String.format("%s:%d", url().getHost(), url().getPort()); - } - - public static ServerView of( - Server server) - { - return new ServerView(server); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/OpenApiConfigGenerator.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/OpenApiConfigGenerator.java deleted file mode 100644 index 25befc3f50..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/OpenApiConfigGenerator.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi; - -import static com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature.MINIMIZE_QUOTES; -import static com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature.WRITE_DOC_START_MARKER; -import static org.agrona.LangUtil.rethrowUnchecked; - -import java.util.Map; - -import jakarta.json.bind.Jsonb; -import jakarta.json.bind.JsonbBuilder; - -import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; - -import io.aklivity.zilla.runtime.catalog.inline.config.InlineOptionsConfig; -import io.aklivity.zilla.runtime.catalog.inline.config.InlineSchemaConfigBuilder; -import io.aklivity.zilla.runtime.command.generate.internal.airline.ConfigGenerator; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.MediaType; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.OpenApi; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Schema; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.view.SchemaView; -import io.aklivity.zilla.runtime.engine.config.NamespaceConfigBuilder; - -public abstract class OpenApiConfigGenerator extends ConfigGenerator -{ - protected OpenApi openApi; - - protected SchemaView resolveSchemaForJsonContentType( - Map content) - { - MediaType mediaType = null; - if (content != null) - { - for (String contentType : content.keySet()) - { - if (jsonContentType.reset(contentType).matches()) - { - mediaType = content.get(contentType); - break; - } - } - } - return mediaType == null ? null : SchemaView.of(openApi.components.schemas, mediaType.schema); - } - - protected NamespaceConfigBuilder injectCatalog( - NamespaceConfigBuilder namespace) - { - if (openApi.components != null && openApi.components.schemas != null && !openApi.components.schemas.isEmpty()) - { - namespace - .catalog() - .name(INLINE_CATALOG_NAME) - .type(INLINE_CATALOG_TYPE) - .options(InlineOptionsConfig::builder) - .subjects() - .inject(this::injectSubjects) - .build() - .build() - .build(); - } - return namespace; - } - - protected InlineSchemaConfigBuilder injectSubjects( - InlineSchemaConfigBuilder subjects) - { - try (Jsonb jsonb = JsonbBuilder.create()) - { - YAMLMapper yaml = YAMLMapper.builder() - .disable(WRITE_DOC_START_MARKER) - .enable(MINIMIZE_QUOTES) - .build(); - for (Map.Entry entry : openApi.components.schemas.entrySet()) - { - SchemaView schema = SchemaView.of(openApi.components.schemas, entry.getValue()); - subjects - .subject(entry.getKey()) - .version(VERSION_LATEST) - .schema(writeSchemaYaml(jsonb, yaml, schema)) - .build(); - } - } - catch (Exception ex) - { - rethrowUnchecked(ex); - } - return subjects; - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/OpenApiHttpProxyConfigGenerator.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/OpenApiHttpProxyConfigGenerator.java deleted file mode 100644 index 50b86387a9..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/OpenApiHttpProxyConfigGenerator.java +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.http.proxy; - -import static io.aklivity.zilla.runtime.binding.http.config.HttpPolicyConfig.CROSS_ORIGIN; -import static io.aklivity.zilla.runtime.engine.config.KindConfig.CLIENT; -import static io.aklivity.zilla.runtime.engine.config.KindConfig.SERVER; -import static java.util.Objects.requireNonNull; -import static org.agrona.LangUtil.rethrowUnchecked; - -import java.io.InputStream; -import java.net.URI; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import jakarta.json.Json; -import jakarta.json.JsonPatch; -import jakarta.json.JsonPatchBuilder; -import jakarta.json.bind.Jsonb; -import jakarta.json.bind.JsonbBuilder; - -import io.aklivity.zilla.runtime.binding.http.config.HttpConditionConfig; -import io.aklivity.zilla.runtime.binding.http.config.HttpOptionsConfig; -import io.aklivity.zilla.runtime.binding.http.config.HttpOptionsConfigBuilder; -import io.aklivity.zilla.runtime.binding.http.config.HttpRequestConfig; -import io.aklivity.zilla.runtime.binding.http.config.HttpRequestConfigBuilder; -import io.aklivity.zilla.runtime.binding.http.config.HttpResponseConfigBuilder; -import io.aklivity.zilla.runtime.binding.tcp.config.TcpConditionConfig; -import io.aklivity.zilla.runtime.binding.tcp.config.TcpOptionsConfig; -import io.aklivity.zilla.runtime.binding.tls.config.TlsOptionsConfig; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.OpenApiConfigGenerator; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Header; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.OpenApi; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Operation; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Parameter; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Response; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.ResponseByContentType; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Server; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.view.OperationView; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.view.OperationsView; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.view.PathView; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.view.SchemaView; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.view.ServerView; -import io.aklivity.zilla.runtime.engine.config.BindingConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.EngineConfig; -import io.aklivity.zilla.runtime.engine.config.EngineConfigWriter; -import io.aklivity.zilla.runtime.engine.config.GuardedConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.ModelConfig; -import io.aklivity.zilla.runtime.engine.config.NamespaceConfigBuilder; -import io.aklivity.zilla.runtime.engine.config.RouteConfigBuilder; -import io.aklivity.zilla.runtime.guard.jwt.config.JwtOptionsConfig; -import io.aklivity.zilla.runtime.model.json.config.JsonModelConfig; -import io.aklivity.zilla.runtime.vault.filesystem.config.FileSystemOptionsConfig; - -public class OpenApiHttpProxyConfigGenerator extends OpenApiConfigGenerator -{ - private final InputStream inputStream; - - private int[] allPorts; - private int[] httpPorts; - private int[] httpsPorts; - private boolean isPlainEnabled; - private boolean isTlsEnabled; - private Map securitySchemes; - private boolean isJwtEnabled; - - public OpenApiHttpProxyConfigGenerator( - InputStream inputStream) - { - this.inputStream = inputStream; - } - - @Override - public String generate() - { - this.openApi = parseOpenApi(inputStream); - this.allPorts = resolveAllPorts(); - this.httpPorts = resolvePortsForScheme("http"); - this.httpsPorts = resolvePortsForScheme("https"); - this.isPlainEnabled = httpPorts != null; - this.isTlsEnabled = httpsPorts != null; - this.securitySchemes = resolveSecuritySchemes(); - this.isJwtEnabled = !securitySchemes.isEmpty(); - EngineConfigWriter configWriter = new EngineConfigWriter(null); - String yaml = configWriter.write(createConfig(), createEnvVarsPatch()); - return unquoteEnvVars(yaml, unquotedEnvVars()); - } - - private OpenApi parseOpenApi( - InputStream inputStream) - { - OpenApi openApi = null; - try (Jsonb jsonb = JsonbBuilder.create()) - { - openApi = jsonb.fromJson(inputStream, OpenApi.class); - } - catch (Exception ex) - { - rethrowUnchecked(ex); - } - return openApi; - } - - private int[] resolveAllPorts() - { - int[] ports = new int[openApi.servers.size()]; - for (int i = 0; i < openApi.servers.size(); i++) - { - ServerView server = ServerView.of(openApi.servers.get(i)); - URI url = server.url(); - ports[i] = url.getPort(); - } - return ports; - } - - private int[] resolvePortsForScheme( - String scheme) - { - requireNonNull(scheme); - int[] ports = null; - URI url = findFirstServerUrlWithScheme(scheme); - if (url != null) - { - ports = new int[] {url.getPort()}; - } - return ports; - } - - private URI findFirstServerUrlWithScheme( - String scheme) - { - requireNonNull(scheme); - URI result = null; - for (Server item : openApi.servers) - { - ServerView server = ServerView.of(item); - if (scheme.equals(server.url().getScheme())) - { - result = server.url(); - break; - } - } - return result; - } - - private Map resolveSecuritySchemes() - { - requireNonNull(openApi); - Map result = new HashMap<>(); - if (openApi.components != null && openApi.components.securitySchemes != null) - { - for (String securitySchemeName : openApi.components.securitySchemes.keySet()) - { - String guardType = openApi.components.securitySchemes.get(securitySchemeName).bearerFormat; - if ("jwt".equals(guardType)) - { - result.put(securitySchemeName, guardType); - } - } - } - return result; - } - - private EngineConfig createConfig() - { - return EngineConfig.builder() - .namespace() - .name("example") - .binding() - .name("tcp_server0") - .type("tcp") - .kind(SERVER) - .options(TcpOptionsConfig::builder) - .host("0.0.0.0") - .ports(allPorts) - .build() - .inject(this::injectPlainTcpRoute) - .inject(this::injectTlsTcpRoute) - .build() - .inject(this::injectTlsServer) - .binding() - .name("http_server0") - .type("http") - .kind(SERVER) - .options(HttpOptionsConfig::builder) - .access() - .policy(CROSS_ORIGIN) - .build() - .inject(this::injectHttpServerOptions) - .inject(this::injectHttpServerRequests) - .build() - .inject(this::injectHttpServerRoutes) - .build() - .binding() - .name("http_client0") - .type("http") - .kind(CLIENT) - .inject(this::injectHttpClientOptions) - .exit(isTlsEnabled ? "tls_client0" : "tcp_client0") - .build() - .inject(this::injectTlsClient) - .binding() - .name("tcp_client0") - .type("tcp") - .kind(CLIENT) - .options(TcpOptionsConfig::builder) - .host("") // env - .ports(new int[]{0}) // env - .build() - .build() - .inject(this::injectGuard) - .inject(this::injectVaults) - .inject(this::injectCatalog) - .build() - .build(); - } - - private BindingConfigBuilder injectPlainTcpRoute( - BindingConfigBuilder binding) - { - if (isPlainEnabled) - { - binding - .route() - .when(TcpConditionConfig::builder) - .ports(httpPorts) - .build() - .exit("http_server0") - .build(); - } - return binding; - } - - private BindingConfigBuilder injectTlsTcpRoute( - BindingConfigBuilder binding) - { - if (isTlsEnabled) - { - binding - .route() - .when(TcpConditionConfig::builder) - .ports(httpsPorts) - .build() - .exit("tls_server0") - .build(); - } - return binding; - } - - private NamespaceConfigBuilder injectTlsServer( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .binding() - .name("tls_server0") - .type("tls") - .kind(SERVER) - .options(TlsOptionsConfig::builder) - .keys(List.of("")) // env - .sni(List.of("")) // env - .alpn(List.of("")) // env - .build() - .vault("server") - .exit("http_server0") - .build(); - } - return namespace; - } - - private HttpOptionsConfigBuilder injectHttpServerOptions( - HttpOptionsConfigBuilder options) - { - if (isJwtEnabled) - { - options - .authorization() - .name("jwt0") - .credentials() - .header() - .name("authorization") - .pattern("Bearer {credentials}") - .build() - .build() - .build(); - } - return options; - } - - private HttpOptionsConfigBuilder injectHttpServerRequests( - HttpOptionsConfigBuilder options) - { - for (String pathName : openApi.paths.keySet()) - { - PathView path = PathView.of(openApi.paths.get(pathName)); - for (String methodName : path.methods().keySet()) - { - Operation operation = path.methods().get(methodName); - if (operation.requestBody != null || operation.parameters != null && !operation.parameters.isEmpty()) - { - options - .request() - .path(pathName) - .method(HttpRequestConfig.Method.valueOf(methodName)) - .inject(request -> injectContent(request, operation)) - .inject(request -> injectParams(request, operation)) - .build(); - } - } - } - return options; - } - - private HttpRequestConfigBuilder injectContent( - HttpRequestConfigBuilder request, - Operation operation) - { - if (operation.requestBody != null && operation.requestBody.content != null && !operation.requestBody.content.isEmpty()) - { - SchemaView schema = resolveSchemaForJsonContentType(operation.requestBody.content); - if (schema != null) - { - request. - content(JsonModelConfig::builder) - .catalog() - .name(INLINE_CATALOG_NAME) - .schema() - .subject(schema.refKey()) - .build() - .build() - .build(); - } - } - return request; - } - - private HttpRequestConfigBuilder injectParams( - HttpRequestConfigBuilder request, - Operation operation) - { - if (operation != null && operation.parameters != null) - { - for (Parameter parameter : operation.parameters) - { - if (parameter.schema != null && parameter.schema.type != null) - { - ModelConfig model = models.get(parameter.schema.type); - if (model != null) - { - switch (parameter.in) - { - case "path": - request. - pathParam() - .name(parameter.name) - .model(model) - .build(); - break; - case "query": - request. - queryParam() - .name(parameter.name) - .model(model) - .build(); - break; - case "header": - request. - header() - .name(parameter.name) - .model(model) - .build(); - break; - } - } - } - } - } - return request; - } - - private BindingConfigBuilder injectHttpClientOptions( - BindingConfigBuilder binding) - { - OperationsView operations = OperationsView.of(openApi.paths); - if (operations.hasResponses()) - { - binding. - options(HttpOptionsConfig::builder) - .inject(options -> injectHttpClientRequests(operations, options)) - .build(); - } - return binding; - } - - private HttpOptionsConfigBuilder injectHttpClientRequests( - OperationsView operations, - HttpOptionsConfigBuilder options) - { - for (String pathName : openApi.paths.keySet()) - { - PathView path = PathView.of(openApi.paths.get(pathName)); - for (String methodName : path.methods().keySet()) - { - OperationView operation = operations.operation(pathName, methodName); - if (operation.hasResponses()) - { - options - .request() - .path(pathName) - .method(HttpRequestConfig.Method.valueOf(methodName)) - .inject(request -> injectResponses(request, operation)) - .build() - .build(); - } - } - } - return options; - } - - private HttpRequestConfigBuilder injectResponses( - HttpRequestConfigBuilder request, - OperationView operation) - { - if (operation != null && operation.responsesByStatus() != null) - { - for (Map.Entry responses0 : operation.responsesByStatus().entrySet()) - { - String status = responses0.getKey(); - ResponseByContentType responses1 = responses0.getValue(); - if (!(OperationView.DEFAULT.equals(status)) && responses1.content != null) - { - for (Map.Entry response2 : responses1.content.entrySet()) - { - SchemaView schema = SchemaView.of(openApi.components.schemas, response2.getValue().schema); - request - .response() - .status(Integer.parseInt(status)) - .contentType(response2.getKey()) - .inject(response -> injectResponseHeaders(responses1, response)) - .content(JsonModelConfig::builder) - .catalog() - .name(INLINE_CATALOG_NAME) - .schema() - .subject(schema.refKey()) - .build() - .build() - .build() - .build(); - } - } - } - } - return request; - } - - private HttpResponseConfigBuilder injectResponseHeaders( - ResponseByContentType responses, - HttpResponseConfigBuilder response) - { - if (responses.headers != null && !responses.headers.isEmpty()) - { - for (Map.Entry header : responses.headers.entrySet()) - { - String name = header.getKey(); - ModelConfig model = models.get(header.getValue().schema.type); - if (model != null) - { - response - .header() - .name(name) - .model(model) - .build(); - } - } - } - return response; - } - - private BindingConfigBuilder injectHttpServerRoutes( - BindingConfigBuilder binding) - { - for (String item : openApi.paths.keySet()) - { - PathView path = PathView.of(openApi.paths.get(item)); - for (String method : path.methods().keySet()) - { - binding - .route() - .exit("http_client0") - .when(HttpConditionConfig::builder) - .header(":path", item.replaceAll("\\{[^}]+\\}", "*")) - .header(":method", method) - .build() - .inject(route -> injectHttpServerRouteGuarded(route, path, method)) - .build(); - } - } - return binding; - } - - private RouteConfigBuilder injectHttpServerRouteGuarded( - RouteConfigBuilder route, - PathView path, - String method) - { - List>> security = path.methods().get(method).security; - if (security != null) - { - for (Map> securityItem : security) - { - for (String securityItemLabel : securityItem.keySet()) - { - if (isJwtEnabled && "jwt".equals(securitySchemes.get(securityItemLabel))) - { - route - .guarded() - .name("jwt0") - .inject(guarded -> injectGuardedRoles(guarded, securityItem.get(securityItemLabel))) - .build(); - } - } - } - } - return route; - } - - private GuardedConfigBuilder injectGuardedRoles( - GuardedConfigBuilder guarded, - List roles) - { - for (String role : roles) - { - guarded.role(role); - } - return guarded; - } - - private NamespaceConfigBuilder injectTlsClient( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .binding() - .name("tls_client0") - .type("tls") - .kind(CLIENT) - .options(TlsOptionsConfig::builder) - .trust(List.of("")) // env - .sni(List.of("")) // env - .alpn(List.of("")) // env - .trustcacerts(true) - .build() - .vault("client") - .exit("tcp_client0") - .build(); - } - return namespace; - } - - private NamespaceConfigBuilder injectGuard( - NamespaceConfigBuilder namespace) - { - if (isJwtEnabled) - { - namespace - .guard() - .name("jwt0") - .type("jwt") - .options(JwtOptionsConfig::builder) - .issuer("") // env - .audience("") // env - .key() - .alg("").kty("").kid("").use("").n("").e("").crv("").x("").y("") // env - .build() - .build() - .build(); - } - return namespace; - } - - private NamespaceConfigBuilder injectVaults( - NamespaceConfigBuilder namespace) - { - if (isTlsEnabled) - { - namespace - .vault() - .name("client") - .type("filesystem") - .options(FileSystemOptionsConfig::builder) - .trust() - .store("") // env - .type("") // env - .password("") // env - .build() - .build() - .build() - .vault() - .name("server") - .type("filesystem") - .options(FileSystemOptionsConfig::builder) - .keys() - .store("") // env - .type("") // env - .password("") //env - .build() - .build() - .build(); - } - return namespace; - } - - private JsonPatch createEnvVarsPatch() - { - JsonPatchBuilder patch = Json.createPatchBuilder(); - patch.replace("/bindings/tcp_client0/options/host", "${{env.TCP_CLIENT_HOST}}"); - patch.replace("/bindings/tcp_client0/options/port", "${{env.TCP_CLIENT_PORT}}"); - - if (isJwtEnabled) - { - // jwt0 guard - patch.replace("/guards/jwt0/options/issuer", "${{env.JWT_ISSUER}}"); - patch.replace("/guards/jwt0/options/audience", "${{env.JWT_AUDIENCE}}"); - patch.replace("/guards/jwt0/options/keys/0/alg", "${{env.JWT_ALG}}"); - patch.replace("/guards/jwt0/options/keys/0/kty", "${{env.JWT_KTY}}"); - patch.replace("/guards/jwt0/options/keys/0/kid", "${{env.JWT_KID}}"); - patch.replace("/guards/jwt0/options/keys/0/use", "${{env.JWT_USE}}"); - patch.replace("/guards/jwt0/options/keys/0/n", "${{env.JWT_N}}"); - patch.replace("/guards/jwt0/options/keys/0/e", "${{env.JWT_E}}"); - patch.replace("/guards/jwt0/options/keys/0/crv", "${{env.JWT_CRV}}"); - patch.replace("/guards/jwt0/options/keys/0/x", "${{env.JWT_X}}"); - patch.replace("/guards/jwt0/options/keys/0/y", "${{env.JWT_Y}}"); - } - - if (isTlsEnabled) - { - // tls_server0 binding - patch.replace("/bindings/tls_server0/options/keys/0", "${{env.TLS_SERVER_KEY}}"); - patch.replace("/bindings/tls_server0/options/sni/0", "${{env.TLS_SERVER_SNI}}"); - patch.replace("/bindings/tls_server0/options/alpn/0", "${{env.TLS_SERVER_ALPN}}"); - // tls_client0 binding - patch.replace("/bindings/tls_client0/options/trust/0", "${{env.TLS_CLIENT_TRUST}}"); - patch.replace("/bindings/tls_client0/options/sni/0", "${{env.TLS_CLIENT_SNI}}"); - patch.replace("/bindings/tls_client0/options/alpn/0", "${{env.TLS_CLIENT_ALPN}}"); - // client vault - patch.replace("/vaults/client/options/trust/store", "${{env.TRUSTSTORE_PATH}}"); - patch.replace("/vaults/client/options/trust/type", "${{env.TRUSTSTORE_TYPE}}"); - patch.replace("/vaults/client/options/trust/password", "${{env.TRUSTSTORE_PASSWORD}}"); - // server vault - patch.replace("/vaults/server/options/keys/store", "${{env.KEYSTORE_PATH}}"); - patch.replace("/vaults/server/options/keys/type", "${{env.KEYSTORE_TYPE}}"); - patch.replace("/vaults/server/options/keys/password", "${{env.KEYSTORE_PASSWORD}}"); - } - - return patch.build(); - } - - private List unquotedEnvVars() - { - return List.of("TCP_CLIENT_PORT"); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/BearerAuth.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/BearerAuth.java deleted file mode 100644 index eb6cd10616..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/BearerAuth.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class BearerAuth -{ - public String bearerFormat; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Components.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Components.java deleted file mode 100644 index 4860ee6faf..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Components.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -import java.util.Map; - -public class Components -{ - public Map securitySchemes; - public Map schemas; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Header.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Header.java deleted file mode 100644 index fba798dbb3..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Header.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class Header -{ - public Schema schema; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Item.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Item.java deleted file mode 100644 index 37fffd07ed..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Item.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class Item -{ - public String type; - public String description; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/MediaType.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/MediaType.java deleted file mode 100644 index aa0638a493..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/MediaType.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class MediaType -{ - public Schema schema; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/OpenApi.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/OpenApi.java deleted file mode 100644 index e9c7bb614c..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/OpenApi.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -import java.util.LinkedHashMap; -import java.util.List; - -public class OpenApi -{ - public String openapi; - public List servers; - public LinkedHashMap paths; - public Components components; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Operation.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Operation.java deleted file mode 100644 index f1ae876364..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Operation.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -import java.util.List; -import java.util.Map; - -public class Operation -{ - public List>> security; - public RequestBody requestBody; - public List parameters; - public Map responses; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Parameter.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Parameter.java deleted file mode 100644 index 45cb554380..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Parameter.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class Parameter -{ - public String name; - public String in; - public boolean required; - public Schema schema; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/PathItem.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/PathItem.java deleted file mode 100644 index 1f881ebe68..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/PathItem.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class PathItem -{ - public Operation get; - public Operation put; - public Operation post; - public Operation delete; - public Operation options; - public Operation head; - public Operation patch; - public Operation trace; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/RequestBody.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/RequestBody.java deleted file mode 100644 index 3a1122d4bc..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/RequestBody.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -import java.util.LinkedHashMap; - -public class RequestBody -{ - public LinkedHashMap content; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Response.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Response.java deleted file mode 100644 index 07550f035d..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Response.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class Response -{ - public Schema schema; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/ResponseByContentType.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/ResponseByContentType.java deleted file mode 100644 index b71c02d401..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/ResponseByContentType.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -import java.util.LinkedHashMap; - -public class ResponseByContentType -{ - public LinkedHashMap headers; - public LinkedHashMap content; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Schema.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Schema.java deleted file mode 100644 index d1e652312b..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Schema.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -import java.util.List; -import java.util.Map; - -import jakarta.json.bind.annotation.JsonbProperty; - -public class Schema -{ - public String type; - public Schema items; - public Map properties; - public List required; - - @JsonbProperty("$ref") - public String ref; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/SecurityScheme.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/SecurityScheme.java deleted file mode 100644 index a411b5a6b2..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/SecurityScheme.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class SecurityScheme -{ - public String bearerFormat; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Server.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Server.java deleted file mode 100644 index 5c4faf4b4a..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/model/Server.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - -public class Server -{ - public String url; -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/OperationView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/OperationView.java deleted file mode 100644 index 5c5fa2015d..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/OperationView.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.view; - -import java.util.Map; - -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Operation; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.ResponseByContentType; - -public class OperationView -{ - public static final String DEFAULT = "default"; - - private final Operation operation; - private final boolean hasResponses; - - public OperationView( - Operation operation) - { - this.operation = operation; - this.hasResponses = initHasResponses(); - } - - public Map responsesByStatus() - { - return operation.responses; - } - - public boolean hasResponses() - { - return hasResponses; - } - - private boolean initHasResponses() - { - boolean result = false; - if (operation != null && operation.responses != null) - { - for (Map.Entry response0 : operation.responses.entrySet()) - { - String status = response0.getKey(); - ResponseByContentType response1 = response0.getValue(); - if (!(DEFAULT.equals(status)) && response1.content != null) - { - result = true; - break; - } - } - } - return result; - } - - public static OperationView of( - Operation operation) - { - return new OperationView(operation); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/OperationsView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/OperationsView.java deleted file mode 100644 index 0dd701b471..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/OperationsView.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.view; - -import java.util.LinkedHashMap; -import java.util.Map; - -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.PathItem; - -public final class OperationsView -{ - private final Map> operationsPerPath; - private final boolean hasResponses; - - private OperationsView( - LinkedHashMap paths) - { - this.operationsPerPath = new LinkedHashMap<>(); - boolean hasResponses = false; - for (String pathName : paths.keySet()) - { - PathView path = PathView.of(paths.get(pathName)); - for (String methodName : path.methods().keySet()) - { - OperationView operation = OperationView.of(path.methods().get(methodName)); - hasResponses |= operation.hasResponses(); - if (operationsPerPath.containsKey(pathName)) - { - operationsPerPath.get(pathName).put(methodName, operation); - } - else - { - Map operationsPerMethod = new LinkedHashMap<>(); - operationsPerMethod.put(methodName, operation); - operationsPerPath.put(pathName, operationsPerMethod); - } - } - } - this.hasResponses = hasResponses; - } - - public boolean hasResponses() - { - return this.hasResponses; - } - - public OperationView operation( - String pathName, - String methodName) - { - return operationsPerPath.get(pathName).get(methodName); - } - - public static OperationsView of( - LinkedHashMap paths) - { - return new OperationsView(paths); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/PathView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/PathView.java deleted file mode 100644 index 50f94d442f..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/PathView.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.view; - -import java.util.LinkedHashMap; -import java.util.Map; - -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Operation; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.PathItem; - -public class PathView -{ - private final LinkedHashMap methods; - - public PathView( - PathItem pathItem) - { - this.methods = new LinkedHashMap<>(); - putIfNotNull(methods, "GET", pathItem.get); - putIfNotNull(methods, "PUT", pathItem.put); - putIfNotNull(methods, "POST", pathItem.post); - putIfNotNull(methods, "DELETE", pathItem.delete); - putIfNotNull(methods, "OPTIONS", pathItem.options); - putIfNotNull(methods, "HEAD", pathItem.head); - putIfNotNull(methods, "PATCH", pathItem.patch); - putIfNotNull(methods, "TRACE", pathItem.trace); - } - - public Map methods() - { - return methods; - } - - public static PathView of( - PathItem pathItem) - { - return new PathView(pathItem); - } - - private static void putIfNotNull( - Map methods, - String method, - Operation operation) - { - if (operation != null) - { - methods.put(method, operation); - } - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/Resolvable.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/Resolvable.java deleted file mode 100644 index 173bfd019c..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/Resolvable.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.view; - -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public abstract class Resolvable -{ - private final Map map; - private final Matcher matcher; - - protected String key; - - public Resolvable( - Map map, - String regex) - { - this.map = map; - this.matcher = Pattern.compile(regex).matcher(""); - } - - protected T resolveRef( - String ref) - { - T result = null; - if (matcher.reset(ref).matches()) - { - key = matcher.group(1); - result = map.get(key); - } - return result; - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/SchemaView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/SchemaView.java deleted file mode 100644 index d823fb76a6..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/SchemaView.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.view; - -import java.util.List; -import java.util.Map; - -import jakarta.json.bind.annotation.JsonbPropertyOrder; - -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Item; -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Schema; - -@JsonbPropertyOrder({ - "type", - "items", - "properties", - "required" -}) -public final class SchemaView extends Resolvable -{ - private static final String ARRAY_TYPE = "array"; - - private final Schema schema; - private final Map schemas; - - private SchemaView( - Map schemas, - Schema schema) - { - super(schemas, "#/components/schemas/(\\w+)"); - if (schema.ref != null) - { - schema = resolveRef(schema.ref); - } - else if (ARRAY_TYPE.equals(schema.type) && schema.items != null && schema.items.ref != null) - { - schema.items = resolveRef(schema.items.ref); - } - this.schemas = schemas; - this.schema = schema; - } - - public String refKey() - { - return key; - } - - public String getType() - { - return schema.type; - } - - public SchemaView getItems() - { - return schema.items == null ? null : SchemaView.of(schemas, schema.items); - } - - public Map getProperties() - { - return schema.properties; - } - - public List getRequired() - { - return schema.required; - } - - public static SchemaView of( - Map schemas, - Schema schema) - { - return new SchemaView(schemas, schema); - } -} diff --git a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/ServerView.java b/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/ServerView.java deleted file mode 100644 index 244986a1be..0000000000 --- a/incubator/command-generate/src/main/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/view/ServerView.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.view; - -import java.net.URI; - -import io.aklivity.zilla.runtime.command.generate.internal.openapi.model.Server; - -public final class ServerView -{ - private URI url; - - private ServerView( - Server server) - { - this.url = URI.create(server.url); - } - - public URI url() - { - return url; - } - - public static ServerView of( - Server server) - { - return new ServerView(server); - } -} diff --git a/incubator/command-generate/src/main/moditect/module-info.java b/incubator/command-generate/src/main/moditect/module-info.java deleted file mode 100644 index 0c03ce63de..0000000000 --- a/incubator/command-generate/src/main/moditect/module-info.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -module io.aklivity.zilla.runtime.command.generate -{ - requires io.aklivity.zilla.runtime.command; - requires io.aklivity.zilla.runtime.engine; - requires io.aklivity.zilla.runtime.binding.http; - requires io.aklivity.zilla.runtime.binding.mqtt; - requires io.aklivity.zilla.runtime.binding.tcp; - requires io.aklivity.zilla.runtime.binding.tls; - requires io.aklivity.zilla.runtime.catalog.inline; - requires io.aklivity.zilla.runtime.guard.jwt; - requires io.aklivity.zilla.runtime.vault.filesystem; - requires io.aklivity.zilla.runtime.model.avro; - requires io.aklivity.zilla.runtime.model.core; - requires io.aklivity.zilla.runtime.model.json; - requires io.aklivity.zilla.runtime.model.protobuf; - - requires com.fasterxml.jackson.dataformat.yaml; - requires com.fasterxml.jackson.databind; - - opens io.aklivity.zilla.runtime.command.generate.internal.airline - to com.github.rvesse.airline; - - opens io.aklivity.zilla.runtime.command.generate.internal.openapi.model; - opens io.aklivity.zilla.runtime.command.generate.internal.openapi.view; - opens io.aklivity.zilla.runtime.command.generate.internal.asyncapi.model; - opens io.aklivity.zilla.runtime.command.generate.internal.asyncapi.view; - - provides io.aklivity.zilla.runtime.command.ZillaCommandSpi - with io.aklivity.zilla.runtime.command.generate.internal.ZillaConfigCommandSpi; -} diff --git a/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/AsyncApiHttpProxyConfigGeneratorTest.java b/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/AsyncApiHttpProxyConfigGeneratorTest.java deleted file mode 100644 index f0003b4340..0000000000 --- a/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/AsyncApiHttpProxyConfigGeneratorTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.http.proxy; - -import static org.junit.Assert.assertEquals; - -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; - -import org.junit.jupiter.api.Test; - -import io.aklivity.zilla.runtime.command.generate.internal.airline.ConfigGenerator; - -public class AsyncApiHttpProxyConfigGeneratorTest -{ - @Test - public void shouldGeneratePlainConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("plain/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("plain/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateValidatorConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("validator/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("validator/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateJwtConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("jwt/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("jwt/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateTlsConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("tls/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("tls/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateCompleteConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("complete/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("complete/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } -} diff --git a/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/AsyncApiMqttProxyConfigGeneratorTest.java b/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/AsyncApiMqttProxyConfigGeneratorTest.java deleted file mode 100644 index ebbbba9fbb..0000000000 --- a/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/AsyncApiMqttProxyConfigGeneratorTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.asyncapi.mqtt.proxy; - -import static org.junit.Assert.assertEquals; - -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; - -import org.junit.jupiter.api.Test; - -import io.aklivity.zilla.runtime.command.generate.internal.airline.ConfigGenerator; - -public class AsyncApiMqttProxyConfigGeneratorTest -{ - @Test - public void shouldGeneratePlainConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("plain/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("plain/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiMqttProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateValidatorConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("validator/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("validator/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiMqttProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateTlsConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("tls/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("tls/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiMqttProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateCompleteConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("complete/asyncapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("complete/zilla.yaml").getFile())); - ConfigGenerator generator = new AsyncApiMqttProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } -} diff --git a/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/OpenApiHttpProxyConfigGeneratorTest.java b/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/OpenApiHttpProxyConfigGeneratorTest.java deleted file mode 100644 index 04c3aa44c5..0000000000 --- a/incubator/command-generate/src/test/java/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/OpenApiHttpProxyConfigGeneratorTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2021-2023 Aklivity Inc - * - * Licensed under the Aklivity Community License (the "License"); you may not use - * this file except in compliance with the License. You may obtain a copy of the - * License at - * - * https://www.aklivity.io/aklivity-community-license/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package io.aklivity.zilla.runtime.command.generate.internal.openapi.http.proxy; - -import static org.junit.Assert.assertEquals; - -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; - -import org.junit.jupiter.api.Test; - -import io.aklivity.zilla.runtime.command.generate.internal.airline.ConfigGenerator; - -public class OpenApiHttpProxyConfigGeneratorTest -{ - @Test - public void shouldGeneratePlainConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("plain/openapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("plain/zilla.yaml").getFile())); - ConfigGenerator generator = new OpenApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateValidateConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("validator/openapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("validator/zilla.yaml").getFile())); - ConfigGenerator generator = new OpenApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateJwtConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("jwt/openapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("jwt/zilla.yaml").getFile())); - ConfigGenerator generator = new OpenApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateTlsConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("tls/openapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("tls/zilla.yaml").getFile())); - ConfigGenerator generator = new OpenApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } - - @Test - public void shouldGenerateCompleteConfig() throws Exception - { - try (InputStream input = getClass().getResourceAsStream("complete/openapi.yaml")) - { - // GIVEN - String expected = Files.readString(Path.of(getClass().getResource("complete/zilla.yaml").getFile())); - ConfigGenerator generator = new OpenApiHttpProxyConfigGenerator(input); - - // WHEN - String actual = generator.generate(); - - // THEN - assertEquals(expected, actual); - } - } -} diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/complete/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/complete/asyncapi.yaml deleted file mode 100644 index d2e61e7de5..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/complete/asyncapi.yaml +++ /dev/null @@ -1,98 +0,0 @@ -asyncapi: 3.0.0 -info: - title: HTTP Zilla Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - secure: - host: https://localhost:9090 - protocol: http - protocolVersion: '1.1' - security: - - httpBearerToken: - - public - plain: - host: http://localhost:8080 - protocol: http - protocolVersion: '1.1' -defaultContentType: application/json - -channels: - items: - address: /items - messages: - items: - $ref: '#/components/messages/item' - itemsbyid: - address: /items/{id} - parameters: - id: - description: Event ID. - schema: - type: string - messages: - items: - $ref: '#/components/messages/item' - -operations: - postEvents: - action: send - bindings: - http: - type: request - method: POST - channel: - $ref: '#/channels/items' - getEvents: - action: receive - bindings: - http: - type: request - method: GET - query: - type: object - properties: - limit: - type: number - channel: - $ref: '#/channels/itemsbyid' - -components: - correlationIds: - itemsCorrelationId: - location: '$message.header#/idempotency-key' - messages: - item: - name: event - title: An event - correlationId: - $ref: "#/components/correlationIds/itemsCorrelationId" - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - authorization: - description: Bearer {credentials} - type: string - contentType: application/json - payload: - type: object - properties: - item: - $ref: "#/components/schemas/item" - schemas: - item: - type: object - properties: - greeting: - type: string - required: - - greeting - securitySchemes: - httpBearerToken: - type: http - scheme: bearer - bearerFormat: jwt diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/complete/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/complete/zilla.yaml deleted file mode 100644 index 14c6d158ef..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/complete/zilla.yaml +++ /dev/null @@ -1,161 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: - - 8080 - - 9090 - routes: - - exit: http_server0 - when: - - port: 8080 - - exit: tls_server0 - when: - - port: 9090 - tls_server0: - type: tls - kind: server - vault: server - options: - keys: - - "${{env.TLS_SERVER_KEY}}" - sni: - - "${{env.TLS_SERVER_SNI}}" - alpn: - - "${{env.TLS_SERVER_ALPN}}" - exit: http_server0 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - authorization: - jwt0: - credentials: - headers: - authorization: "Bearer {credentials}" - requests: - - path: "/items/{id}" - method: GET - params: - path: - id: string - content: - model: json - catalog: - catalog0: - - subject: item - - path: /items - method: POST - content: - model: json - catalog: - catalog0: - - subject: item - routes: - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items/* - :method: GET - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items - :method: POST - - exit: http_client0 - when: - - headers: - :scheme: https - :authority: localhost:9090 - :path: /items/* - :method: GET - guarded: - jwt0: - - public - - exit: http_client0 - when: - - headers: - :scheme: https - :authority: localhost:9090 - :path: /items - :method: POST - guarded: - jwt0: - - public - http_client0: - type: http - kind: client - exit: tls_client0 - tls_client0: - type: tls - kind: client - vault: client - options: - trust: - - "${{env.TLS_CLIENT_TRUST}}" - trustcacerts: true - sni: - - "${{env.TLS_CLIENT_SNI}}" - alpn: - - "${{env.TLS_CLIENT_ALPN}}" - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -guards: - jwt0: - type: jwt - options: - issuer: "${{env.JWT_ISSUER}}" - audience: "${{env.JWT_AUDIENCE}}" - keys: - - kty: "${{env.JWT_KTY}}" - "n": "${{env.JWT_N}}" - e: "${{env.JWT_E}}" - alg: "${{env.JWT_ALG}}" - crv: "${{env.JWT_CRV}}" - x: "${{env.JWT_X}}" - "y": "${{env.JWT_Y}}" - use: "${{env.JWT_USE}}" - kid: "${{env.JWT_KID}}" -vaults: - client: - type: filesystem - options: - trust: - store: "${{env.TRUSTSTORE_PATH}}" - type: "${{env.TRUSTSTORE_TYPE}}" - password: "${{env.TRUSTSTORE_PASSWORD}}" - server: - type: filesystem - options: - keys: - store: "${{env.KEYSTORE_PATH}}" - type: "${{env.KEYSTORE_TYPE}}" - password: "${{env.KEYSTORE_PASSWORD}}" -catalogs: - catalog0: - type: inline - options: - subjects: - item: - schema: | - type: object - properties: - greeting: - type: string - required: - - greeting - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/jwt/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/jwt/asyncapi.yaml deleted file mode 100644 index 8984af8dfd..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/jwt/asyncapi.yaml +++ /dev/null @@ -1,72 +0,0 @@ -asyncapi: 3.0.0 -info: - title: HTTP Zilla Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - plain: - host: http://localhost:8080 - protocol: http - protocolVersion: '1.1' - security: - - httpBearerToken: - - public -defaultContentType: application/json - -channels: - items: - address: /items - itemsbyid: - address: /items/{id} - -operations: - postEvents: - action: send - bindings: - http: - type: request - method: POST - channel: - $ref: '#/channels/items' - getEvents: - action: receive - bindings: - http: - type: request - method: GET - query: - type: object - properties: - limit: - type: number - channel: - $ref: '#/channels/itemsbyid' - -components: - correlationIds: - itemsCorrelationId: - location: '$message.header#/idempotency-key' - messages: - item: - name: event - title: An event - correlationId: - $ref: "#/components/correlationIds/itemsCorrelationId" - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - authorization: - description: Bearer {credentials} - type: string - contentType: application/json - payload: - type: object - securitySchemes: - httpBearerToken: - type: http - scheme: bearer - bearerFormat: jwt diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/jwt/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/jwt/zilla.yaml deleted file mode 100644 index 880a24f184..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/jwt/zilla.yaml +++ /dev/null @@ -1,70 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 8080 - routes: - - exit: http_server0 - when: - - port: 8080 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - authorization: - jwt0: - credentials: - headers: - authorization: "Bearer {credentials}" - routes: - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items/* - :method: GET - guarded: - jwt0: - - public - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items - :method: POST - guarded: - jwt0: - - public - http_client0: - type: http - kind: client - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -guards: - jwt0: - type: jwt - options: - issuer: "${{env.JWT_ISSUER}}" - audience: "${{env.JWT_AUDIENCE}}" - keys: - - kty: "${{env.JWT_KTY}}" - "n": "${{env.JWT_N}}" - e: "${{env.JWT_E}}" - alg: "${{env.JWT_ALG}}" - crv: "${{env.JWT_CRV}}" - x: "${{env.JWT_X}}" - "y": "${{env.JWT_Y}}" - use: "${{env.JWT_USE}}" - kid: "${{env.JWT_KID}}" diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/plain/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/plain/asyncapi.yaml deleted file mode 100644 index 92696f10b9..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/plain/asyncapi.yaml +++ /dev/null @@ -1,46 +0,0 @@ -asyncapi: 3.0.0 -info: - title: HTTP Zilla Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - plain: - host: http://localhost:8080 - protocol: http - protocolVersion: '1.1' -defaultContentType: application/json - -channels: - items: - address: /items - itemsbyid: - address: /items/{id} - -operations: - postEvents: - action: send - bindings: - http: - type: request - method: POST - channel: - $ref: '#/channels/items' - getEvents: - action: receive - bindings: - http: - type: request - method: GET - query: - type: object - properties: - limit: - type: number - channel: - $ref: '#/channels/itemsbyid' - -components: - correlationIds: - itemsCorrelationId: - location: '$message.header#/idempotency-key' diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/plain/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/plain/zilla.yaml deleted file mode 100644 index d1ff8a09cd..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/plain/zilla.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 8080 - routes: - - exit: http_server0 - when: - - port: 8080 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - routes: - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items/* - :method: GET - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items - :method: POST - http_client0: - type: http - kind: client - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/tls/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/tls/asyncapi.yaml deleted file mode 100644 index ed3fdcca47..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/tls/asyncapi.yaml +++ /dev/null @@ -1,59 +0,0 @@ -asyncapi: 3.0.0 -info: - title: HTTP Zilla Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - secure: - host: https://localhost:9090 - protocol: http - protocolVersion: '1.1' -defaultContentType: application/json - -channels: - items: - address: /items - itemsbyid: - address: /items/{id} - -operations: - postEvents: - action: send - bindings: - http: - type: request - method: POST - channel: - $ref: '#/channels/items' - getEvents: - action: receive - bindings: - http: - type: request - method: GET - query: - type: object - properties: - limit: - type: number - channel: - $ref: '#/channels/itemsbyid' - -components: - correlationIds: - itemsCorrelationId: - location: '$message.header#/idempotency-key' - messages: - item: - name: event - title: An event - correlationId: - $ref: "#/components/correlationIds/itemsCorrelationId" - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - contentType: application/json diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/tls/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/tls/zilla.yaml deleted file mode 100644 index d1a5f47409..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/tls/zilla.yaml +++ /dev/null @@ -1,83 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 9090 - routes: - - exit: tls_server0 - when: - - port: 9090 - tls_server0: - type: tls - kind: server - vault: server - options: - keys: - - "${{env.TLS_SERVER_KEY}}" - sni: - - "${{env.TLS_SERVER_SNI}}" - alpn: - - "${{env.TLS_SERVER_ALPN}}" - exit: http_server0 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - routes: - - exit: http_client0 - when: - - headers: - :scheme: https - :authority: localhost:9090 - :path: /items/* - :method: GET - - exit: http_client0 - when: - - headers: - :scheme: https - :authority: localhost:9090 - :path: /items - :method: POST - http_client0: - type: http - kind: client - exit: tls_client0 - tls_client0: - type: tls - kind: client - vault: client - options: - trust: - - "${{env.TLS_CLIENT_TRUST}}" - trustcacerts: true - sni: - - "${{env.TLS_CLIENT_SNI}}" - alpn: - - "${{env.TLS_CLIENT_ALPN}}" - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -vaults: - client: - type: filesystem - options: - trust: - store: "${{env.TRUSTSTORE_PATH}}" - type: "${{env.TRUSTSTORE_TYPE}}" - password: "${{env.TRUSTSTORE_PASSWORD}}" - server: - type: filesystem - options: - keys: - store: "${{env.KEYSTORE_PATH}}" - type: "${{env.KEYSTORE_TYPE}}" - password: "${{env.KEYSTORE_PASSWORD}}" diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/validator/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/validator/asyncapi.yaml deleted file mode 100644 index e5b6e54ced..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/validator/asyncapi.yaml +++ /dev/null @@ -1,83 +0,0 @@ -asyncapi: 3.0.0 -info: - title: HTTP Zilla Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - plain: - host: http://localhost:8080 - protocol: http - protocolVersion: '1.1' -defaultContentType: application/json - -channels: - items: - address: /items - messages: - items: - $ref: '#/components/messages/item' - itemsbyid: - address: /items/{id} - parameters: - id: - description: Event ID. - schema: - type: string - messages: - items: - $ref: '#/components/messages/item' - -operations: - postEvents: - action: send - bindings: - http: - type: request - method: POST - channel: - $ref: '#/channels/items' - getEvents: - action: receive - bindings: - http: - type: request - method: GET - query: - type: object - properties: - limit: - type: number - channel: - $ref: '#/channels/itemsbyid' - -components: - correlationIds: - itemsCorrelationId: - location: '$message.header#/idempotency-key' - messages: - item: - name: event - title: An event - correlationId: - $ref: "#/components/correlationIds/itemsCorrelationId" - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - contentType: application/json - payload: - type: object - properties: - item: - $ref: "#/components/schemas/item" - schemas: - item: - type: object - properties: - greeting: - type: string - required: - - greeting diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/validator/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/validator/zilla.yaml deleted file mode 100644 index d97ca1fed1..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/http/proxy/validator/zilla.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 8080 - routes: - - exit: http_server0 - when: - - port: 8080 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - requests: - - path: "/items/{id}" - method: GET - params: - path: - id: string - content: - model: json - catalog: - catalog0: - - subject: item - - path: /items - method: POST - content: - model: json - catalog: - catalog0: - - subject: item - routes: - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items/* - :method: GET - - exit: http_client0 - when: - - headers: - :scheme: http - :authority: localhost:8080 - :path: /items - :method: POST - http_client0: - type: http - kind: client - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -catalogs: - catalog0: - type: inline - options: - subjects: - item: - schema: | - type: object - properties: - greeting: - type: string - required: - - greeting - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/complete/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/complete/asyncapi.yaml deleted file mode 100644 index 33e3411f30..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/complete/asyncapi.yaml +++ /dev/null @@ -1,86 +0,0 @@ -asyncapi: 3.0.0 -info: - title: Zilla MQTT Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - secure: - host: mqtts://localhost:8883 - protocol: secure-mqtt - plain: - host: mqtt://localhost:1883 - protocol: mqtt -defaultContentType: application/json - -channels: - smartylighting: - address: "smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured" - title: MQTT Topic to produce & consume topic. - parameters: - streetlightId: - $ref: '#/components/parameters/streetlightId' - messages: - items: - $ref: '#/components/messages/item' - -operations: - sendEvents: - action: send - channel: - $ref: '#/channels/smartylighting' - - receiveEvents: - action: receive - channel: - $ref: '#/channels/smartylighting' - -components: - parameters: - streetlightId: - description: Street Light ID - location: $message.header#/id - messages: - item: - name: event - title: An event - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - id: - description: Street Light ID - type: string - contentType: application/json - payload: - type: object - properties: - item: - $ref: "#/components/schemas/item" - thing: - name: thing - title: A thing - contentType: application/json - payload: - type: object - properties: - item: - $ref: "#/components/schemas/thing" - schemas: - item: - type: object - properties: - id: - type: string - status: - type: string - required: - - id - - status - thing: - type: object - properties: - sunshine: - type: integer diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/complete/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/complete/zilla.yaml deleted file mode 100644 index 630cd6ddf8..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/complete/zilla.yaml +++ /dev/null @@ -1,109 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: - - 1883 - - 8883 - routes: - - exit: mqtt_server0 - when: - - port: 1883 - - exit: tls_server0 - when: - - port: 8883 - tls_server0: - type: tls - kind: server - vault: server - options: - keys: - - "${{env.TLS_SERVER_KEY}}" - sni: - - "${{env.TLS_SERVER_SNI}}" - alpn: - - "${{env.TLS_SERVER_ALPN}}" - exit: mqtt_server0 - mqtt_server0: - type: mqtt - kind: server - options: - topics: - - name: smartylighting/streetlights/1/0/event/*/lighting/measured - content: - model: json - catalog: - catalog0: - - subject: items - routes: - - exit: mqtt_client0 - when: - - publish: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - - subscribe: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - mqtt_client0: - type: mqtt - kind: client - exit: tls_client0 - tls_client0: - type: tls - kind: client - vault: client - options: - trust: - - "${{env.TLS_CLIENT_TRUST}}" - trustcacerts: true - sni: - - "${{env.TLS_CLIENT_SNI}}" - alpn: - - "${{env.TLS_CLIENT_ALPN}}" - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -vaults: - client: - type: filesystem - options: - trust: - store: "${{env.TRUSTSTORE_PATH}}" - type: "${{env.TRUSTSTORE_TYPE}}" - password: "${{env.TRUSTSTORE_PASSWORD}}" - server: - type: filesystem - options: - keys: - store: "${{env.KEYSTORE_PATH}}" - type: "${{env.KEYSTORE_TYPE}}" - password: "${{env.KEYSTORE_PASSWORD}}" -catalogs: - catalog0: - type: inline - options: - subjects: - item: - schema: | - type: object - properties: - id: - type: string - status: - type: string - required: - - id - - status - version: latest - thing: - schema: | - type: object - properties: - sunshine: - type: integer - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/plain/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/plain/asyncapi.yaml deleted file mode 100644 index 9135f5aad4..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/plain/asyncapi.yaml +++ /dev/null @@ -1,52 +0,0 @@ -asyncapi: 3.0.0 -info: - title: Zilla MQTT Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - plain: - host: mqtt://localhost:1883 - protocol: mqtt -defaultContentType: application/json - -channels: - smartylighting: - address: "smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured" - title: MQTT Topic to produce & consume topic. - parameters: - streetlightId: - $ref: '#/components/parameters/streetlightId' - messages: - items: - $ref: '#/components/messages/item' - -operations: - sendEvents: - action: send - channel: - $ref: '#/channels/smartylighting' - - receiveEvents: - action: receive - channel: - $ref: '#/channels/smartylighting' - -components: - parameters: - streetlightId: - description: Street Light ID - location: $message.header#/id - messages: - item: - name: event - title: An event - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - id: - description: Street Light ID - type: string diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/plain/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/plain/zilla.yaml deleted file mode 100644 index 9ed3ffa917..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/plain/zilla.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 1883 - routes: - - exit: mqtt_server0 - when: - - port: 1883 - mqtt_server0: - type: mqtt - kind: server - routes: - - exit: mqtt_client0 - when: - - publish: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - - subscribe: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - mqtt_client0: - type: mqtt - kind: client - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/tls/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/tls/asyncapi.yaml deleted file mode 100644 index 7b25e0f46c..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/tls/asyncapi.yaml +++ /dev/null @@ -1,52 +0,0 @@ -asyncapi: 3.0.0 -info: - title: Zilla MQTT Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - secure: - host: mqtts://localhost:8883 - protocol: secure-mqtt -defaultContentType: application/json - -channels: - smartylighting: - address: "smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured" - title: MQTT Topic to produce & consume topic. - parameters: - streetlightId: - $ref: '#/components/parameters/streetlightId' - messages: - items: - $ref: '#/components/messages/item' - -operations: - sendEvents: - action: send - channel: - $ref: '#/channels/smartylighting' - - receiveEvents: - action: receive - channel: - $ref: '#/channels/smartylighting' - -components: - parameters: - streetlightId: - description: Street Light ID - location: $message.header#/id - messages: - item: - name: event - title: An event - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - id: - description: Street Light ID - type: string diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/tls/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/tls/zilla.yaml deleted file mode 100644 index ea7615f996..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/tls/zilla.yaml +++ /dev/null @@ -1,72 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 8883 - routes: - - exit: tls_server0 - when: - - port: 8883 - tls_server0: - type: tls - kind: server - vault: server - options: - keys: - - "${{env.TLS_SERVER_KEY}}" - sni: - - "${{env.TLS_SERVER_SNI}}" - alpn: - - "${{env.TLS_SERVER_ALPN}}" - exit: mqtt_server0 - mqtt_server0: - type: mqtt - kind: server - routes: - - exit: mqtt_client0 - when: - - publish: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - - subscribe: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - mqtt_client0: - type: mqtt - kind: client - exit: tls_client0 - tls_client0: - type: tls - kind: client - vault: client - options: - trust: - - "${{env.TLS_CLIENT_TRUST}}" - trustcacerts: true - sni: - - "${{env.TLS_CLIENT_SNI}}" - alpn: - - "${{env.TLS_CLIENT_ALPN}}" - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -vaults: - client: - type: filesystem - options: - trust: - store: "${{env.TRUSTSTORE_PATH}}" - type: "${{env.TRUSTSTORE_TYPE}}" - password: "${{env.TRUSTSTORE_PASSWORD}}" - server: - type: filesystem - options: - keys: - store: "${{env.KEYSTORE_PATH}}" - type: "${{env.KEYSTORE_TYPE}}" - password: "${{env.KEYSTORE_PASSWORD}}" diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/validator/asyncapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/validator/asyncapi.yaml deleted file mode 100644 index 9684991956..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/validator/asyncapi.yaml +++ /dev/null @@ -1,85 +0,0 @@ -asyncapi: 3.0.0 -info: - title: Zilla MQTT Proxy - version: 1.0.0 - license: - name: Aklivity Community License -servers: - plain: - host: mqtt://localhost:1883 - protocol: mqtt -defaultContentType: application/json - -channels: - smartylighting: - address: "smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured" - title: MQTT Topic to produce & consume topic. - parameters: - streetlightId: - $ref: '#/components/parameters/streetlightId' - messages: - items: - $ref: '#/components/messages/item' - things: - $ref: '#/components/messages/thing' - -operations: - sendEvents: - action: send - channel: - $ref: '#/channels/smartylighting' - - receiveEvents: - action: receive - channel: - $ref: '#/channels/smartylighting' - -components: - parameters: - streetlightId: - description: Street Light ID - location: $message.header#/id - messages: - item: - name: event - title: An event - headers: - type: object - properties: - idempotency-key: - description: Unique identifier for a given event - type: string - id: - description: Street Light ID - type: string - contentType: application/json - payload: - type: object - properties: - item: - $ref: "#/components/schemas/item" - thing: - name: thing - title: A thing - contentType: application/json - payload: - type: object - properties: - item: - $ref: "#/components/schemas/thing" - schemas: - item: - type: object - properties: - id: - type: string - status: - type: string - required: - - id - - status - thing: - type: object - properties: - sunshine: - type: integer diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/validator/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/validator/zilla.yaml deleted file mode 100644 index 8f8348a2f0..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/asyncapi/mqtt/proxy/validator/zilla.yaml +++ /dev/null @@ -1,65 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 1883 - routes: - - exit: mqtt_server0 - when: - - port: 1883 - mqtt_server0: - type: mqtt - kind: server - options: - topics: - - name: smartylighting/streetlights/1/0/event/*/lighting/measured - content: - model: json - catalog: - catalog0: - - subject: items - - subject: things - routes: - - exit: mqtt_client0 - when: - - publish: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - - subscribe: - - topic: smartylighting/streetlights/1/0/event/*/lighting/measured - mqtt_client0: - type: mqtt - kind: client - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -catalogs: - catalog0: - type: inline - options: - subjects: - item: - schema: | - type: object - properties: - id: - type: string - status: - type: string - required: - - id - - status - version: latest - thing: - schema: | - type: object - properties: - sunshine: - type: integer - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/complete/openapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/complete/openapi.yaml deleted file mode 100644 index 13a73200b5..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/complete/openapi.yaml +++ /dev/null @@ -1,173 +0,0 @@ -openapi: 3.1.0 -hello: $.openapi -info: - version: 1.0.0 - title: Zilla CRUD V1 - license: - name: Aklivity Community License -servers: - - url: http://localhost:8080 - - url: https://localhost:9090 -paths: - /items: - post: - summary: Create an item - operationId: createItem - tags: - - items - requestBody: - content: - 'application/json': - schema: - $ref: '#/components/schemas/Item' - responses: - '204': - description: No Content - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - security: - - bearerAuth: - - create:items - get: - summary: List all items - operationId: listItems - tags: - - items - parameters: - - name: limit - in: query - description: How many items to return at one time (max 100) - required: false - schema: - type: integer - maximum: 100 - format: int32 - responses: - '200': - description: A paged array of items - headers: - x-pages: - description: Total number of pages - schema: - type: integer - x-next: - description: A link to the next page of responses - schema: - type: string - content: - application/json: - schema: - $ref: "#/components/schemas/Items" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - security: - - bearerAuth: - - list:items - /items/{id}: - get: - summary: Get an item - operationId: showItemById - tags: - - items - parameters: - - name: id - in: path - required: true - description: The id of the item to retrieve - schema: - type: string - responses: - '200': - description: Expected response to a valid request - content: - application/json: - schema: - $ref: "#/components/schemas/Item" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - put: - summary: Update an item by key - operationId: updateItem - tags: - - items - parameters: - - name: id - in: path - required: true - description: The id of the item to update - schema: - type: string - responses: - '204': - description: No Content - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - delete: - summary: Delete an item by key - operationId: deleteItem - tags: - - items - parameters: - - name: id - in: path - required: true - description: The id of the item to delete - schema: - type: string - responses: - '204': - description: No Content - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" -components: - schemas: - Item: - type: object - required: - - greeting - properties: - greeting: - type: string - tag: - type: string - Items: - type: array - maxItems: 100 - items: - $ref: "#/components/schemas/Item" - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: jwt diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/complete/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/complete/zilla.yaml deleted file mode 100644 index 887dcbdc11..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/complete/zilla.yaml +++ /dev/null @@ -1,222 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: - - 8080 - - 9090 - routes: - - exit: http_server0 - when: - - port: 8080 - - exit: tls_server0 - when: - - port: 9090 - tls_server0: - type: tls - kind: server - vault: server - options: - keys: - - "${{env.TLS_SERVER_KEY}}" - sni: - - "${{env.TLS_SERVER_SNI}}" - alpn: - - "${{env.TLS_SERVER_ALPN}}" - exit: http_server0 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - authorization: - jwt0: - credentials: - headers: - authorization: "Bearer {credentials}" - requests: - - path: /items - method: GET - params: - query: - limit: int32 - - path: /items - method: POST - content: - model: json - catalog: - catalog0: - - subject: Item - - path: "/items/{id}" - method: GET - params: - path: - id: string - - path: "/items/{id}" - method: PUT - params: - path: - id: string - - path: "/items/{id}" - method: DELETE - params: - path: - id: string - routes: - - exit: http_client0 - when: - - headers: - :path: /items - :method: GET - guarded: - jwt0: - - list:items - - exit: http_client0 - when: - - headers: - :path: /items - :method: POST - guarded: - jwt0: - - create:items - - exit: http_client0 - when: - - headers: - :path: /items/* - :method: GET - - exit: http_client0 - when: - - headers: - :path: /items/* - :method: PUT - - exit: http_client0 - when: - - headers: - :path: /items/* - :method: DELETE - http_client0: - type: http - kind: client - options: - requests: - - path: /items - method: GET - responses: - - status: 200 - content-type: - - application/json - headers: - x-pages: int32 - x-next: string - content: - model: json - catalog: - catalog0: - - subject: Items - - path: "/items/{id}" - method: GET - responses: - - status: 200 - content-type: - - application/json - content: - model: json - catalog: - catalog0: - - subject: Item - exit: tls_client0 - tls_client0: - type: tls - kind: client - vault: client - options: - trust: - - "${{env.TLS_CLIENT_TRUST}}" - trustcacerts: true - sni: - - "${{env.TLS_CLIENT_SNI}}" - alpn: - - "${{env.TLS_CLIENT_ALPN}}" - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -guards: - jwt0: - type: jwt - options: - issuer: "${{env.JWT_ISSUER}}" - audience: "${{env.JWT_AUDIENCE}}" - keys: - - kty: "${{env.JWT_KTY}}" - "n": "${{env.JWT_N}}" - e: "${{env.JWT_E}}" - alg: "${{env.JWT_ALG}}" - crv: "${{env.JWT_CRV}}" - x: "${{env.JWT_X}}" - "y": "${{env.JWT_Y}}" - use: "${{env.JWT_USE}}" - kid: "${{env.JWT_KID}}" -vaults: - client: - type: filesystem - options: - trust: - store: "${{env.TRUSTSTORE_PATH}}" - type: "${{env.TRUSTSTORE_TYPE}}" - password: "${{env.TRUSTSTORE_PASSWORD}}" - server: - type: filesystem - options: - keys: - store: "${{env.KEYSTORE_PATH}}" - type: "${{env.KEYSTORE_TYPE}}" - password: "${{env.KEYSTORE_PASSWORD}}" -catalogs: - catalog0: - type: inline - options: - subjects: - Item: - schema: | - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest - Error: - schema: | - type: object - properties: - code: - type: integer - message: - type: string - required: - - code - - message - version: latest - Items: - schema: | - type: array - items: - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/jwt/openapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/jwt/openapi.yaml deleted file mode 100644 index 16bb52f2c4..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/jwt/openapi.yaml +++ /dev/null @@ -1,82 +0,0 @@ -openapi: 3.1.0 -hello: $.openapi -info: - version: 1.0.0 - title: Zilla CRUD V1 - license: - name: Aklivity Community License -servers: - - url: http://localhost:8080 -paths: - /items: - post: - summary: Create an item - operationId: createItem - tags: - - items - requestBody: - content: - 'application/json': - schema: - $ref: '#/components/schemas/Item' - responses: - '204': - description: No Content - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - security: - - bearerAuth: - - create:items - get: - summary: List all items - operationId: listItems - tags: - - items - responses: - '200': - description: A paged array of items - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - security: - - bearerAuth: - - list:items -components: - schemas: - Item: - type: object - required: - - greeting - properties: - greeting: - type: string - tag: - type: string - Items: - type: array - maxItems: 100 - items: - $ref: "#/components/schemas/Item" - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: jwt diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/jwt/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/jwt/zilla.yaml deleted file mode 100644 index 65dc139e8c..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/jwt/zilla.yaml +++ /dev/null @@ -1,115 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 8080 - routes: - - exit: http_server0 - when: - - port: 8080 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - authorization: - jwt0: - credentials: - headers: - authorization: "Bearer {credentials}" - requests: - - path: /items - method: POST - content: - model: json - catalog: - catalog0: - - subject: Item - routes: - - exit: http_client0 - when: - - headers: - :path: /items - :method: GET - guarded: - jwt0: - - list:items - - exit: http_client0 - when: - - headers: - :path: /items - :method: POST - guarded: - jwt0: - - create:items - http_client0: - type: http - kind: client - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -guards: - jwt0: - type: jwt - options: - issuer: "${{env.JWT_ISSUER}}" - audience: "${{env.JWT_AUDIENCE}}" - keys: - - kty: "${{env.JWT_KTY}}" - "n": "${{env.JWT_N}}" - e: "${{env.JWT_E}}" - alg: "${{env.JWT_ALG}}" - crv: "${{env.JWT_CRV}}" - x: "${{env.JWT_X}}" - "y": "${{env.JWT_Y}}" - use: "${{env.JWT_USE}}" - kid: "${{env.JWT_KID}}" -catalogs: - catalog0: - type: inline - options: - subjects: - Item: - schema: | - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest - Error: - schema: | - type: object - properties: - code: - type: integer - message: - type: string - required: - - code - - message - version: latest - Items: - schema: | - type: array - items: - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/plain/openapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/plain/openapi.yaml deleted file mode 100644 index dd1e252656..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/plain/openapi.yaml +++ /dev/null @@ -1,52 +0,0 @@ -openapi: 3.1.0 -hello: $.openapi -info: - version: 1.0.0 - title: Zilla CRUD V1 - license: - name: Aklivity Community License -servers: - - url: http://localhost:8080 -paths: - /items: - get: - summary: List all items - operationId: listItems - tags: - - items - responses: - '200': - description: A paged array of items - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" -components: - schemas: - Item: - type: object - required: - - greeting - properties: - greeting: - type: string - tag: - type: string - Items: - type: array - maxItems: 100 - items: - $ref: "#/components/schemas/Item" - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/plain/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/plain/zilla.yaml deleted file mode 100644 index 7a2da21a59..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/plain/zilla.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 8080 - routes: - - exit: http_server0 - when: - - port: 8080 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - routes: - - exit: http_client0 - when: - - headers: - :path: /items - :method: GET - http_client0: - type: http - kind: client - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -catalogs: - catalog0: - type: inline - options: - subjects: - Item: - schema: | - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest - Error: - schema: | - type: object - properties: - code: - type: integer - message: - type: string - required: - - code - - message - version: latest - Items: - schema: | - type: array - items: - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/tls/openapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/tls/openapi.yaml deleted file mode 100644 index 7ff62c148c..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/tls/openapi.yaml +++ /dev/null @@ -1,52 +0,0 @@ -openapi: 3.1.0 -hello: $.openapi -info: - version: 1.0.0 - title: Zilla CRUD V1 - license: - name: Aklivity Community License -servers: - - url: https://localhost:9090 -paths: - /items: - get: - summary: List all items - operationId: listItems - tags: - - items - responses: - '200': - description: A paged array of items - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" -components: - schemas: - Item: - type: object - required: - - greeting - properties: - greeting: - type: string - tag: - type: string - Items: - type: array - maxItems: 100 - items: - $ref: "#/components/schemas/Item" - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/tls/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/tls/zilla.yaml deleted file mode 100644 index 5a7a8b176f..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/tls/zilla.yaml +++ /dev/null @@ -1,115 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 9090 - routes: - - exit: tls_server0 - when: - - port: 9090 - tls_server0: - type: tls - kind: server - vault: server - options: - keys: - - "${{env.TLS_SERVER_KEY}}" - sni: - - "${{env.TLS_SERVER_SNI}}" - alpn: - - "${{env.TLS_SERVER_ALPN}}" - exit: http_server0 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - routes: - - exit: http_client0 - when: - - headers: - :path: /items - :method: GET - http_client0: - type: http - kind: client - exit: tls_client0 - tls_client0: - type: tls - kind: client - vault: client - options: - trust: - - "${{env.TLS_CLIENT_TRUST}}" - trustcacerts: true - sni: - - "${{env.TLS_CLIENT_SNI}}" - alpn: - - "${{env.TLS_CLIENT_ALPN}}" - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -vaults: - client: - type: filesystem - options: - trust: - store: "${{env.TRUSTSTORE_PATH}}" - type: "${{env.TRUSTSTORE_TYPE}}" - password: "${{env.TRUSTSTORE_PASSWORD}}" - server: - type: filesystem - options: - keys: - store: "${{env.KEYSTORE_PATH}}" - type: "${{env.KEYSTORE_TYPE}}" - password: "${{env.KEYSTORE_PASSWORD}}" -catalogs: - catalog0: - type: inline - options: - subjects: - Item: - schema: | - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest - Error: - schema: | - type: object - properties: - code: - type: integer - message: - type: string - required: - - code - - message - version: latest - Items: - schema: | - type: array - items: - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/validator/openapi.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/validator/openapi.yaml deleted file mode 100644 index d9d2e52300..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/validator/openapi.yaml +++ /dev/null @@ -1,179 +0,0 @@ -openapi: 3.1.0 -hello: $.openapi -info: - version: 1.0.0 - title: Zilla CRUD V1 - license: - name: Aklivity Community License -servers: - - url: http://localhost:8080 -paths: - /items: - post: - summary: Create an item - operationId: createItem - tags: - - items - requestBody: - content: - 'application/json': - schema: - $ref: '#/components/schemas/Item' - responses: - '204': - description: No Content - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - get: - summary: List all items - operationId: listItems - tags: - - items - parameters: - - name: limit - in: query - description: How many items to return at one time (max 100) - required: false - schema: - type: integer - maximum: 100 - format: int32 - responses: - '200': - description: A paged array of items - headers: - x-pages: - description: Total number of pages - schema: - type: integer - x-next: - description: A link to the next page of responses - schema: - type: string - content: - application/json: - schema: - $ref: "#/components/schemas/Items" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /items/{id}: - get: - summary: Get an item - operationId: showItemById - tags: - - items - parameters: - - name: id - in: path - required: true - description: The id of the item to retrieve - schema: - type: string - responses: - '200': - description: Expected response to a valid request - content: - application/json: - schema: - $ref: "#/components/schemas/Item" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - put: - summary: Update an item by key - operationId: updateItem - tags: - - items - parameters: - - name: id - in: path - required: true - description: The id of the item to update - schema: - type: string - - name: limit - in: query - description: How many items to return at one time (max 100) - required: false - schema: - type: integer - - name: hello - in: header - description: Example header parameter - required: false - schema: - type: integer - - name: ciao - in: query - description: Example query parameter - required: false - schema: - type: string - responses: - '204': - description: No Content - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - delete: - summary: Delete an item by key - operationId: deleteItem - tags: - - items - parameters: - - name: id - in: path - required: true - description: The id of the item to delete - schema: - type: string - responses: - '204': - description: No Content - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" -components: - schemas: - Item: - type: object - required: - - greeting - properties: - greeting: - type: string - tag: - type: string - Items: - type: array - maxItems: 100 - items: - $ref: "#/components/schemas/Item" - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string diff --git a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/validator/zilla.yaml b/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/validator/zilla.yaml deleted file mode 100644 index fd56f8f75e..0000000000 --- a/incubator/command-generate/src/test/resources/io/aklivity/zilla/runtime/command/generate/internal/openapi/http/proxy/validator/zilla.yaml +++ /dev/null @@ -1,155 +0,0 @@ -name: example -bindings: - tcp_server0: - type: tcp - kind: server - options: - host: 0.0.0.0 - port: 8080 - routes: - - exit: http_server0 - when: - - port: 8080 - http_server0: - type: http - kind: server - options: - access-control: - policy: cross-origin - requests: - - path: /items - method: GET - params: - query: - limit: int32 - - path: /items - method: POST - content: - model: json - catalog: - catalog0: - - subject: Item - - path: "/items/{id}" - method: GET - params: - path: - id: string - - path: "/items/{id}" - method: PUT - headers: - hello: int32 - params: - path: - id: string - query: - limit: int32 - ciao: string - - path: "/items/{id}" - method: DELETE - params: - path: - id: string - routes: - - exit: http_client0 - when: - - headers: - :path: /items - :method: GET - - exit: http_client0 - when: - - headers: - :path: /items - :method: POST - - exit: http_client0 - when: - - headers: - :path: /items/* - :method: GET - - exit: http_client0 - when: - - headers: - :path: /items/* - :method: PUT - - exit: http_client0 - when: - - headers: - :path: /items/* - :method: DELETE - http_client0: - type: http - kind: client - options: - requests: - - path: /items - method: GET - responses: - - status: 200 - content-type: - - application/json - headers: - x-pages: int32 - x-next: string - content: - model: json - catalog: - catalog0: - - subject: Items - - path: "/items/{id}" - method: GET - responses: - - status: 200 - content-type: - - application/json - content: - model: json - catalog: - catalog0: - - subject: Item - exit: tcp_client0 - tcp_client0: - type: tcp - kind: client - options: - host: "${{env.TCP_CLIENT_HOST}}" - port: ${{env.TCP_CLIENT_PORT}} -catalogs: - catalog0: - type: inline - options: - subjects: - Item: - schema: | - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest - Error: - schema: | - type: object - properties: - code: - type: integer - message: - type: string - required: - - code - - message - version: latest - Items: - schema: | - type: array - items: - type: object - properties: - greeting: - type: string - tag: - type: string - required: - - greeting - version: latest diff --git a/incubator/pom.xml b/incubator/pom.xml index 697d987843..3a394cb372 100644 --- a/incubator/pom.xml +++ b/incubator/pom.xml @@ -26,7 +26,6 @@ command-log command-dump - command-generate command-tune @@ -57,11 +56,6 @@ command-dump ${project.version} - - ${project.groupId} - command-generate - ${project.version} -