Use the Type field to determine which variant is active, then access the corresponding field:
switch inputUnion.Type { case components.InputUnionTypeInput1: // inputUnion.Input1 is populated case components.InputUnionTypeInput2: // inputUnion.Input2 is populated}