diff --git a/lib/fog/storm_on_demand/compute.rb b/lib/fog/storm_on_demand/compute.rb index 37929b47c..b07a6d55d 100644 --- a/lib/fog/storm_on_demand/compute.rb +++ b/lib/fog/storm_on_demand/compute.rb @@ -29,7 +29,9 @@ module Fog model :ruleset collection :rulesets model :pool - model :pools + collection :pools + model :zone + collection :zones model :stat collection :stats model :template @@ -109,6 +111,10 @@ module Fog request :get_assignments request :update_pool + request :get_zone + request :list_zones + request :set_default_zone + class Mock def self.data diff --git a/lib/fog/storm_on_demand/models/compute/zone.rb b/lib/fog/storm_on_demand/models/compute/zone.rb new file mode 100644 index 000000000..6314133e3 --- /dev/null +++ b/lib/fog/storm_on_demand/models/compute/zone.rb @@ -0,0 +1,27 @@ +require "fog/core/model" + +module Fog + module Compute + class StormOnDemand + + class Zone < Fog::Model + identity :id + attribute :is_default + attribute :name + attribute :region + attribute :status + attribute :valid_source_hvs + + def initialize(attributes={}) + super + end + + def set_default + requires :identity + service.set_default_zone(:id => identity) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/models/compute/zones.rb b/lib/fog/storm_on_demand/models/compute/zones.rb new file mode 100644 index 000000000..3eecffad8 --- /dev/null +++ b/lib/fog/storm_on_demand/models/compute/zones.rb @@ -0,0 +1,24 @@ +require "fog/core/collection" +require "fog/storm_on_demand/models/compute/zone" + +module Fog + module Compute + class StormOnDemand + + class Zones < Fog::Collection + model Fog::Compute::StormOnDemand::Zone + + def get(zone_id) + z = service.get_zone(:id => zone_id).body + new(z) + end + + def all(options={}) + data = service.list_zones(options).body + load(data) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/get_zone.rb b/lib/fog/storm_on_demand/requests/compute/get_zone.rb new file mode 100644 index 000000000..d4cd965b3 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/get_zone.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def get_zone(options={}) + request( + :path => '/Network/Zone/details', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/list_zones.rb b/lib/fog/storm_on_demand/requests/compute/list_zones.rb new file mode 100644 index 000000000..f1297b472 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/list_zones.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def list_zones(options={}) + request( + :path => '/Network/Zone/list', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/set_default_zone.rb b/lib/fog/storm_on_demand/requests/compute/set_default_zone.rb new file mode 100644 index 000000000..0ee299f6a --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/set_default_zone.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def set_default_zone(options={}) + request( + :path => '/Network/Zone/setDefault', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end