module AWS::EC2::BlockDeviceMappings
def translate_block_device_mappings(mapping)
def translate_block_device_mappings(mapping) raise ArgumentError.new("block_device_mappings must be a hash") unless mapping.kind_of?(Hash) mapping.map do |device, dest| raise ArgumentError.new("keys of block_device_mappings must be strings") unless device.kind_of?(String) entry = { :device_name => device } case dest when :no_device # for some reason EC2 rejects boolean values for this seemingly boolean option entry[:no_device] = "" when Symbol raise ArgumentError.new("unrecognized block device mapping: #{dest}") when String entry[:virtual_name] = dest when Hash if snapshot = dest.delete(:snapshot) dest[:snapshot_id] = snapshot.id end entry[:ebs] = dest else raise ArgumentError.new("values of block_device_mappings must "+ "be strings, symbols, or hashes") end entry end end