Sha256: d7bc35e7d09e02aef90c77473eedb985b01c796a8c428e03d6fc2b1148c9c9ae

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

module Fog
  module OpenStack
    class Compute
      class Real
        def boot_from_snapshot(name, image_ref, flavor_ref, options = {})
          data = {
            'server' => {
              'flavorRef' => flavor_ref,
              'imageRef'  => image_ref,
              'name'      => name
            }
          }

          vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6',
                             'availability_zone', 'user_data', 'block_device_mapping',
                             'key_name', 'security_groups']
          vanilla_options.select { |o| options[o] }.each do |key|
            data['server'][key] = options[key]
          end

          if options['personality']
            data['server']['personality'] = []
            options['personality'].each do |file|
              data['server']['personality'] << {
                'contents' => Base64.encode64(file['contents']),
                'path'     => file['path']
              }
            end
          end

          request(
            :body    => Fog::JSON.encode(data),
            :expects => [200, 202],
            :method  => 'POST',
            :path    => '/os-volumes_boot'
          )
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
fog-openstack-1.1.3 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.1.2 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-fork-99 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.1.0 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.1.0.pre lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.11 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.10 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.9 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.8 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.7 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.6 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.5 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.4 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.3 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.2 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.1 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-1.0.0 lib/fog/openstack/compute/requests/boot_from_snapshot.rb
fog-openstack-0.3.1 lib/fog/openstack/compute/requests/boot_from_snapshot.rb