Skip to content

Commit

Permalink
api: add query options on agent force-leave endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
andrake81 committed Jan 17, 2023
1 parent e4a268e commit d4b4323
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/15987.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
api: Enable setting query options on agent force-leave endpoint.
```
7 changes: 7 additions & 0 deletions api/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,14 @@ func (a *Agent) ForceLeavePrune(node string) error {
// ForceLeaveOpts is used to have the agent eject a failed node or remove it
// completely from the list of members.
func (a *Agent) ForceLeaveOpts(node string, opts ForceLeaveOpts) error {
return a.ForceLeaveOptions(node, opts, nil)
}

// ForceLeaveOptions is used to have the agent eject a failed node or remove it
// completely from the list of members. Allows usage of QueryOptions on-top of ForceLeaveOpts
func (a *Agent) ForceLeaveOptions(node string, opts ForceLeaveOpts, q *QueryOptions) error {
r := a.c.newRequest("PUT", "/v1/agent/force-leave/"+node)
r.setQueryOptions(q)
if opts.Prune {
r.params.Set("prune", "1")
}
Expand Down

0 comments on commit d4b4323

Please sign in to comment.