| 27 | } |
| 28 | |
| 29 | func FindChannel(octopus *octopusApiClient.Client, project *projects.Project, channelName string) (*channels.Channel, error) { |
| 30 | foundChannels, err := octopus.Projects.GetChannels(project) // TODO change this to channel partial name search on server; will require go client update |
| 31 | if err != nil { |
| 32 | return nil, err |
| 33 | } |
| 34 | for _, c := range foundChannels { // server doesn't support channel search by exact name so we must emulate it |
| 35 | if strings.EqualFold(c.Name, channelName) { |
| 36 | return c, nil |
| 37 | } |
| 38 | } |
| 39 | return nil, fmt.Errorf("no channel found with name of %s", channelName) |
| 40 | } |