2010-03-16 18:46:21 -04:00
|
|
|
require 'fog/collection'
|
|
|
|
require 'fog/aws/models/ec2/flavor'
|
|
|
|
|
2010-01-10 16:22:18 -05:00
|
|
|
module Fog
|
|
|
|
module AWS
|
2010-03-16 18:46:21 -04:00
|
|
|
module EC2
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
def flavors
|
|
|
|
Fog::AWS::EC2::Flavors.new(:connection => self)
|
|
|
|
end
|
|
|
|
end
|
2010-01-10 16:22:18 -05:00
|
|
|
|
2010-03-16 18:46:21 -04:00
|
|
|
class Real
|
|
|
|
def flavors
|
|
|
|
Fog::AWS::EC2::Flavors.new(:connection => self)
|
|
|
|
end
|
2010-01-10 16:22:18 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::AWS::EC2::Flavor
|
|
|
|
|
|
|
|
def all
|
|
|
|
data = [
|
|
|
|
{ :bits => 32, :cores => 1, :disk => 160, :id => 'm1.small', :name => 'Small Instance', :ram => 1740.8},
|
|
|
|
{ :bits => 64, :cores => 4, :disk => 850, :id => 'm1.large', :name => 'Large Instance', :ram => 7680},
|
|
|
|
{ :bits => 64, :cores => 8, :disk => 1690, :id => 'm1.xlarge', :name => 'Extra Large Instance', :ram => 15360},
|
|
|
|
|
|
|
|
{ :bits => 32, :cores => 5, :disk => 350, :id => 'c1.medium', :name => 'High-CPU Medium', :ram => 1740.8},
|
|
|
|
{ :bits => 64, :cores => 20, :disk => 1690, :id => 'c1.xlarge', :name => 'High-CPU Extra Large', :ram => 7168},
|
|
|
|
|
|
|
|
{ :bits => 64, :cores => 13, :disk => 850, :id => 'm2.2xlarge', :name => 'High Memory Double Extra Large', :ram => 35020.8},
|
|
|
|
{ :bits => 64, :cores => 26, :disk => 1690, :id => 'm2.4xlarge', :name => 'High Memory Quadruple Extra Large', :ram => 70041.6},
|
|
|
|
]
|
2010-03-06 23:02:10 -05:00
|
|
|
load(data)
|
2010-01-10 16:22:18 -05:00
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(flavor_id)
|
2010-04-28 14:00:01 -04:00
|
|
|
all.detect {|flavor| flavor.id == flavor_id}
|
2010-01-10 16:22:18 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|