Skip to content

Commit

Permalink
Remove the original unpaginated GetRoles RPC (#47984)
Browse files Browse the repository at this point in the history
This was replaced with ListRoles, which implements pagination.
  • Loading branch information
zmb3 authored Oct 28, 2024
1 parent 3fe2c3d commit 6d205ba
Show file tree
Hide file tree
Showing 3 changed files with 941 additions and 1,055 deletions.
20 changes: 0 additions & 20 deletions api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1782,11 +1782,6 @@ func (c *Client) GetRoles(ctx context.Context) ([]types.Role, error) {
for {
rsp, err := c.ListRoles(ctx, &req)
if err != nil {
if trace.IsNotImplemented(err) {
// fallback to calling the old non-paginated role API.
roles, err = c.getRoles(ctx)
return roles, trace.Wrap(err)
}
return nil, trace.Wrap(err)
}

Expand All @@ -1802,21 +1797,6 @@ func (c *Client) GetRoles(ctx context.Context) ([]types.Role, error) {
return roles, nil
}

// getRoles calls the old non-paginated GetRoles method.
//
// DELETE IN 17.0
func (c *Client) getRoles(ctx context.Context) ([]types.Role, error) {
resp, err := c.grpc.GetRoles(ctx, &emptypb.Empty{})
if err != nil {
return nil, trace.Wrap(err)
}
roles := make([]types.Role, 0, len(resp.GetRoles()))
for _, role := range resp.GetRoles() {
roles = append(roles, role)
}
return roles, nil
}

// ListRoles is a paginated role getter.
func (c *Client) ListRoles(ctx context.Context, req *proto.ListRolesRequest) (*proto.ListRolesResponse, error) {
var header gmetadata.MD
Expand Down
Loading

0 comments on commit 6d205ba

Please sign in to comment.