Env:
Drill 1.2Goal:
How to use shell script variables and REST API to create Drill storage pluginsSolution:
In https://drill.apache.org/docs/plugin-configuration-basics/, here is an example to use REST API to create a sample Drill storage plugin:curl -X POST -H "Content-Type: application/json" -d '{"name":"myplugin", "config": {"type": "file", "enabled": false, "connection": "file:///", "workspaces": { "root": { "location": "/", "writable": false, "defaultInputFormat": null}}, "formats": null}}' http://localhost:8047/storage/myplugin.json
If we want to add a variable, we can use shell script to do that. Since the content may be in the single or double quotes, the key here is to close the quotes firstly, and then insert into the variable.
For example, "writable" can be a variable -- true or false. Here is a shell script -- create_storage.sh:
curl -X POST -H "Content-Type: application/json" -d '{"name":"myplugin", "config": {"type": "file", "enabled": false, "connection": "file:///", "workspaces": { "root": { "location": "/", "writable": '"$1"', "defaultInputFormat": null}}, "formats": null}}' http://localhost:8047/storage/myplugin.json
Run it:
# ./create_storage.sh true
{
"result" : "success"
}
9D2FDEB3
ReplyDeleteSarıçam
İçmeler
Kınık
Sivrihisar
Gümbet
Kumluca
Hopa
Gökçeada
Atakum
3AF192FC
ReplyDeleteBağlar
Kemalpaşa
Yeşilyurt
Alanya
Ezine
Çiğli
Konak
Gölhisar
Silifke
A41D7535
ReplyDeleteAliağa
Selçuk
Kepez
Serik
Akhisar
Bahçelievler
Arsuz
Milas
Osmangazi