mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ibm] Add a InstanceType model, returned as part of Images
This commit is contained in:
parent
18f92a3254
commit
01acfc6c0c
3 changed files with 35 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
require 'fog/core/model'
|
require 'fog/core/model'
|
||||||
|
require 'fog/ibm/models/compute/instance-types'
|
||||||
|
|
||||||
module Fog
|
module Fog
|
||||||
module Compute
|
module Compute
|
||||||
|
@ -21,6 +22,11 @@ module Fog
|
||||||
|
|
||||||
attribute :volume_id
|
attribute :volume_id
|
||||||
|
|
||||||
|
def initialize(new_attributes = {})
|
||||||
|
super(new_attributes)
|
||||||
|
attributes[:supported_instance_types] = Fog::Compute::IBM::InstanceTypes.new.load(attributes[:supported_instance_types]) if attributes[:supported_instance_types]
|
||||||
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
requires :id, :volume_id
|
requires :id, :volume_id
|
||||||
data = connection.create_image(id, volume_id)
|
data = connection.create_image(id, volume_id)
|
||||||
|
|
14
lib/fog/ibm/models/compute/instance-type.rb
Normal file
14
lib/fog/ibm/models/compute/instance-type.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
require 'fog/core/model'
|
||||||
|
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class IBM
|
||||||
|
class InstanceType < Fog::Model
|
||||||
|
identity :id
|
||||||
|
attribute :detail
|
||||||
|
attribute :label
|
||||||
|
attribute :price
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
15
lib/fog/ibm/models/compute/instance-types.rb
Normal file
15
lib/fog/ibm/models/compute/instance-types.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
require 'fog/core/collection'
|
||||||
|
require 'fog/ibm/models/compute/instance-type'
|
||||||
|
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class IBM
|
||||||
|
|
||||||
|
class InstanceTypes < Fog::Collection
|
||||||
|
|
||||||
|
model Fog::Compute::IBM::InstanceType
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue