summaryrefslogtreecommitdiffstats
path: root/lib/cac.sh
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-05-21 01:56:08 +0200
committertv <tv@shackspace.de>2015-05-21 01:56:08 +0200
commit36670f3e1cccad579b994a29320eeb8e287803b7 (patch)
tree484cb2c1075cdcabe8020ca40704f4d68f2b2fed /lib/cac.sh
parentb95a514bcced00af77ae4adab77326dba9ab4c36 (diff)
sh: functions -> bin/
Diffstat (limited to 'lib/cac.sh')
-rw-r--r--lib/cac.sh105
1 files changed, 0 insertions, 105 deletions
diff --git a/lib/cac.sh b/lib/cac.sh
deleted file mode 100644
index fea6886be..000000000
--- a/lib/cac.sh
+++ /dev/null
@@ -1,105 +0,0 @@
-. ./lib/url.sh
-
-cac_ssh() {(
- server=$1
- shift
-
- address=$(echo $server | jq -r .ip)
- target=root@$address
-
- SSHPASS=$(echo $server | jq -r .rootpass)
- export SSHPASS
-
- exec sshpass -e ssh \
- -o StrictHostKeyChecking=no \
- -o UserKnownHostsFile=/dev/null \
- "$target" \
- "$@"
-)}
-
-cac_getserver_by_servername() {(
- serverlist=$(cac_listservers)
- echo $serverlist \
- | jq \
- --arg name "$1" \
- '.[]|select(.servername==$name)'
-)}
-
-
-cac_listservers() {(
- listservers=$(_cac_get_api_v1 listservers)
- status=$(echo "$listservers" | jq -r .status)
- if [ "$status" = ok ]; then
- echo "$listservers" | jq -r .data
- else
- echo "$0: bad listservers status: $status" >&2
- exit 1
- fi
-)}
-
-cac_listtasks() {
- _cac_get_api_v1 listtasks
-}
-
-cac_listtemplates() {
- _cac_get_api_v1 listtemplates
-}
-
-cac_console() {
- _cac_post_api_v1 console sid="$1"
-}
-
-cac_powerop() {
- _cac_post_api_v1 powerop sid="$1" action="$2"
-}
-
-cac_renameserver() {
- _cac_post_api_v1 renameserver sid="$1" name="$2"
-}
-
-cac_rnds() {
- _cac_post_api_v1 rdns sid="$1" hostname="$2"
-}
-
-cac_runmode() {
- _cac_post_api_v1 rdns sid="$1" mode="$2"
-}
-
-# default os=26 is CentOS-7-64bit
-cac_cloudpro_build() {
- _cac_post_api_v1 cloudpro/build cpu="$1" ram="$2" storage="$3" os="${4-26}"
-}
-
-cac_cloudpro_delete() {
- _cac_post_api_v1 cloudpro/delete sid="$1"
-}
-
-cac_cloudpro_resources() {
- _cac_get_api_v1 cloudpro/resources
-}
-
-_cac_get_api_v1() {
- _cac_curl_api_v1 -G "$@"
-}
-
-_cac_post_api_v1() {
- _cac_curl_api_v1 -XPOST "$@"
-}
-
-_cac_curl_api_v1() {
- _cac_exec curl -fsS "$1" "https://panel.cloudatcost.com/api/v1/$2.php" $(
- shift 2
- set -- "$@" login="$cac_login" key="$cac_key"
- for arg; do
- echo -d $(printf '%s' "$arg" | url_encode)
- done
- )
-}
-
-_cac_exec() {
- if test -z "${cac_via-}"; then
- (exec "$@")
- else
- ssh -q "$cac_via" -t "$@"
- fi
-}