MCPcopy
hub / github.com/segmentio/kafka-go / ListGroups

Method ListGroups

listgroups.go:39–61  ·  view source on GitHub ↗
(
	ctx context.Context,
	req *ListGroupsRequest,
)

Source from the content-addressed store, hash-verified

37}
38
39func (c *Client) ListGroups(
40 ctx context.Context,
41 req *ListGroupsRequest,
42) (*ListGroupsResponse, error) {
43 protoResp, err := c.roundTrip(ctx, req.Addr, &listgroups.Request{})
44 if err != nil {
45 return nil, err
46 }
47 apiResp := protoResp.(*listgroups.Response)
48 resp := &ListGroupsResponse{
49 Error: makeError(apiResp.ErrorCode, ""),
50 }
51
52 for _, apiGroupInfo := range apiResp.Groups {
53 resp.Groups = append(resp.Groups, ListGroupsResponseGroup{
54 GroupID: apiGroupInfo.GroupID,
55 Coordinator: int(apiGroupInfo.BrokerID),
56 ProtocolType: apiGroupInfo.ProtocolType,
57 })
58 }
59
60 return resp, nil
61}
62
63// TODO: Remove everything below and use protocol-based version above everywhere.
64type listGroupsRequestV1 struct {

Callers 1

TestClientListGroupsFunction · 0.80

Calls 2

roundTripMethod · 0.95
makeErrorFunction · 0.85

Tested by 1

TestClientListGroupsFunction · 0.64