It's largely DM discretion. RAW, it's ambiguous. RAI, it's generally obvious that this is intended to make vampires nocturnal.
Personally, my rules for this are as follows:
- Direct sunlight, including light within the area of effect of spells that say they produce 'daylight' or 'sunlight', always applies unless something explicitly says otherwise.
- Indirect sunlight (reflected, passed through glass, etc), only applies if it's properties have not been visibly changed, or the rules explicitly treat it differently.
- If an area contains enough areas within it that rule 2 applies to that it's statistically likely that the vampire could move around between them with minimal effort, I treat the whole area as safe for the vampire.
- Areas of shadowy illumination count as safe as per rule 2.
Now, beyond that, I have a generic house rule that would apply here too, namely, I always say that any aspects of physics not explicitly covered by the rules behaves just like real life. Photonics (the study of light) is largely not covered by the rules, so most behaviors of light from real life also apply in game in my games.
This means for your examples, my rulings as DM would be the following:
- Direct sunlight:. Exactly as you said, by virtue of above rule one.
- Through glass:. Depends on the glass. Heavily tinted glass and darkly colored glass would not count, but clear glass such as what would normally be used for windows does, all based on rule 2 above. Through gemstones (I've actually had this come up before, one of my players splurged and got a carriage with windows made of solid milky quartz (among other extravagances)) works the same.
- Through clouds: it depends on the clouds. Total cloud cover does not count, minimal cover does, both based on rule 2 above. The cutoff point I normally use is 70% cloud cover. Much less than that, and it's too hard to keep to the shadows of the clouds, based on rule 3.
- Reflected in a mirror:. Almost always counts, provided it's what someone these days would call a mirror. Mirrors made of simple steel, tin, aluminum, copper, gold, or other metals that recolor the light or don't reflect it very well count only on a case by case basis (and I make it clear to my players if they count or not). Also based on rule 2 above.
- Under the shade of a tree:. Shadows are safe as per rule 4 above. In most cases, the whole area under the tree is safe as per rule 3 above, though this functionally requires you to be under the shadow of the canopy (so stuff like acacia trees is tricky).
- Bounced off the moon:. As per my house rule, this is reflected sunlight. As per the exception to my second rule above for these cases, this is no longer sunlight, because a number of spells and effects treat it specifically differently from sunlight, so it's safe (which appears to be in line with RAI).
- Light from stars: There are a number of things that require sunlight but won't work with starlight in previous editions. Later editions behave as previous editions unless stated or ruled otherwise (and I know of no rules or rulings for 5e that say otherwise), thus starlight is not sunlight. Based on this, it's safe (and this also aligns with apparent RAI).
Now, it's probably worth noting as well that I usually don't run 5e games (I do on occasion, but they're not the norm for my groups). In 3.5e, I handle things differently, because disadvantage isn't a thing in 3.5e, at least not like in 5e. There, you take numeric penalties on things. With 3.5e, I instead treat filtered sunlight (shadows, through colored or dark glass, through clouds, or reflected by imperfect mirrors) as applying a penalty on all rolls (not just attack rolls and ability checks, but also saves and damage rolls) scaled based on the 'purity' of the sunlight.
The other thing to consider here because I play older editions is that direct sunlight doesn't weaken vampires in earlier editions, it destroys them (on the second round of exposure). Quoting directly from the 3.5e Monster Manual:
Exposing any vampire to direct sunlight disorients it: It can take only a single move action or attack action and is destroyed utterly in the next round if it cannot escape.
This aspect of total destruction is a large part of why I'm so liberal about what counts as 'safe'. It makes things a bit harder for my players, but I have a couple of regulars who often voluntarily contract vampirism or lycanthropy (or become a lich) simply for the bonuses they provide, so I tend to rule in ways that don't make them completely useless except at night or indoors.