diff options
author | tv <tv@krebsco.de> | 2015-05-20 20:40:42 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2015-05-20 20:40:42 +0200 |
commit | e99562597b7978ab48ad8ce68356de580b6b439f (patch) | |
tree | 83d50f92d4e630393b690b3147bdad6eecf8edd8 /lib/cac.sh | |
parent | 283a1b792a63f07f26bb0d0a9b5e40fc94785575 (diff) |
lib/cac.sh: move low level functions to bottom
Diffstat (limited to 'lib/cac.sh')
-rw-r--r-- | lib/cac.sh | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -1,31 +1,5 @@ . ./lib/url.sh -_cac_exec() { - if test -z "${cac_via-}"; then - (exec "$@") - else - ssh -q "$cac_via" -t "$@" - fi -} - -_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_get_api_v1() { - _cac_curl_api_v1 -G "$@" -} - -_cac_post_api_v1() { - _cac_curl_api_v1 -XPOST "$@" -} - cac_listservers() { _cac_get_api_v1 listservers } @@ -70,3 +44,29 @@ cac_cloudpro_delete() { 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 +} |