GetRouterGroupByName returns a list of RouterGroups.
(name string)
| 39 | |
| 40 | // GetRouterGroupByName returns a list of RouterGroups. |
| 41 | func (client *Client) GetRouterGroupByName(name string) (RouterGroup, error) { |
| 42 | request, err := client.newHTTPRequest(requestOptions{ |
| 43 | RequestName: internal.GetRouterGroups, |
| 44 | Query: url.Values{"name": []string{name}}, |
| 45 | }) |
| 46 | |
| 47 | if err != nil { |
| 48 | return RouterGroup{}, err |
| 49 | } |
| 50 | var routerGroups []RouterGroup |
| 51 | |
| 52 | var response = Response{ |
| 53 | Result: &routerGroups, |
| 54 | } |
| 55 | |
| 56 | err = client.connection.Make(request, &response) |
| 57 | if err != nil { |
| 58 | return RouterGroup{}, err |
| 59 | } |
| 60 | |
| 61 | for _, routerGroup := range routerGroups { |
| 62 | if routerGroup.Name == name { |
| 63 | return routerGroup, nil |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return RouterGroup{}, routererror.ResourceNotFoundError{} |
| 68 | } |
nothing calls this directly
no test coverage detected