Is it ok for a country to spy on other countries - friend or foe - as it pleases?
I suppose you can say that it's okay for them to TRY. What's NOT okay is for a county to use technology to spy upon others, then bitch and moan when those others are found to be spying on them.
Point.

Is it a threat to democracy?
A tricky question. Is spying on Brazil a threat to democracy in the US? Probably not. In fact, spying on some countries (not necessarily Brazil) could be of benefit to democracy, not only in the US but in the rest of the world. BUT, spying on your own citizens is a threat to democracy, since a part of democratic freedoms is the freedom to remove incompetent or dangerous leaders through free elections. Spying on people in order to limit that freedom is a definite threat to democracy.
I meant a threat to 1) the countries spied on and 2) a threat to US itself, since it is also spying on its own citizens on a grand scale.

I see this a no less than US being Big Brother to itself and most of the world besides.


Is it time for the countries to make their own IT net?
I don't know about that. Half the politicians in THIS country don't seem capable of dealing with a postage stamp, much less the complexities of email.
However, it is possible, and what would happen if some countries did that? They would be able to control their own citizens better, and would fracture the net as it is. Unless the several nets would work in parallel.

Should the UN over guidelines for spying, and be equipped to see that they are followed?
The UN is a failed, ineffective, impotent organization, incapable of doing anything that any one member of the Security Council doesn't like. Any "guidelines" it might develop would be ignored whenever it suited those members to do so, and nothing could be done to stop it.
The UN is criticized a lot, and probably justified. But such as it is, it is the only organ to impose some sort of morality on what countries do to each others that we have.