A warning is a threat of war against a country if it declares war.
Sending a warning is a diplomatic action. There are no special preconditions for sending a warning, except that there must be no existing warning. Normal preconditions for diplomatic actions apply: the country must have at least one diplomat and enough money.
Once sent, a warning creates a diplomatic agreement (called the same thing, a warning), which lasts for 20 years. The country that the warning was sent to is said to be warned. There is no way to cancel a warning once sent.