I am curious as to whether there is some sort of code for colour and number of rings. Are some legendaries only behind different varieties? Do some wormholes have higher probability of shinies?
The thing determining what Pokémon you get and where you go is the colour of the wormhole. There are five different colours, each with a different locale and thus different Pokémon that are available to you. Be sure to pick the right one when hunting for certain Pokémon. However, the Pokémon you do get is random, with some Pokémon being rarer than others, and you'd need to leave and come back to get another
White Wormholes - Ultra Beasts Blue Wormholes - Waterfall Red Wormholes - Cliffside Green Wormholes - Field Yellow Wormholes - Cave
Ultra Beasts you can get an infinite number of times, but Legendary Pokémon will only appear until they have been captured.
Sorce: https://www.serebii.net/ultrasunultramoon/ultrawormholes.shtml