From 5245d6dd955b159c7a59c4e6e0496cf42d2f464c Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 May 2015 20:40:42 +0200 Subject: lib/cac.sh: move low level functions to bottom --- lib/cac.sh | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'lib') 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 +} -- cgit v1.2.3