def _request(body, headers, idempotent, parser, method, path, expects)
response = @connection.request({
:body => body,
:expects => expects,
:idempotent => idempotent,
:headers => headers,
:method => method,
:parser => parser,
:path => path
})
unless response.body.empty?
response.body = Fog::JSON.decode(response.body)
end
response
rescue Excon::Errors::HTTPStatusError => error
match = Fog::AWS::Errors.match_error(error)
raise if match.empty?
if match[:code] == "IncorrectFileSystemLifeCycleState"
raise Fog::AWS::EFS::IncorrectFileSystemLifeCycleState.slurp(error, match[:message])
elsif match[:code] == 'FileSystemInUse'
raise Fog::AWS::EFS::FileSystemInUse.slurp(error, match[:message])
elsif match[:code].match(/(FileSystem|MountTarget)NotFound/)
raise Fog::AWS::EFS::NotFound.slurp(error, match[:message])
end
raise case match[:message]
when /invalid ((file system)|(mount target)|(security group)) id/i
Fog::AWS::EFS::NotFound.slurp(error, match[:message])
when /invalid subnet id/i
Fog::AWS::EFS::InvalidSubnet.slurp(error, match[:message])
else
Fog::AWS::EFS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
end
end