diff options
author | tv <tv@shackspace.de> | 2015-05-20 20:40:42 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-05-20 20:40:42 +0200 |
commit | 5245d6dd955b159c7a59c4e6e0496cf42d2f464c (patch) | |
tree | 83d50f92d4e630393b690b3147bdad6eecf8edd8 | |
parent | 3a9d198be6d67c9347a3f5beff7f391561df30f2 (diff) |
lib/cac.sh: move low level functions to bottom
-rw-r--r-- | lib/cac.sh | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lib/cac.sh b/lib/cac.sh index 5e3f4ec70..0bc9d3369 100644 --- a/lib/cac.sh +++ b/lib/cac.sh @@ -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 +} |