Use the Type field to determine which variant is active, then access the corresponding field:
switch providerPreferencesOrder.Type { case components.ProviderPreferencesOrderTypeProviderName: // providerPreferencesOrder.ProviderName is populated case components.ProviderPreferencesOrderTypeStr: // providerPreferencesOrder.Str is populated}