-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsource_registration.sh
35 lines (32 loc) · 981 Bytes
/
source_registration.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
cmd=$1
usage() {
echo "source_registration.sh <command> <arguments>"
echo "Available commands:"
echo " register_connector register a new Kafka connector"
echo "Available arguments:"
echo " [connector config path] path to connector config, for command register_connector only"
}
if [[ -z "$cmd" ]]; then
echo "Missing command"
usage
exit 1
fi
case $cmd in
register_connector)
if [[ -z "$2" ]]; then
echo "Missing connector config path"
usage
exit 1
else
echo "Registering a new connector from $2"
# Assign a connector config path such as: kafka_connect_jdbc/configs/connect-timescaledb-sink.json
curl -i -X POST -H "Accept:application/json" -H 'Content-Type: application/json' http://localhost:8083/connectors -d @$2
fi
;;
*)
echo -n "Unknown command: $cmd"
usage
exit 1
;;
esac