/
agave.clj
36 lines (31 loc) · 938 Bytes
/
agave.clj
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
(ns donkey.clients.agave
(:use [clojure.java.io :only [reader]])
(:require [cemerick.url :as curl]
[clj-http.client :as client]
[donkey.util.config :as config]
[donkey.util.service :as service]))
(defn- agave-url
[& path-components]
(str (apply curl/url (config/agave-base-url) path-components)))
(defn- get-app-listing
[]
(-> (client/get (agave-url "apps-v1" "apps" "list")
{:accept :json
:as :stream})
(:body)
(service/decode-json)
(:result)))
(defn list-apps
[]
(service/log-runtime ["obtaining app listing"] (get-app-listing)))
(defn count-apps
[]
(service/log-runtime ["obtaining app count"] (count (list-apps))))
(defn list-systems
[]
(service/log-runtime
["obtaining system list"]
(-> (client/get (agave-url "apps-v1" "systems" "list"))
(:body)
(service/decode-json)
(:result))))