2016-09-06 14:46:37 -04:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2016-09-19 12:01:16 -04:00
|
|
|
"net/url"
|
2016-09-06 14:46:37 -04:00
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// CheckpointList returns the volumes configured in the docker host.
|
2016-09-19 12:01:16 -04:00
|
|
|
func (cli *Client) CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) {
|
2016-09-06 14:46:37 -04:00
|
|
|
var checkpoints []types.Checkpoint
|
|
|
|
|
2016-09-19 12:01:16 -04:00
|
|
|
query := url.Values{}
|
|
|
|
if options.CheckpointDir != "" {
|
|
|
|
query.Set("dir", options.CheckpointDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil)
|
2016-09-06 14:46:37 -04:00
|
|
|
if err != nil {
|
|
|
|
return checkpoints, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = json.NewDecoder(resp.body).Decode(&checkpoints)
|
|
|
|
ensureReaderClosed(resp)
|
|
|
|
return checkpoints, err
|
|
|
|
}
|