def modify_network_interface_attribute(network_interface_id, attribute, value)
response = Excon::Response.new
if self.data[:network_interfaces][network_interface_id]
nic = self.data[:network_interfaces][network_interface_id]
case attribute
when 'description'
nic['description'] = value.clone
when 'groupSet'
groups = {}
value.each do |group_id|
name = self.data[:security_groups].select { |k,v| v['groupId'] == group_id } .first.first
if name.nil?
raise Fog::Compute::AWS::Error.new("Unknown security group '#{group_id}' specified")
end
groups[group_id] = name
end
nic['groupSet'] = groups
when 'sourceDestCheck'
nic['sourceDestCheck'] = value
when 'attachment'
if nic['attachment'].nil? || value['attachmentId'] != nic['attachment']['attachmentId']
raise Fog::Compute::AWS::Error.new("Illegal attachment '#{value['attachmentId']}' specified")
end
nic['attachment']['deleteOnTermination'] = value['deleteOnTermination']
else
raise Fog::Compute::AWS::Error.new("Illegal attribute '#{attribute}' specified")
end
response.status = 200
response.body = {
'requestId' => Fog::AWS::Mock.request_id,
'return' => true
}
response
else
raise Fog::Compute::AWS::NotFound.new("The network interface '#{network_interface_id}' does not exist")
end
end