mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[stormondemand|compute] Add Network Zone APIs
This commit is contained in:
parent
257d86d872
commit
39a4561928
6 changed files with 106 additions and 1 deletions
|
@ -29,7 +29,9 @@ module Fog
|
||||||
model :ruleset
|
model :ruleset
|
||||||
collection :rulesets
|
collection :rulesets
|
||||||
model :pool
|
model :pool
|
||||||
model :pools
|
collection :pools
|
||||||
|
model :zone
|
||||||
|
collection :zones
|
||||||
model :stat
|
model :stat
|
||||||
collection :stats
|
collection :stats
|
||||||
model :template
|
model :template
|
||||||
|
@ -109,6 +111,10 @@ module Fog
|
||||||
request :get_assignments
|
request :get_assignments
|
||||||
request :update_pool
|
request :update_pool
|
||||||
|
|
||||||
|
request :get_zone
|
||||||
|
request :list_zones
|
||||||
|
request :set_default_zone
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def self.data
|
def self.data
|
||||||
|
|
27
lib/fog/storm_on_demand/models/compute/zone.rb
Normal file
27
lib/fog/storm_on_demand/models/compute/zone.rb
Normal file
|
@ -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
|
24
lib/fog/storm_on_demand/models/compute/zones.rb
Normal file
24
lib/fog/storm_on_demand/models/compute/zones.rb
Normal file
|
@ -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
|
16
lib/fog/storm_on_demand/requests/compute/get_zone.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/get_zone.rb
Normal file
|
@ -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
|
16
lib/fog/storm_on_demand/requests/compute/list_zones.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/list_zones.rb
Normal file
|
@ -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
|
16
lib/fog/storm_on_demand/requests/compute/set_default_zone.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/set_default_zone.rb
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue