37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/fog/aws/requests/compute/register_image.rb', line 37
def register_image(name, description, location, block_devices=[], options={})
common_options = {
'Action' => 'RegisterImage',
'Name' => name,
'Description' => description,
:parser => Fog::Parsers::Compute::AWS::RegisterImage.new
}
if(location =~ /^\/dev\/sd[a-p]\d{0,2}$/)
common_options['RootDeviceName'] = location
else
common_options['ImageLocation'] = location
end
block_devices.each_with_index do |bd, index|
index += 1
["DeviceName","VirtualName"].each do |n|
common_options["BlockDeviceMapping.#{index}.#{n}"] = bd[n] if bd[n]
end
["SnapshotId","VolumeSize","NoDevice","DeleteOnTermination"].each do |n|
common_options["BlockDeviceMapping.#{index}.Ebs.#{n}"] = bd[n] if bd[n]
end
end
request(common_options.merge!(options))
end
|