-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Expand file tree
/
Copy pathcheckpoint_remove.go
More file actions
34 lines (28 loc) · 1020 Bytes
/
checkpoint_remove.go
File metadata and controls
34 lines (28 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package client
import (
"context"
"net/url"
)
// CheckpointRemoveOptions holds parameters to delete a checkpoint from a container.
type CheckpointRemoveOptions struct {
CheckpointID string
CheckpointDir string
}
// CheckpointRemoveResult represents the result of [Client.CheckpointRemove].
type CheckpointRemoveResult struct {
// No fields currently; placeholder for future use.
}
// CheckpointRemove deletes the checkpoint with the given name from the given container.
func (cli *Client) CheckpointRemove(ctx context.Context, containerID string, options CheckpointRemoveOptions) (CheckpointRemoveResult, error) {
containerID, err := trimID("container", containerID)
if err != nil {
return CheckpointRemoveResult{}, err
}
query := url.Values{}
if options.CheckpointDir != "" {
query.Set("dir", options.CheckpointDir)
}
resp, err := cli.delete(ctx, "/containers/"+containerID+"/checkpoints/"+options.CheckpointID, query, nil)
defer ensureReaderClosed(resp)
return CheckpointRemoveResult{}, err
}