(opts *SshCommonOptions, flags *SshCommonFlags)
| 207 | } |
| 208 | |
| 209 | func GetSshAccount(opts *SshCommonOptions, flags *SshCommonFlags) (accounts.IAccount, error) { |
| 210 | idOrName := flags.Account.Value |
| 211 | allAccounts, err := opts.GetAllAccountsForSshMachine() |
| 212 | if err != nil { |
| 213 | return nil, err |
| 214 | } |
| 215 | |
| 216 | for _, a := range allAccounts { |
| 217 | if strings.EqualFold(a.GetID(), idOrName) || strings.EqualFold(a.GetName(), idOrName) { |
| 218 | return a, nil |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | return nil, fmt.Errorf("cannot find account %s", idOrName) |
| 223 | } |
no test coverage detected