Skip to content

Commit

Permalink
List cluster tasks (#140)
Browse files Browse the repository at this point in the history
* vzdump api call

* struct tag fix

* replace vzdump method based on proxmox ve api

* review comment fixes

* cluster tasks api call

* add client instance to cluster task
  • Loading branch information
Pivnoy authored Apr 1, 2024
1 parent 91e6ecf commit 6c73285
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,17 @@ func (cl *Cluster) Resources(ctx context.Context, filters ...string) (rs Cluster

return rs, cl.client.Get(ctx, u.String(), &rs)
}

func (cl *Cluster) Tasks(ctx context.Context) (Tasks, error) {
var tasks Tasks

if err := cl.client.Get(ctx, "/cluster/tasks", &tasks); err != nil {
return nil, err
}

for index := range tasks {
tasks[index].client = cl.client
}

return tasks, nil
}
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ type VirtualMachineMoveDiskOptions struct {

type UPID string

type Tasks []*Tasks
type Tasks []*Task
type Task struct {
client *Client
UPID UPID
Expand Down

0 comments on commit 6c73285

Please sign in to comment.