(result BridgeResolveTargetRecord)
| 917 | } |
| 918 | |
| 919 | func bridgeResolveTargetBundle(result BridgeResolveTargetRecord) outputBundle { |
| 920 | return outputBundle{ |
| 921 | jsonValue: result, |
| 922 | human: func() (string, error) { |
| 923 | if result.Result.Match == nil { |
| 924 | return renderHumanSection("Bridge Target", []keyValue{ |
| 925 | {Label: automationStatusValue, Value: bridgeUnresolvedValue}, |
| 926 | {Label: bridgeStepValue, Value: fmt.Sprintf("%d", result.Result.Step)}, |
| 927 | {Label: "Ambiguous", Value: fmt.Sprintf("%t", result.Result.Ambiguous)}, |
| 928 | {Label: "Candidates", Value: fmt.Sprintf("%d", len(result.Result.Candidates))}, |
| 929 | }), nil |
| 930 | } |
| 931 | target := result.Result.Match |
| 932 | return renderHumanSection("Bridge Target", []keyValue{ |
| 933 | {Label: automationStatusValue, Value: bridgeResolvedValue}, |
| 934 | {Label: bridgeStepValue, Value: fmt.Sprintf("%d", result.Result.Step)}, |
| 935 | {Label: "Route", Value: stringOrDash(target.CanonicalRoute)}, |
| 936 | {Label: automationNameValue, Value: stringOrDash(target.DisplayName)}, |
| 937 | {Label: "Type", Value: stringOrDash(string(target.TargetType))}, |
| 938 | {Label: "Qualifier", Value: stringOrDash(target.Qualifier)}, |
| 939 | }), nil |
| 940 | }, |
| 941 | toon: func() (string, error) { |
| 942 | status := bridgeUnresolvedValue |
| 943 | route := "" |
| 944 | name := "" |
| 945 | if result.Result.Match != nil { |
| 946 | status = bridgeResolvedValue |
| 947 | route = result.Result.Match.CanonicalRoute |
| 948 | name = result.Result.Match.DisplayName |
| 949 | } |
| 950 | return renderToonObject("bridge_target", []string{ |
| 951 | bridgeStatusKey, |
| 952 | "step", |
| 953 | "ambiguous", |
| 954 | "canonical_route", |
| 955 | bridgeDisplayNameKey, |
| 956 | }, []string{ |
| 957 | status, |
| 958 | fmt.Sprintf("%d", result.Result.Step), |
| 959 | fmt.Sprintf("%t", result.Result.Ambiguous), |
| 960 | route, |
| 961 | name, |
| 962 | }), nil |
| 963 | }, |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | func bridgeSecretBindingListBundle(items []BridgeSecretBindingRecord) outputBundle { |
| 968 | return listBundle( |
no test coverage detected