mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #50905 from thaJeztah/move_checkpoint_options
api/types/checkpoint: move checkpoint options to client
This commit is contained in:
8
api/types/checkpoint/create_request.go
Normal file
8
api/types/checkpoint/create_request.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package checkpoint
|
||||
|
||||
// CreateRequest holds parameters to create a checkpoint from a container.
|
||||
type CreateRequest struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
Exit bool
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package checkpoint
|
||||
|
||||
// CreateOptions holds parameters to create a checkpoint from a container.
|
||||
type CreateOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
Exit bool
|
||||
}
|
||||
|
||||
// ListOptions holds parameters to list checkpoints for a container.
|
||||
type ListOptions struct {
|
||||
CheckpointDir string
|
||||
}
|
||||
|
||||
// DeleteOptions holds parameters to delete a checkpoint from a container.
|
||||
type DeleteOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
// and only available if the daemon is running with experimental features
|
||||
// enabled.
|
||||
type CheckpointAPIClient interface {
|
||||
CheckpointCreate(ctx context.Context, container string, options checkpoint.CreateOptions) error
|
||||
CheckpointDelete(ctx context.Context, container string, options checkpoint.DeleteOptions) error
|
||||
CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error)
|
||||
CheckpointCreate(ctx context.Context, container string, options CheckpointCreateOptions) error
|
||||
CheckpointDelete(ctx context.Context, container string, options CheckpointDeleteOptions) error
|
||||
CheckpointList(ctx context.Context, container string, options CheckpointListOptions) ([]checkpoint.Summary, error)
|
||||
}
|
||||
|
||||
@@ -6,14 +6,26 @@ import (
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
)
|
||||
|
||||
// CheckpointCreateOptions holds parameters to create a checkpoint from a container.
|
||||
type CheckpointCreateOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
Exit bool
|
||||
}
|
||||
|
||||
// CheckpointCreate creates a checkpoint from the given container.
|
||||
func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options checkpoint.CreateOptions) error {
|
||||
func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options CheckpointCreateOptions) error {
|
||||
containerID, err := trimID("container", containerID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
requestBody := checkpoint.CreateRequest{
|
||||
CheckpointID: options.CheckpointID,
|
||||
CheckpointDir: options.CheckpointDir,
|
||||
Exit: options.Exit,
|
||||
}
|
||||
|
||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/checkpoints", nil, options, nil)
|
||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/checkpoints", nil, requestBody, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"testing"
|
||||
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@@ -23,18 +22,18 @@ func TestCheckpointCreateError(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
err = client.CheckpointCreate(context.Background(), "nothing", checkpoint.CreateOptions{
|
||||
err = client.CheckpointCreate(context.Background(), "nothing", CheckpointCreateOptions{
|
||||
CheckpointID: "noting",
|
||||
Exit: true,
|
||||
})
|
||||
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
|
||||
err = client.CheckpointCreate(context.Background(), "", checkpoint.CreateOptions{})
|
||||
err = client.CheckpointCreate(context.Background(), "", CheckpointCreateOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
|
||||
err = client.CheckpointCreate(context.Background(), " ", checkpoint.CreateOptions{})
|
||||
err = client.CheckpointCreate(context.Background(), " ", CheckpointCreateOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
}
|
||||
@@ -54,7 +53,7 @@ func TestCheckpointCreate(t *testing.T) {
|
||||
return nil, fmt.Errorf("expected POST method, got %s", req.Method)
|
||||
}
|
||||
|
||||
createOptions := &checkpoint.CreateOptions{}
|
||||
createOptions := &CheckpointCreateOptions{}
|
||||
if err := json.NewDecoder(req.Body).Decode(createOptions); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -75,7 +74,7 @@ func TestCheckpointCreate(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
err = client.CheckpointCreate(context.Background(), expectedContainerID, checkpoint.CreateOptions{
|
||||
err = client.CheckpointCreate(context.Background(), expectedContainerID, CheckpointCreateOptions{
|
||||
CheckpointID: expectedCheckpointID,
|
||||
Exit: true,
|
||||
})
|
||||
|
||||
@@ -3,12 +3,16 @@ package client
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
)
|
||||
|
||||
// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container.
|
||||
type CheckpointDeleteOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
}
|
||||
|
||||
// CheckpointDelete deletes the checkpoint with the given name from the given container.
|
||||
func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options checkpoint.DeleteOptions) error {
|
||||
func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options CheckpointDeleteOptions) error {
|
||||
containerID, err := trimID("container", containerID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@@ -21,17 +20,17 @@ func TestCheckpointDeleteError(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
err = client.CheckpointDelete(context.Background(), "container_id", checkpoint.DeleteOptions{
|
||||
err = client.CheckpointDelete(context.Background(), "container_id", CheckpointDeleteOptions{
|
||||
CheckpointID: "checkpoint_id",
|
||||
})
|
||||
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
|
||||
err = client.CheckpointDelete(context.Background(), "", checkpoint.DeleteOptions{})
|
||||
err = client.CheckpointDelete(context.Background(), "", CheckpointDeleteOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
|
||||
err = client.CheckpointDelete(context.Background(), " ", checkpoint.DeleteOptions{})
|
||||
err = client.CheckpointDelete(context.Background(), " ", CheckpointDeleteOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
}
|
||||
@@ -55,7 +54,7 @@ func TestCheckpointDelete(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
err = client.CheckpointDelete(context.Background(), "container_id", checkpoint.DeleteOptions{
|
||||
err = client.CheckpointDelete(context.Background(), "container_id", CheckpointDeleteOptions{
|
||||
CheckpointID: "checkpoint_id",
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
|
||||
@@ -8,8 +8,13 @@ import (
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
)
|
||||
|
||||
// CheckpointListOptions holds parameters to list checkpoints for a container.
|
||||
type CheckpointListOptions struct {
|
||||
CheckpointDir string
|
||||
}
|
||||
|
||||
// CheckpointList returns the checkpoints of the given container in the docker host.
|
||||
func (cli *Client) CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) {
|
||||
func (cli *Client) CheckpointList(ctx context.Context, container string, options CheckpointListOptions) ([]checkpoint.Summary, error) {
|
||||
var checkpoints []checkpoint.Summary
|
||||
|
||||
query := url.Values{}
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestCheckpointListError(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.CheckpointList(context.Background(), "container_id", checkpoint.ListOptions{})
|
||||
_, err = client.CheckpointList(context.Background(), "container_id", CheckpointListOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestCheckpointList(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
checkpoints, err := client.CheckpointList(context.Background(), "container_id", checkpoint.ListOptions{})
|
||||
checkpoints, err := client.CheckpointList(context.Background(), "container_id", CheckpointListOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Len(checkpoints, 1))
|
||||
}
|
||||
@@ -61,6 +61,6 @@ func TestCheckpointListContainerNotFound(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.CheckpointList(context.Background(), "unknown", checkpoint.ListOptions{})
|
||||
_, err = client.CheckpointList(context.Background(), "unknown", CheckpointListOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
"github.com/moby/moby/api/types/events"
|
||||
"github.com/moby/moby/v2/daemon/names"
|
||||
"github.com/moby/moby/v2/daemon/server/backend"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -52,7 +53,7 @@ func getCheckpointDir(checkDir, checkpointID, ctrName, ctrID, ctrCheckpointDir s
|
||||
}
|
||||
|
||||
// CheckpointCreate checkpoints the process running in a container with CRIU
|
||||
func (daemon *Daemon) CheckpointCreate(name string, config checkpoint.CreateOptions) error {
|
||||
func (daemon *Daemon) CheckpointCreate(name string, config checkpoint.CreateRequest) error {
|
||||
container, err := daemon.GetContainer(name)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -86,7 +87,7 @@ func (daemon *Daemon) CheckpointCreate(name string, config checkpoint.CreateOpti
|
||||
}
|
||||
|
||||
// CheckpointDelete deletes the specified checkpoint
|
||||
func (daemon *Daemon) CheckpointDelete(name string, config checkpoint.DeleteOptions) error {
|
||||
func (daemon *Daemon) CheckpointDelete(name string, config backend.CheckpointDeleteOptions) error {
|
||||
container, err := daemon.GetContainer(name)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -99,7 +100,7 @@ func (daemon *Daemon) CheckpointDelete(name string, config checkpoint.DeleteOpti
|
||||
}
|
||||
|
||||
// CheckpointList lists all checkpoints of the specified container
|
||||
func (daemon *Daemon) CheckpointList(name string, config checkpoint.ListOptions) ([]checkpoint.Summary, error) {
|
||||
func (daemon *Daemon) CheckpointList(name string, config backend.CheckpointListOptions) ([]checkpoint.Summary, error) {
|
||||
var out []checkpoint.Summary
|
||||
|
||||
container, err := daemon.GetContainer(name)
|
||||
|
||||
12
daemon/server/backend/checkpoint.go
Normal file
12
daemon/server/backend/checkpoint.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package backend
|
||||
|
||||
// CheckpointListOptions holds parameters to list checkpoints for a container.
|
||||
type CheckpointListOptions struct {
|
||||
CheckpointDir string
|
||||
}
|
||||
|
||||
// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container.
|
||||
type CheckpointDeleteOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package checkpoint
|
||||
|
||||
import "github.com/moby/moby/api/types/checkpoint"
|
||||
import (
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
"github.com/moby/moby/v2/daemon/server/backend"
|
||||
)
|
||||
|
||||
// Backend for Checkpoint
|
||||
type Backend interface {
|
||||
CheckpointCreate(container string, config checkpoint.CreateOptions) error
|
||||
CheckpointDelete(container string, config checkpoint.DeleteOptions) error
|
||||
CheckpointList(container string, config checkpoint.ListOptions) ([]checkpoint.Summary, error)
|
||||
CheckpointCreate(container string, config checkpoint.CreateRequest) error
|
||||
CheckpointDelete(container string, config backend.CheckpointDeleteOptions) error
|
||||
CheckpointList(container string, config backend.CheckpointListOptions) ([]checkpoint.Summary, error)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
"github.com/moby/moby/v2/daemon/server/backend"
|
||||
"github.com/moby/moby/v2/daemon/server/httputils"
|
||||
)
|
||||
|
||||
@@ -13,7 +14,7 @@ func (cr *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.
|
||||
return err
|
||||
}
|
||||
|
||||
var options checkpoint.CreateOptions
|
||||
var options checkpoint.CreateRequest
|
||||
if err := httputils.ReadJSON(r, &options); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -32,7 +33,7 @@ func (cr *checkpointRouter) getContainerCheckpoints(ctx context.Context, w http.
|
||||
return err
|
||||
}
|
||||
|
||||
checkpoints, err := cr.backend.CheckpointList(vars["name"], checkpoint.ListOptions{
|
||||
checkpoints, err := cr.backend.CheckpointList(vars["name"], backend.CheckpointListOptions{
|
||||
CheckpointDir: r.Form.Get("dir"),
|
||||
})
|
||||
if err != nil {
|
||||
@@ -47,7 +48,7 @@ func (cr *checkpointRouter) deleteContainerCheckpoint(ctx context.Context, w htt
|
||||
return err
|
||||
}
|
||||
|
||||
err := cr.backend.CheckpointDelete(vars["name"], checkpoint.DeleteOptions{
|
||||
err := cr.backend.CheckpointDelete(vars["name"], backend.CheckpointDeleteOptions{
|
||||
CheckpointDir: r.Form.Get("dir"),
|
||||
CheckpointID: vars["checkpoint"],
|
||||
})
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
containertypes "github.com/moby/moby/api/types/container"
|
||||
mounttypes "github.com/moby/moby/api/types/mount"
|
||||
"github.com/moby/moby/client"
|
||||
@@ -55,7 +54,7 @@ func TestCheckpoint(t *testing.T) {
|
||||
}()
|
||||
|
||||
t.Log("Do a checkpoint and leave the container running")
|
||||
err = apiClient.CheckpointCreate(ctx, cID, checkpoint.CreateOptions{
|
||||
err = apiClient.CheckpointCreate(ctx, cID, client.CheckpointCreateOptions{
|
||||
Exit: false,
|
||||
CheckpointID: "test",
|
||||
})
|
||||
@@ -78,7 +77,7 @@ func TestCheckpoint(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(true, inspect.State.Running))
|
||||
|
||||
checkpoints, err := apiClient.CheckpointList(ctx, cID, checkpoint.ListOptions{})
|
||||
checkpoints, err := apiClient.CheckpointList(ctx, cID, client.CheckpointListOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, len(checkpoints), 1)
|
||||
assert.Equal(t, checkpoints[0].Name, "test")
|
||||
@@ -91,7 +90,7 @@ func TestCheckpoint(t *testing.T) {
|
||||
|
||||
// Do a second checkpoint
|
||||
t.Log("Do a checkpoint and stop the container")
|
||||
err = apiClient.CheckpointCreate(ctx, cID, checkpoint.CreateOptions{
|
||||
err = apiClient.CheckpointCreate(ctx, cID, client.CheckpointCreateOptions{
|
||||
Exit: true,
|
||||
CheckpointID: "test2",
|
||||
})
|
||||
@@ -104,7 +103,7 @@ func TestCheckpoint(t *testing.T) {
|
||||
assert.Check(t, is.Equal(false, inspect.State.Running))
|
||||
|
||||
// Check that both checkpoints are listed.
|
||||
checkpoints, err = apiClient.CheckpointList(ctx, cID, checkpoint.ListOptions{})
|
||||
checkpoints, err = apiClient.CheckpointList(ctx, cID, client.CheckpointListOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, len(checkpoints), 2)
|
||||
cptNames := make([]string, 2)
|
||||
@@ -133,7 +132,7 @@ func TestCheckpoint(t *testing.T) {
|
||||
r.AssertSuccess(t)
|
||||
|
||||
for _, id := range []string{"test", "test2"} {
|
||||
err = apiClient.CheckpointDelete(ctx, cID, checkpoint.DeleteOptions{
|
||||
err = apiClient.CheckpointDelete(ctx, cID, client.CheckpointDeleteOptions{
|
||||
CheckpointID: id,
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
|
||||
8
vendor/github.com/moby/moby/api/types/checkpoint/create_request.go
generated
vendored
Normal file
8
vendor/github.com/moby/moby/api/types/checkpoint/create_request.go
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
package checkpoint
|
||||
|
||||
// CreateRequest holds parameters to create a checkpoint from a container.
|
||||
type CreateRequest struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
Exit bool
|
||||
}
|
||||
19
vendor/github.com/moby/moby/api/types/checkpoint/options.go
generated
vendored
19
vendor/github.com/moby/moby/api/types/checkpoint/options.go
generated
vendored
@@ -1,19 +0,0 @@
|
||||
package checkpoint
|
||||
|
||||
// CreateOptions holds parameters to create a checkpoint from a container.
|
||||
type CreateOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
Exit bool
|
||||
}
|
||||
|
||||
// ListOptions holds parameters to list checkpoints for a container.
|
||||
type ListOptions struct {
|
||||
CheckpointDir string
|
||||
}
|
||||
|
||||
// DeleteOptions holds parameters to delete a checkpoint from a container.
|
||||
type DeleteOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
}
|
||||
6
vendor/github.com/moby/moby/client/checkpoint.go
generated
vendored
6
vendor/github.com/moby/moby/client/checkpoint.go
generated
vendored
@@ -12,7 +12,7 @@ import (
|
||||
// and only available if the daemon is running with experimental features
|
||||
// enabled.
|
||||
type CheckpointAPIClient interface {
|
||||
CheckpointCreate(ctx context.Context, container string, options checkpoint.CreateOptions) error
|
||||
CheckpointDelete(ctx context.Context, container string, options checkpoint.DeleteOptions) error
|
||||
CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error)
|
||||
CheckpointCreate(ctx context.Context, container string, options CheckpointCreateOptions) error
|
||||
CheckpointDelete(ctx context.Context, container string, options CheckpointDeleteOptions) error
|
||||
CheckpointList(ctx context.Context, container string, options CheckpointListOptions) ([]checkpoint.Summary, error)
|
||||
}
|
||||
|
||||
16
vendor/github.com/moby/moby/client/checkpoint_create.go
generated
vendored
16
vendor/github.com/moby/moby/client/checkpoint_create.go
generated
vendored
@@ -6,14 +6,26 @@ import (
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
)
|
||||
|
||||
// CheckpointCreateOptions holds parameters to create a checkpoint from a container.
|
||||
type CheckpointCreateOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
Exit bool
|
||||
}
|
||||
|
||||
// CheckpointCreate creates a checkpoint from the given container.
|
||||
func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options checkpoint.CreateOptions) error {
|
||||
func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options CheckpointCreateOptions) error {
|
||||
containerID, err := trimID("container", containerID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
requestBody := checkpoint.CreateRequest{
|
||||
CheckpointID: options.CheckpointID,
|
||||
CheckpointDir: options.CheckpointDir,
|
||||
Exit: options.Exit,
|
||||
}
|
||||
|
||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/checkpoints", nil, options, nil)
|
||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/checkpoints", nil, requestBody, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
return err
|
||||
}
|
||||
|
||||
10
vendor/github.com/moby/moby/client/checkpoint_delete.go
generated
vendored
10
vendor/github.com/moby/moby/client/checkpoint_delete.go
generated
vendored
@@ -3,12 +3,16 @@ package client
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
)
|
||||
|
||||
// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container.
|
||||
type CheckpointDeleteOptions struct {
|
||||
CheckpointID string
|
||||
CheckpointDir string
|
||||
}
|
||||
|
||||
// CheckpointDelete deletes the checkpoint with the given name from the given container.
|
||||
func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options checkpoint.DeleteOptions) error {
|
||||
func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options CheckpointDeleteOptions) error {
|
||||
containerID, err := trimID("container", containerID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
7
vendor/github.com/moby/moby/client/checkpoint_list.go
generated
vendored
7
vendor/github.com/moby/moby/client/checkpoint_list.go
generated
vendored
@@ -8,8 +8,13 @@ import (
|
||||
"github.com/moby/moby/api/types/checkpoint"
|
||||
)
|
||||
|
||||
// CheckpointListOptions holds parameters to list checkpoints for a container.
|
||||
type CheckpointListOptions struct {
|
||||
CheckpointDir string
|
||||
}
|
||||
|
||||
// CheckpointList returns the checkpoints of the given container in the docker host.
|
||||
func (cli *Client) CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) {
|
||||
func (cli *Client) CheckpointList(ctx context.Context, container string, options CheckpointListOptions) ([]checkpoint.Summary, error) {
|
||||
var checkpoints []checkpoint.Summary
|
||||
|
||||
query := url.Values{}
|
||||
|
||||
Reference in New Issue
Block a user