After being sentenced, Hiraka waved to a supporter in the gallery and put his hands together to gesture "thanks".
In September, Hiraka, a machine operator from Whakatane, was driving a stolen Honda Odyssey when two police officers in a patrol car attempted to stop him.
Police said he got out of the car and ran up to the patrol car.
He then aimed a sawn-off rifle at the officers and pulled the trigger twice at close range.
Luckily for the officers, the loaded and cocked firearm did not discharge because its safety catch was on.
One of the officers tasered Hiraka, which caused him to drop the gun. He then attempted to get into the police car and was tasered again.
He resisted arrest and punched one of the officers in the face twice, before trying to flee the scene. He was tasered and apprehended by the officers.
Acting Counties Manukau District Commander Inspector Matt Srhoj acknowledged Hiraka's sentence today.
"This incident was extremely distressing for the two officers involved and I am just thankful that neither were seriously injured or worse - although, I am aware it could easily have been a completely different outcome," he told the Herald.
"Our staff come to work every day and willingly put themselves into dangerous situations so that they can keep other people safe.
"The last thing they deserve is to be threatened with a firearm.
"I want to once again praise the actions of our officers involved.
"Policing can be unpredictable but these officers acted quickly in a highly stressful situation and prevented any further injury to themselves and to our community."