It is reported that Al-Hasan Al-Basrī – Allāh have mercy on him – said:

Verily, Allāh lets [a person] enjoy a blessing for as long as He wills. But when He is no longer thanked for it, He turns it into a punishment.
Ibn Abī Al-Dunyā, Kitāb Al-Shukr article 17