 (defn- image-list-url [region application-name]
   (str asgard-url "/" region "/image/list/" application-name ".json"))
 
+(defn- security-groups-list-url [region]
+  (str asgard-url "/" region "/security/list.json"))
+
 (defn application
   "Retrieves information about an application from Asgard"
   [region application-name]

                           "revision" ""
                           "stack" ""
                           "region" region}
        required-params (amend-params (select-keys params required-keys))]
    (merge additional-params required-params)))

(defn- application-params [application-name]

(defn- is-security-group-name? [security-group]
  (re-find #"^sg-" security-group))

(defn- get-security-group-id [security-group region]
  (let [security-groups (:securityGroups (security-groups region))]
    (if-let [found-group (first (filter (fn [sg] (= security-group (:groupName sg))) security-groups))]
      (:groupId found-group)
      (throw (Throwable. (str "Unknown security group with name " security-group))))))

(defn- replace-security-group-names [region params]
  (if-let [security-group-names (get params "selectedSecurityGroups")]
    (map (fn [sg] (if (is-security-group-name? sg)
                   (get-security-group-id sg region)
                   sg))
         security-group-names)
    params))

(defn- amend-params [region params]
  (replace-security-group-names
   region
   (replace-load-balancer-param params)))

(defn- create-manual-deploy-params [params region application-name]
  (let [additional-params {"appName" application-name
