mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add Config attributes, and the "get" method for Configs to get detail of a specific config object
This commit is contained in:
parent
e3b5730768
commit
8015dec890
5 changed files with 43 additions and 9 deletions
|
@ -5,7 +5,8 @@ module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class StormOnDemand < Fog::Service
|
class StormOnDemand < Fog::Service
|
||||||
|
|
||||||
API_URL = 'https://api.stormondemand.com/v1'
|
API_URL = 'https://api.stormondemand.com'
|
||||||
|
API_VERSION = 'v1'
|
||||||
|
|
||||||
requires :storm_on_demand_username, :storm_on_demand_password
|
requires :storm_on_demand_username, :storm_on_demand_password
|
||||||
recognizes :storm_on_demand_auth_url
|
recognizes :storm_on_demand_auth_url
|
||||||
|
@ -38,6 +39,7 @@ module Fog
|
||||||
request :add_balancer_node
|
request :add_balancer_node
|
||||||
request :list_balancers
|
request :list_balancers
|
||||||
request :list_configs
|
request :list_configs
|
||||||
|
request :get_config_details
|
||||||
request :list_templates
|
request :list_templates
|
||||||
request :list_images
|
request :list_images
|
||||||
request :get_stats
|
request :get_stats
|
||||||
|
@ -109,7 +111,7 @@ module Fog
|
||||||
'Authorization' => 'Basic ' << Base64.encode64("#{@storm_on_demand_username}:#{@storm_on_demand_password}").chomp
|
'Authorization' => 'Basic ' << Base64.encode64("#{@storm_on_demand_username}:#{@storm_on_demand_password}").chomp
|
||||||
}.merge!(params[:headers] || {}),
|
}.merge!(params[:headers] || {}),
|
||||||
:host => @host,
|
:host => @host,
|
||||||
:path => "#{@path}/#{params[:path]}",
|
:path => "#{@path}/#{API_VERSION}#{params[:path]}",
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:method => :post
|
:method => :post
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -10,18 +10,30 @@ module Fog
|
||||||
attribute :active
|
attribute :active
|
||||||
attribute :available
|
attribute :available
|
||||||
attribute :category
|
attribute :category
|
||||||
|
attribute :cpu_cores
|
||||||
|
attribute :cpu_count
|
||||||
|
attribute :cpu_hyperthreading
|
||||||
|
attribute :cpu_model
|
||||||
|
attribute :cpu_speed
|
||||||
attribute :description
|
attribute :description
|
||||||
attribute :disk
|
attribute :disk
|
||||||
|
attribute :disk_count
|
||||||
|
attribute :disk_total
|
||||||
|
attribute :disk_type
|
||||||
attribute :featured
|
attribute :featured
|
||||||
attribute :memory
|
attribute :memory
|
||||||
|
attribute :raid_level
|
||||||
|
attribute :ram_available
|
||||||
|
attribute :ram_total
|
||||||
attribute :price
|
attribute :price
|
||||||
attribute :vcpu
|
attribute :vcpu
|
||||||
end
|
attribute :zone_availability
|
||||||
|
|
||||||
|
def initialize(attributes={})
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(attributes={})
|
|
||||||
super
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,11 +9,15 @@ module Fog
|
||||||
|
|
||||||
model Fog::Compute::StormOnDemand::Config
|
model Fog::Compute::StormOnDemand::Config
|
||||||
|
|
||||||
def all
|
def all(options={})
|
||||||
data = service.list_configs.body['items']
|
data = service.list_configs(options).body['items']
|
||||||
load(data)
|
load(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get(config_id)
|
||||||
|
data = service.get_config_details(:id => config_id).body
|
||||||
|
new(data)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def get_config_details(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Storm/Config/details',
|
||||||
|
:body => Fog::JSON.encode({ :params => options })
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -6,7 +6,7 @@ module Fog
|
||||||
def list_configs(options = {})
|
def list_configs(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/config/list",
|
:path => "/storm/config/list",
|
||||||
:body => Fog::JSON.encode(options)
|
:body => Fog::JSON.encode(:params => options)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue