MCPcopy Create free account
hub / github.com/cloudfoundry/cli / GetRouterGroupByName

Method GetRouterGroupByName

api/router/router_group.go:41–68  ·  view source on GitHub ↗

GetRouterGroupByName returns a list of RouterGroups.

(name string)

Source from the content-addressed store, hash-verified

39
40// GetRouterGroupByName returns a list of RouterGroups.
41func (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}

Callers

nothing calls this directly

Calls 2

newHTTPRequestMethod · 0.95
MakeMethod · 0.65

Tested by

no test coverage detected