blob: 40b2760c28898d78bdb1d085cfa15ea3fd2ff0a5 (
plain)
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
36
37
38
39
|
. ./lib/url.sh
_cac_exec() {
if test -z "${cac_via-}"; then
(exec "$@")
else
ssh -q "$cac_via" -t "$@"
fi
}
_cac_get_api_v1() {
_cac_exec curl -fsS \
$(shift
set -- "$@" login="$cac_login" key="$cac_key"
for arg; do
echo -d $(printf '%s' "$arg" | url_encode)
done
) \
-G "https://panel.cloudatcost.com/api/v1/$1.php"
}
_cac_post_api_v1() {
_cac_exec curl -fsS \
$(shift
set -- "$@" login="$cac_login" key="$cac_key"
for arg; do
echo -d $(printf '%s' "$arg" | url_encode)
done
) \
-X POST "https://panel.cloudatcost.com/api/v1/$1.php"
}
cac_listservers() {
_cac_get_api_v1 listservers
}
cac_listtasks() {
_cac_get_api_v1 listtasks
}
|