Constitutionally, "police officers are allowed to shoot under two circumstances," The first circumstance is "to protect their life or the life of another innocent party" — what departments call the "defense-of-life" standard. The second circumstance is to prevent a suspect from escaping, but only if the officer has probable cause to think the suspect's committed a serious violent felony.
The key to both of the legal standards -- defense-of-life and fleeing a violent felony -- is that it doesn't matter whether there is an actual threat when force is used. Instead, what matters is the officer's "objectively reasonable" belief that there is a threat。
That standard comes from the Supreme Court case that guides use-of-force decisions: Graham v. Connor. This was a civil lawsuit brought by a man who'd survived his encounter with police officers, but who'd been treated roughly, had his face shoved into the hood of a car, and broken his foot — all while he was suffering a diabetic attack. The Court didn't rule on whether the officers' treatment of him had been justified, but it did say that the officers couldn't justify their conduct just based on whether their intentions were good. They had to demonstrate that their actions were "objectively reasonable," given the circumstances and compared to what other police officers might do.