2018-02-05 21:05:59 +00:00
|
|
|
package client // import "github.com/docker/docker/client"
|
2016-09-06 18:46:37 +00:00
|
|
|
|
|
|
|
import (
|
2018-04-19 22:30:59 +00:00
|
|
|
"context"
|
2016-09-06 18:46:37 +00:00
|
|
|
"encoding/json"
|
2016-09-19 16:01:16 +00:00
|
|
|
"net/url"
|
2016-09-06 18:46:37 +00:00
|
|
|
|
2023-08-26 10:37:41 +00:00
|
|
|
"github.com/docker/docker/api/types/checkpoint"
|
2016-09-06 18:46:37 +00:00
|
|
|
)
|
|
|
|
|
2017-02-03 16:41:35 +00:00
|
|
|
// CheckpointList returns the checkpoints of the given container in the docker host
|
2023-08-26 10:37:41 +00:00
|
|
|
func (cli *Client) CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) {
|
|
|
|
var checkpoints []checkpoint.Summary
|
2016-09-06 18:46:37 +00:00
|
|
|
|
2016-09-19 16:01:16 +00:00
|
|
|
query := url.Values{}
|
|
|
|
if options.CheckpointDir != "" {
|
|
|
|
query.Set("dir", options.CheckpointDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil)
|
2019-02-11 12:26:12 +00:00
|
|
|
defer ensureReaderClosed(resp)
|
2016-09-06 18:46:37 +00:00
|
|
|
if err != nil {
|
2022-03-20 15:55:42 +00:00
|
|
|
return checkpoints, err
|
2016-09-06 18:46:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
err = json.NewDecoder(resp.body).Decode(&checkpoints)
|
|
|
|
return checkpoints, err
|
|
|
|
}
|