The Kuiper REST api for plugins allows you to manage plugins, such as create, drop and list plugins. Notice that, drop a plugin will need to restart kuiper to take effect. To update a plugin, do the following:
The API accepts a JSON content to create a new plugin. Each plugin type has a standalone endpoint. The supported types are ["sources", "sinks", "functions"]
. The plugin is identified by the name. The name must be unique.
POST http://localhost:9081/plugins/sources
POST http://localhost:9081/plugins/sinks
POST http://localhost:9081/plugins/functions
Request Sample
{
"name":"random",
"file":"http://127.0.0.1/plugins/sources/random.zip"
}
Random
, then the name of this plugin is random
.A sample zip file for a source named random.zip
Notice that, the install.sh will be run that the system may already had the lib or package. Make sure to check the path before. Below is an example install.sh to install a sample sdk lib.
#!/bin/sh
dir=/usr/local/mysdk
cur=$(dirname "$0")
echo "Base path $cur"
if [ -d "$dir" ]; then
echo "SDK path $dir exists."
else
echo "Creating SDK path $dir"
mkdir -p $dir
echo "Created SDK path $dir"
fi
apt install --no-upgrade unzip
if [ -d "$dir/lib" ]; then
echo "SDK lib path $dir/lib exists."
else
echo "Unzip SDK lib to path $dir"
unzip $cur/mysdk.zip -d $dir
echo "Unzipped SDK lib to path $dir"
fi
if [ -f "/etc/ld.so.conf.d/myconfig.conf" ]; then
echo "/etc/ld.so.conf.d/myconfig.conf exists"
else
echo "Copy conf file"
cp $cur/myconfig.conf /etc/ld.so.conf.d/
echo "Copied conf file"
fi
ldconfig
echo "Done"
The API is used for displaying all of plugins defined in the server for a plugin type.
GET http://localhost:9081/plugins/sources
GET http://localhost:9081/plugins/sinks
GET http://localhost:9081/plugins/functions
Response Sample:
["plugin1","plugin2"]
The API is used to print out the detailed definition of a plugin.
GET http://localhost:9081/plugins/sources/{name}
GET http://localhost:9081/plugins/sinks/{name}
GET http://localhost:9081/plugins/functions/{name}
Path parameter name
is the name of the plugin.
Response Sample:
{
"name": "plugin1",
"version": "1.0.0"
}
The API is used for drop the plugin. The kuiper server needs to be restarted to take effect.
DELETE http://localhost:8080/plugins/sources/{name}
DELETE http://localhost:8080/plugins/sinks/{name}
DELETE http://localhost:8080/plugins/functions/{name}
The user can pass a query parameter to decide if Kuiper should be stopped after a delete in order to make the deletion take effect. The parameter is restart
and only when the value is 1
will the Kuiper be stopped. The user has to manually restart it.
DELETE http://localhost:8080/plugins/sources/{name}?restart=1