 
 (def cli-options
   [["-t" "--template TEMPLATE" "Prints out registered template by name."]
-   ["-l" "--list" "List available templates."]
-   ["-r" "--resource RESOURCE" "Prints out resource document(s) by name."
+   ["-l" "--list" "Lists available templates."]
+   ["-p" "--persisted" "Lists resources persisted in DB."]
+   ["-r" "--resource RESOURCE" "Prints out peristed resource document(s) by name."
     :id :resources
     :default #{}
     :assoc-fn cli-parse-sets]

    [com.sixsq.slipstream.ssclj.resources.configuration-slipstream :as cfg-s]
    [com.sixsq.slipstream.ssclj.resources.configuration-template :as cfgt]
    [com.sixsq.slipstream.ssclj.resources.connector :as conn]
    [com.sixsq.slipstream.ssclj.resources.connector-template :as cont])
  (:gen-class))

(def connector-resource conn/resource-url)

        (do
          (println "WARNING: Resource" rname "not found."))))))

(defn get-connector-resources
  []
  (let [cs (-> (con/query-impl (sci/connector-as-request configuration-resource))
               :body
               :connectors)]
    (map #(:id %) cs)))

(defn get-configuration-resources
  []
  (let [cs (-> (cfg/query-impl (sci/configuration-as-request connector-resource))
               :body
               :configurations)]
    (map #(:id %) cs)))

(defn get-persisted-resources
  [name]
  (cond
    (= name configuration-resource) (get-configuration-resources)
    (= name connector-resource) (get-connector-resources)
    :else (do (println "WARNING: Don't know how to get resources for" name))))

(defn list-persisted-resources
  [name]
  (doseq [r (get-persisted-resources name)]
    (println r)))

(defn list-resources
  []
  (init-db-client)
  (println "List of persisted resources.")
  (doseq [r resource-types]
    (println (format "- resources for '%s'" r))
    (list-persisted-resources r)))

;;
;; Command line options processing.
;;
