Skip to content

Commit

Permalink
Merge pull request #7 from DYukun/main
Browse files Browse the repository at this point in the history
feat: Add DeleteUser method to the module
  • Loading branch information
heww authored Apr 27, 2023
2 parents 9b51f56 + c445a2a commit f79f0df
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/module/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ func (h *Harbor) CreateUser(ctx context.Context, username string, passwords ...s
return IDFromLocation(ctx, res.Location)
}

func (h *Harbor) DeleteUser(ctx context.Context, userid int64) {
h.mustInitialized(ctx)

params := operation.NewDeleteUserParams()
params.WithUserID(userid)

_, err := h.api.User.DeleteUser(ctx, params)
Checkf(ctx, err, "failed to delete user %v", userid)
}

type ListUsersResult struct {
Users []*models.UserResp `js:"users"`
Total int64 `js:"total"`
Expand Down

0 comments on commit f79f0df

Please sign in to comment.