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 Compute
|
||||
class Joyent < Fog::Service
|
||||
|
||||
requires :joyent_username
|
||||
|
||||
recognizes :joyent_password
|
||||
|
@ -37,6 +38,8 @@ module Fog
|
|||
model :image
|
||||
request :list_datasets
|
||||
request :get_dataset
|
||||
request :list_images
|
||||
request :get_image
|
||||
|
||||
# Flavors
|
||||
collection :flavors
|
||||
|
@ -103,6 +106,9 @@ module Fog
|
|||
end # Mock
|
||||
|
||||
class Real
|
||||
attr_accessor :joyent_version
|
||||
attr_accessor :joyent_url
|
||||
|
||||
def initialize(options = {})
|
||||
|
||||
@connection_options = options[:connection_options] || {}
|
||||
|
|
|
@ -3,13 +3,17 @@ module Fog
|
|||
class Joyent
|
||||
class Flavor < Fog::Model
|
||||
|
||||
identity :name
|
||||
identity :id
|
||||
|
||||
attribute :name
|
||||
attribute :memory
|
||||
attribute :swap
|
||||
attribute :disk
|
||||
attribute :default
|
||||
attribute :vcpus
|
||||
attribute :default, :type => :boolean
|
||||
attribute :description
|
||||
attribute :version
|
||||
attribute :group
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,10 +7,20 @@ module Fog
|
|||
|
||||
attribute :name
|
||||
attribute :os
|
||||
attribute :type
|
||||
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 :default
|
||||
attribute :default, :type => :boolean
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,11 +10,20 @@ module Fog
|
|||
model Fog::Compute::Joyent::Image
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ module Fog
|
|||
attribute :disk
|
||||
attribute :metadata
|
||||
attribute :tags
|
||||
attribute :package
|
||||
attribute :image
|
||||
attribute :primary_ip, :aliases => 'primaryIp'
|
||||
|
||||
attribute :created, :type => :time
|
||||
attribute :updated, :type => :time
|
||||
|
|
Loading…
Reference in a new issue