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