In the case of Hodel v. Virginia Surface Mining Association (452 U.S. 264 (1981)), the Supreme Court established a four part test to decide whether or not a Statute violates a State's Constitutional immunity (via the 10th Amendment) from regulation. To be legal, the Statute:
Must regulate the States as States. (as opposed to people in those States).
Must address matters that are indisputable attributes of State sovereignty.
Must directly impair integral operations in areas of traditional government functions.
Must not be such that the nature of the Federal interest does not justify State submission. (This part is debatable. It can be argued that even if there is a national interest, you still can't violate the 10th Amendment).