Skip to content

Commit ef3f887

Browse files
author
Valentin Lemaire
committed
Added missing method to get the list of the latest GC executions
1 parent 2bf7f02 commit ef3f887

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

apiv2/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type RESTClient struct {
8686
configure *configure.RESTClient
8787
gc *gc.RESTClient
8888
health *health.RESTClient
89-
immutable *immutable.RESTClient
89+
immutable *immutable.RESTClient
9090
label *label.RESTClient
9191
member *member.RESTClient
9292
ping *ping.RESTClient
@@ -267,6 +267,10 @@ func (c *RESTClient) UpdateGarbageCollection(ctx context.Context, newGCSchedule
267267
return c.gc.UpdateGarbageCollection(ctx, newGCSchedule)
268268
}
269269

270+
func (c *RESTClient) GetGarbageCollectionExecutions(ctx context.Context) ([]*modelv2.GCHistory, error) {
271+
return c.gc.GetGarbageCollectionExecutions(ctx)
272+
}
273+
270274
func (c *RESTClient) GetGarbageCollectionExecution(ctx context.Context, id int64) (*modelv2.GCHistory, error) {
271275
return c.gc.GetGarbageCollectionExecution(ctx, id)
272276
}

apiv2/pkg/clients/gc/gc.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type Client interface {
3737
NewGarbageCollection(ctx context.Context, gcSchedule *model.Schedule) error
3838
UpdateGarbageCollection(ctx context.Context,
3939
newGCSchedule *model.Schedule) error
40+
GetGarbageCollectionExecutions(ctx context.Context) ([]*model.GCHistory, error)
4041
GetGarbageCollectionExecution(ctx context.Context, id int64) (*model.GCHistory, error)
4142
GetGarbageCollectionSchedule(ctx context.Context) (*model.GCHistory, error)
4243
ResetGarbageCollection(ctx context.Context) error
@@ -88,6 +89,18 @@ func (c *RESTClient) UpdateGarbageCollection(ctx context.Context,
8889
return handleSwaggerSystemErrors(err)
8990
}
9091

92+
// GetGarbageCollectionExecutions Returns the garbage collection executions.
93+
func (c *RESTClient) GetGarbageCollectionExecutions(ctx context.Context) ([]*model.GCHistory, error) {
94+
resp, err := c.V2Client.GC.GetGCHistory(&gc.GetGCHistoryParams{
95+
Context: ctx,
96+
}, c.AuthInfo)
97+
if err != nil {
98+
return nil, handleSwaggerSystemErrors(err)
99+
}
100+
101+
return resp.Payload, nil
102+
}
103+
91104
// GetGarbageCollectionExecution Returns a garbage collection execution identified by its id.
92105
func (c *RESTClient) GetGarbageCollectionExecution(ctx context.Context, id int64) (*model.GCHistory, error) {
93106
resp, err := c.V2Client.GC.GetGC(&gc.GetGCParams{

0 commit comments

Comments
 (0)