mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
Align with other "delete" options, which are all named "remove". Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
35 lines
1020 B
Go
35 lines
1020 B
Go
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
|
|
}
|