updated clojure option map for compute2

This commit is contained in:
Adrian Cole 2012-01-15 15:30:34 -08:00
parent 2dfdbb4b56
commit 181f1de4fd
1 changed files with 59 additions and 24 deletions

View File

@ -325,10 +325,12 @@ Here's an example of creating and running a small linux node in the group webser
kw-memfn-0arg [:smallest :fastest :biggest :any]) kw-memfn-0arg [:smallest :fastest :biggest :any])
(make-option-map (make-option-map
kw-memfn-1arg kw-memfn-1arg
[:os-family :location-id :architecture :image-id :hardware-id [:from-hardware :from-image :from-template
:os-name-matches :os-version-matches :os-description-matches :os-family :location-id :image-id :hardware-id
:os-64-bit :image-version-matches :image-name-matches :os-name-matches :os-description-matches :os-version-matches
:image-description-matches :min-cores :min-ram]))) :os-arch-matches :os-64-bit :image-name-matches
:image-version-matches :image-description-matches :image-matches
:min-cores :min-ram])))
(def (def
^{:doc "TemplateOptions functions" :private true} ^{:doc "TemplateOptions functions" :private true}
@ -336,22 +338,55 @@ Here's an example of creating and running a small linux node in the group webser
(merge (merge
(make-option-map (make-option-map
kw-memfn-0arg kw-memfn-0arg
[:destroy-on-error :enable-monitoring :no-placement-group :no-key-pair [;; ec2 trmk-ecloud trmk-vcloudexpress
:with-details]) :no-key-pair
;; aws-ec2
:enable-monitoring :no-placement-group])
(make-option-map (make-option-map
kw-memfn-1arg kw-memfn-1arg
[:run-script :install-private-key :authorize-public-key [;; RunScriptOptions
:override-credentials-with :override-login-user-with ;; deprecated
:override-credentials-with
:override-login-credentials
;; deprecated
:override-login-user-with
:override-login-user
;; deprecated
:override-login-credential-with :override-login-credential-with
;; aws ec2 options :override-login-password :override-login-privateKey
:spot-price :spot-options :placement-group :subnet-id :override-authenticate-sudo
:block-device-mappings :unmapDeviceNamed :security-groups
:key-pair :user-data]) :name-task :run-as-root :wrap-in-init-script :block-on-complete
(make-option-map kw-memfn-varargs [:inbound-ports]) :block-on-port
;; TemplateOptions
:run-script :install-private-key :authorize-public-key :tags
;; cloudstack
:security-group-id :network-id :network-ids :setup-static-nat
:ip-on-default-network :ips-to-networks
;; ec2
:security-groups :user-data :block-device-mappings
:unmap-device-named
;; cloudstack ec2
:key-pair
;; aws-ec2
:placement-group :subnet-id :spot-price :spot-options
;; cloudstack aws-ec2
:security-group-ids
;; softlayer
:domain-name
;; trmk-ecloud trmk-vcloudexpress
:ssh-key-fingerprint
;; vcloud
:description :customization-script :ip-address-allocation-mode])
(make-option-map
kw-memfn-varargs
[;; from TemplateOptions
:inbound-ports])
(make-option-map (make-option-map
kw-memfn-2arg kw-memfn-2arg
[:block-on-port [;; from TemplateOptions
;; aws ec2 options :block-on-port
;; ec2 options
:map-ephemeral-device-to-device-name]) :map-ephemeral-device-to-device-name])
{:map-ebs-snapshot-to-device-name {:map-ebs-snapshot-to-device-name
(kw-memfn-apply :map-ebs-snapshot-to-device-name (kw-memfn-apply :map-ebs-snapshot-to-device-name
@ -384,17 +419,17 @@ Here's an example of creating and running a small linux node in the group webser
The :os-family key expects a keyword version of OsFamily, The :os-family key expects a keyword version of OsFamily,
eg. :os-family :ubuntu. eg. :os-family :ubuntu.
The :smallest, :fastest, :biggest, :any, and :destroy-on-error keys expect a The :smallest, :fastest, :biggest, and :any keys expect a
boolean value. boolean value.
Options correspond to TemplateBuilder methods." Options correspond to TemplateBuilder methods."
[#^ComputeService compute [#^ComputeService compute
{:keys [os-family location-id architecture image-id hardware-id {:keys [from-hardware from-image from-template
os-name-matches os-version-matches os-description-matches os-family location-id image-id hardware-id
os-64-bit image-version-matches image-name-matches os-name-matches os-description-matches os-version-matches
image-description-matches min-cores min-ram os-arch-matches os-64-bit mage-name-matches
run-script install-private-key authorize-public-key image-version-matches image-description-matches image-matches
inbound-ports smallest fastest biggest any destroy-on-error] min-cores min-ram smallest fastest biggest any]
:as options}] :as options}]
(let [builder (.. compute (templateBuilder))] (let [builder (.. compute (templateBuilder))]
(doseq [[option value] options] (doseq [[option value] options]