mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
update compute with some attributes from api 7.0
This commit is contained in:
parent
709d27e6b2
commit
5389f7a21b
5 changed files with 38 additions and 6 deletions
|
@ -6,6 +6,7 @@ require 'net/ssh'
|
||||||
module Fog
|
module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class Joyent < Fog::Service
|
class Joyent < Fog::Service
|
||||||
|
|
||||||
requires :joyent_username
|
requires :joyent_username
|
||||||
|
|
||||||
recognizes :joyent_password
|
recognizes :joyent_password
|
||||||
|
@ -37,6 +38,8 @@ module Fog
|
||||||
model :image
|
model :image
|
||||||
request :list_datasets
|
request :list_datasets
|
||||||
request :get_dataset
|
request :get_dataset
|
||||||
|
request :list_images
|
||||||
|
request :get_image
|
||||||
|
|
||||||
# Flavors
|
# Flavors
|
||||||
collection :flavors
|
collection :flavors
|
||||||
|
@ -103,6 +106,9 @@ module Fog
|
||||||
end # Mock
|
end # Mock
|
||||||
|
|
||||||
class Real
|
class Real
|
||||||
|
attr_accessor :joyent_version
|
||||||
|
attr_accessor :joyent_url
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
|
|
||||||
@connection_options = options[:connection_options] || {}
|
@connection_options = options[:connection_options] || {}
|
||||||
|
|
|
@ -3,13 +3,17 @@ module Fog
|
||||||
class Joyent
|
class Joyent
|
||||||
class Flavor < Fog::Model
|
class Flavor < Fog::Model
|
||||||
|
|
||||||
identity :name
|
identity :id
|
||||||
|
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :memory
|
attribute :memory
|
||||||
attribute :swap
|
attribute :swap
|
||||||
attribute :disk
|
attribute :disk
|
||||||
attribute :default
|
attribute :vcpus
|
||||||
|
attribute :default, :type => :boolean
|
||||||
|
attribute :description
|
||||||
|
attribute :version
|
||||||
|
attribute :group
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,10 +7,20 @@ module Fog
|
||||||
|
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :os
|
attribute :os
|
||||||
attribute :type
|
|
||||||
attribute :version
|
attribute :version
|
||||||
|
attribute :type
|
||||||
|
attribute :description
|
||||||
|
attribute :requirements
|
||||||
|
attribute :homepage
|
||||||
|
attribute :published_at, :type => :time
|
||||||
|
attribute :public, :type => :boolean
|
||||||
|
attribute :owner
|
||||||
|
attribute :state
|
||||||
|
attribute :tags
|
||||||
|
attribute :eula
|
||||||
|
attribute :acl
|
||||||
attribute :created, :type => :time
|
attribute :created, :type => :time
|
||||||
attribute :default
|
attribute :default, :type => :boolean
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,11 +10,20 @@ module Fog
|
||||||
model Fog::Compute::Joyent::Image
|
model Fog::Compute::Joyent::Image
|
||||||
|
|
||||||
def all
|
def all
|
||||||
load(service.list_datasets().body)
|
# the API call for getting images changed from 6.5 to 7.0. Joyent seems to still support the old url, but no idea for how long
|
||||||
|
if service.joyent_version.gsub(/[^0-9.]/,'').to_f < 7.0
|
||||||
|
load(service.list_datasets.body)
|
||||||
|
else
|
||||||
|
load(service.list_images.body)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id)
|
def get(id)
|
||||||
data = service.get_dataset(id).body
|
data = if service.joyent_version.gsub(/[^0-9.]/,'').to_f < 7.0
|
||||||
|
service.get_dataset(id).body
|
||||||
|
else
|
||||||
|
service.get_image(id).body
|
||||||
|
end
|
||||||
new(data)
|
new(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ module Fog
|
||||||
attribute :disk
|
attribute :disk
|
||||||
attribute :metadata
|
attribute :metadata
|
||||||
attribute :tags
|
attribute :tags
|
||||||
|
attribute :package
|
||||||
|
attribute :image
|
||||||
|
attribute :primary_ip, :aliases => 'primaryIp'
|
||||||
|
|
||||||
attribute :created, :type => :time
|
attribute :created, :type => :time
|
||||||
attribute :updated, :type => :time
|
attribute :updated, :type => :time
|
||||||
|
|
Loading…
Reference in a new issue