Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List cluster tasks #140

Merged
merged 14 commits into from
Apr 1, 2024
14 changes: 14 additions & 0 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,17 @@

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
}

Check warning on line 58 in cluster.go

View check run for this annotation

Codecov / codecov/patch

cluster.go#L53-L58

Added lines #L53 - L58 were not covered by tests

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

Check warning on line 62 in cluster.go

View check run for this annotation

Codecov / codecov/patch

cluster.go#L60-L62

Added lines #L60 - L62 were not covered by tests

return tasks, nil

Check warning on line 64 in cluster.go

View check run for this annotation

Codecov / codecov/patch

cluster.go#L64

Added line #L64 was not covered by tests
}
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
Loading