github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/client/checkpoint_list.go (about) 1 package client // import "github.com/Prakhar-Agarwal-byte/moby/client" 2 3 import ( 4 "context" 5 "encoding/json" 6 "net/url" 7 8 "github.com/Prakhar-Agarwal-byte/moby/api/types/checkpoint" 9 ) 10 11 // CheckpointList returns the checkpoints of the given container in the docker host 12 func (cli *Client) CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) { 13 var checkpoints []checkpoint.Summary 14 15 query := url.Values{} 16 if options.CheckpointDir != "" { 17 query.Set("dir", options.CheckpointDir) 18 } 19 20 resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil) 21 defer ensureReaderClosed(resp) 22 if err != nil { 23 return checkpoints, err 24 } 25 26 err = json.NewDecoder(resp.body).Decode(&checkpoints) 27 return checkpoints, err 28 }