Sha256: df158076a8dd60357dbd76dd46ede5e6e6a6a3610b6069bf4aa196d47cfd3421

Contents?: true

Size: 1.17 KB

Versions: 92

Compression:

Stored size: 1.17 KB

Contents

module Bosh::Stemcell
  module Infrastructure
    def self.for(name)
      case name
        when 'openstack'
          OpenStack.new
        when 'aws'
          Aws.new
        when 'vsphere'
          Vsphere.new
        else
          raise ArgumentError.new("invalid infrastructure: #{name}")
      end
    end

    class Base
      attr_reader :name, :hypervisor, :default_disk_size

      def initialize(options = {})
        @name = options.fetch(:name)
        @supports_light_stemcell = options.fetch(:supports_light_stemcell, false)
        @hypervisor = options.fetch(:hypervisor)
        @default_disk_size = options.fetch(:default_disk_size)
      end

      def light?
        @supports_light_stemcell
      end
    end

    class OpenStack < Base
      def initialize
        super(name: 'openstack', hypervisor: 'kvm', default_disk_size: 10240)
      end
    end

    class Vsphere < Base
      def initialize
        super(name: 'vsphere', hypervisor: 'esxi', default_disk_size: 3072)
      end
    end

    class Aws < Base
      def initialize
        super(name: 'aws', hypervisor: 'xen', supports_light_stemcell: true, default_disk_size: 2048)
      end
    end
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
bosh-stemcell-1.5.0.pre.1436 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1435 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1391 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1390 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1381 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1376 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1374 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1365 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1364 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1345 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1341 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1340 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1339 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1337 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1336 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1335 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1333 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1332 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1330 lib/bosh/stemcell/infrastructure.rb
bosh-stemcell-1.5.0.pre.1328 lib/bosh/stemcell/infrastructure.rb