James Cleverly is to resign as a shadow cabinet minister with immediate effect to run for London Mayor.