It's an idiom, with several different expressions:
- It took all I had...
- It took everything I had within me...
- I took all I had in me...
It means one has to harness every bit of willpower one has in order to do (or not to do) something; one does it against their natural desire.
I was so beaten down emotionally and it took all I had within me to finally decide to leave.
It took all I had to not burst out in laughter.
It took all I had in me to produce a smile and give her a limp handshake.
A pain so unbearable that it took everything in me to get up in the mornings.
It took everything within me to NOT loose my composure...
It can be used to express that it took some willpower (not to laugh) or all the willpower one has (to finally decide leave someone).
Another common way to say it is It took every ounce of strength I had:
It took every ounce of strength I had to not turn and flee.