Merge pull request #273 from tiborvass/plugins

plugins: update APIClient interface
This commit is contained in:
Sebastiaan van Stijn 2016-06-14 09:38:47 +02:00 коммит произвёл GitHub
Родитель 8e7bf86d99 0543c48aad
Коммит 5fd66ece9e
3 изменённых файлов: 40 добавлений и 7 удалений

Просмотреть файл

@ -4,18 +4,17 @@ import (
"io" "io"
"time" "time"
"golang.org/x/net/context"
"github.com/docker/engine-api/types" "github.com/docker/engine-api/types"
"github.com/docker/engine-api/types/container" "github.com/docker/engine-api/types/container"
"github.com/docker/engine-api/types/filters" "github.com/docker/engine-api/types/filters"
"github.com/docker/engine-api/types/network" "github.com/docker/engine-api/types/network"
"github.com/docker/engine-api/types/registry" "github.com/docker/engine-api/types/registry"
"github.com/docker/engine-api/types/swarm" "github.com/docker/engine-api/types/swarm"
"golang.org/x/net/context"
) )
// APIClient is an interface that clients that talk with a docker server must implement. // CommonAPIClient is the common methods between stable and experimental versions of APIClient.
type APIClient interface { type CommonAPIClient interface {
ClientVersion() string ClientVersion() string
CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error
CheckpointDelete(ctx context.Context, container string, checkpointID string) error CheckpointDelete(ctx context.Context, container string, checkpointID string) error
@ -97,6 +96,3 @@ type APIClient interface {
VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error) VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error)
VolumeRemove(ctx context.Context, volumeID string) error VolumeRemove(ctx context.Context, volumeID string) error
} }
// Ensure that Client always implements APIClient.
var _ APIClient = &Client{}

Просмотреть файл

@ -0,0 +1,26 @@
// +build experimental
package client
import (
"io"
"github.com/docker/engine-api/types"
"golang.org/x/net/context"
)
// APIClient is an interface that clients that talk with a docker server must implement.
type APIClient interface {
CommonAPIClient
PluginList(ctx context.Context) (types.PluginsListResponse, error)
PluginRemove(ctx context.Context, name string) error
PluginEnable(ctx context.Context, name string) error
PluginDisable(ctx context.Context, name string) error
PluginInstall(ctx context.Context, name, registryAuth string, acceptAllPermissions, noEnable bool, in io.ReadCloser, out io.Writer) error
PluginPush(ctx context.Context, name string, registryAuth string) error
PluginSet(ctx context.Context, name string, args []string) error
PluginInspect(ctx context.Context, name string) (*types.Plugin, error)
}
// Ensure that Client always implements APIClient.
var _ APIClient = &Client{}

Просмотреть файл

@ -0,0 +1,11 @@
// +build !experimental
package client
// APIClient is an interface that clients that talk with a docker server must implement.
type APIClient interface {
CommonAPIClient
}
// Ensure that Client always implements APIClient.
var _ APIClient = &Client{}