HAMAS is an acronym that stands for "Islamic Resistance Movement". As such, they do not wage war. They are not "at war" with Israel. They are resisting an illegal occupation of their land by Israel.
Israel, as the occupier, cannot "go to war": with the very population that it occupies and controls. There is no Palestinian state able to declare war. Palestine has no borders to defend; they only have the confines of the "Occupied Territories" (the official name) that Israel controls.
Hamas is NOT a terrorist organisation. It is a resistance movement that uses terror tactics to achieve a political outcome - EXACTLY like the French Resistance the Italian Partigiani - and most of all, EXACTLY like the Haganah, the Irgun and the LEHI, whose bloody terror campaigns against the British I documented in my article:
"“Rewarding Terrorism” in 1948 — How Zionists Used Terror to Get a State"