mirror of https://github.com/apache/jclouds.git
added properties to compute-service
This commit is contained in:
parent
190c768d02
commit
6fa99d92a7
|
@ -38,6 +38,7 @@ See http://code.google.com/p/jclouds for details."
|
||||||
[clojure.contrib.str-utils2 :only [capitalize lower-case map-str]]
|
[clojure.contrib.str-utils2 :only [capitalize lower-case map-str]]
|
||||||
[clojure.contrib.java-utils :only [wall-hack-field]])
|
[clojure.contrib.java-utils :only [wall-hack-field]])
|
||||||
(:import java.io.File
|
(:import java.io.File
|
||||||
|
java.util.Properties
|
||||||
[org.jclouds.domain Location]
|
[org.jclouds.domain Location]
|
||||||
[org.jclouds.compute
|
[org.jclouds.compute
|
||||||
ComputeService ComputeServiceContext ComputeServiceContextFactory]
|
ComputeService ComputeServiceContext ComputeServiceContextFactory]
|
||||||
|
@ -50,11 +51,16 @@ See http://code.google.com/p/jclouds for details."
|
||||||
(defn compute-service
|
(defn compute-service
|
||||||
"Create a logged in context."
|
"Create a logged in context."
|
||||||
([#^String service #^String account #^String key & options]
|
([#^String service #^String account #^String key & options]
|
||||||
(.. (ComputeServiceContextFactory.)
|
(let [module-keys (set (keys module-lookup))
|
||||||
(createContext
|
ext-modules (filter #(module-keys %) options)
|
||||||
service account key
|
opts (apply hash-map (filter #(not (module-keys %)) options))]
|
||||||
(apply modules (filter #(not (#{:sync :async} %)) options)))
|
(.. (ComputeServiceContextFactory.)
|
||||||
(getComputeService))))
|
(createContext
|
||||||
|
service account key
|
||||||
|
(apply modules (concat ext-modules (opts :extensions)))
|
||||||
|
(reduce #(do (.put %1 (name (first %2)) (second %2)) %1)
|
||||||
|
(Properties.) (dissoc opts :extensions)))
|
||||||
|
(getComputeService)))))
|
||||||
|
|
||||||
(defn compute-context
|
(defn compute-context
|
||||||
"Returns a compute context from a compute service."
|
"Returns a compute context from a compute service."
|
||||||
|
|
Loading…
Reference in New Issue