2010-10-04 17:02:08 -04:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 21:37:00 -04:00
|
|
|
require 'fog/aws/models/compute/flavor'
|
2010-03-16 18:46:21 -04:00
|
|
|
|
2010-01-10 16:22:18 -05:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class AWS
|
2010-01-10 16:22:18 -05:00
|
|
|
|
2011-03-07 14:54:38 -05:00
|
|
|
FLAVORS = [
|
|
|
|
{ :bits => 0, :cores => 2, :disk => 0, :id => 't1.micro', :name => 'Micro Instance', :ram => 613},
|
|
|
|
|
|
|
|
{ :bits => 32, :cores => 1, :disk => 160, :id => 'm1.small', :name => 'Small Instance', :ram => 1740.8},
|
2012-08-23 16:39:04 -04:00
|
|
|
{ :bits => 32, :cores => 2, :disk => 400, :id => 'm1.medium', :name => 'Medium Instance', :ram => 3750},
|
2011-03-07 14:54:38 -05:00
|
|
|
{ :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 => 6.5, :disk => 420, :id => 'm2.xlarge', :name => 'High-Memory Extra Large', :ram => 17510.4},
|
|
|
|
{ :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},
|
|
|
|
|
2012-08-02 14:12:38 -04:00
|
|
|
{ :bits => 64, :cores => 35, :disk => 2048, :id => "hi1.4xlarge", :name => "High I/O Quadruple Extra Large Instance", :ram => 61952},
|
|
|
|
|
2011-03-07 14:54:38 -05:00
|
|
|
{ :bits => 64, :cores => 33.5, :disk => 1690, :id => 'cc1.4xlarge', :name => 'Cluster Compute Quadruple Extra Large', :ram => 23552},
|
2012-04-12 17:34:00 -04:00
|
|
|
{ :bits => 64, :cores => 88, :disk => 3370, :id => 'cc2.8xlarge', :name => 'Cluster Compute Eight Extra Large', :ram => 61952},
|
2011-03-07 14:54:38 -05:00
|
|
|
{ :bits => 64, :cores => 33.5, :disk => 1690, :id => 'cg1.4xlarge', :name => 'Cluster GPU Quadruple Extra Large', :ram => 22528}
|
|
|
|
]
|
|
|
|
|
2010-01-10 16:22:18 -05:00
|
|
|
class Flavors < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::AWS::Flavor
|
2010-01-10 16:22:18 -05:00
|
|
|
|
2010-11-29 18:44:44 -05:00
|
|
|
# Returns an array of all flavors that have been created
|
2010-11-24 11:44:30 -05:00
|
|
|
#
|
2010-11-29 18:44:44 -05:00
|
|
|
# AWS.flavors.all
|
2010-11-24 11:44:30 -05:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
#
|
|
|
|
# Returns an array of all available instance sizes
|
|
|
|
#
|
|
|
|
#>> AWS.flavors.all
|
|
|
|
# <Fog::AWS::Compute::Flavors
|
|
|
|
# [
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="t1.micro",
|
|
|
|
# bits=0,
|
|
|
|
# cores=2,
|
|
|
|
# disk=0,
|
|
|
|
# name="Micro Instance",
|
|
|
|
# ram=613
|
|
|
|
# >,
|
2010-11-29 19:10:20 -05:00
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="m1.small",
|
|
|
|
# bits=32,
|
|
|
|
# cores=1,
|
|
|
|
# disk=160,
|
|
|
|
# name="Small Instance",
|
|
|
|
# ram=1740.8
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
2012-08-23 16:39:04 -04:00
|
|
|
# id="m1.medium",
|
|
|
|
# bits=32,
|
|
|
|
# cores=2,
|
|
|
|
# disk=400,
|
|
|
|
# name="Medium Instance",
|
|
|
|
# ram=3750
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
2010-11-29 19:10:20 -05:00
|
|
|
# id="m1.large",
|
|
|
|
# bits=64,
|
|
|
|
# cores=4,
|
|
|
|
# disk=850,
|
|
|
|
# name="Large Instance",
|
|
|
|
# ram=7680
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="m1.xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=8,
|
|
|
|
# disk=1690,
|
|
|
|
# name="Extra Large Instance",
|
|
|
|
# ram=15360
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="c1.medium",
|
|
|
|
# bits=32,
|
|
|
|
# cores=5,
|
|
|
|
# disk=350,
|
|
|
|
# name="High-CPU Medium",
|
|
|
|
# ram=1740.8
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="c1.xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=20,
|
|
|
|
# disk=1690,
|
|
|
|
# name="High-CPU Extra Large",
|
|
|
|
# ram=7168
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="m2.xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=6.5,
|
|
|
|
# disk=420,
|
|
|
|
# name="High-Memory Extra Large",
|
|
|
|
# ram=17510.4
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="m2.2xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=13,
|
|
|
|
# disk=850,
|
|
|
|
# name="High Memory Double Extra Large",
|
|
|
|
# ram=35020.8
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="m2.4xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=26,
|
|
|
|
# disk=1690,
|
|
|
|
# name="High Memory Quadruple Extra Large",
|
|
|
|
# ram=70041.6
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="cc1.4xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=33.5,
|
|
|
|
# disk=1690,
|
|
|
|
# name="Cluster Compute Quadruple Extra Large",
|
|
|
|
# ram=23552
|
|
|
|
# >,
|
2010-11-24 11:44:30 -05:00
|
|
|
# <Fog::AWS::Compute::Flavor
|
2012-04-12 17:34:00 -04:00
|
|
|
# id="cc2.8xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=88,
|
|
|
|
# disk=3370,
|
|
|
|
# name="Cluster Compute Eight Extra Large",
|
|
|
|
# ram=61952
|
|
|
|
# >,
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
2010-11-24 11:44:30 -05:00
|
|
|
# id="cg1.4xlarge",
|
|
|
|
# bits=64,
|
|
|
|
# cores=33.5,
|
|
|
|
# disk=1690,
|
|
|
|
# name="Cluster GPU Quadruple Extra Large",
|
|
|
|
# ram=22528
|
|
|
|
# >
|
|
|
|
# ]
|
|
|
|
# >
|
|
|
|
#
|
|
|
|
|
2010-01-10 16:22:18 -05:00
|
|
|
def all
|
2011-06-16 19:28:54 -04:00
|
|
|
load(Fog::Compute::AWS::FLAVORS)
|
2010-01-10 16:22:18 -05:00
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2012-03-07 13:52:07 -05:00
|
|
|
# Used to retrieve a flavor
|
2010-11-24 11:44:30 -05:00
|
|
|
# flavor_id is required to get the associated flavor information.
|
|
|
|
# flavors available currently:
|
2012-04-12 17:34:00 -04:00
|
|
|
# 't1.micro', 'm1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'cg1.4xlarge'
|
2010-11-24 11:44:30 -05:00
|
|
|
#
|
|
|
|
# You can run the following command to get the details:
|
|
|
|
# AWS.flavors.get("t1.micro")
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
#
|
|
|
|
#>> AWS.flavors.get("t1.micro")
|
|
|
|
# <Fog::AWS::Compute::Flavor
|
|
|
|
# id="t1.micro",
|
|
|
|
# bits=0,
|
|
|
|
# cores=2,
|
|
|
|
# disk=0,
|
|
|
|
# name="Micro Instance",
|
|
|
|
# ram=613
|
|
|
|
#>
|
|
|
|
#
|
|
|
|
|
2010-01-10 16:22:18 -05:00
|
|
|
def get(flavor_id)
|
2010-10-01 14:14:26 -04:00
|
|
|
self.class.new(:connection => connection).all.detect {|flavor| flavor.id == flavor_id}
|
2010-01-10 16:22:18 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|