github.com/grahambrereton-form3/tilt@v0.10.18/internal/docker/exploding.go (about) 1 package docker 2 3 import ( 4 "context" 5 "io" 6 7 "github.com/docker/distribution/reference" 8 "github.com/docker/docker/api/types" 9 "github.com/docker/docker/api/types/filters" 10 11 "github.com/windmilleng/tilt/internal/container" 12 "github.com/windmilleng/tilt/pkg/model" 13 ) 14 15 // A docker client that returns errors on every method call. 16 // Useful when the client failed to init, but we don't have enough 17 // info at init time to tell if anyone is going to use it. 18 19 type explodingClient struct { 20 err error 21 } 22 23 func newExplodingClient(err error) explodingClient { 24 return explodingClient{err: err} 25 } 26 27 func (c explodingClient) SetOrchestrator(orc model.Orchestrator) { 28 } 29 func (c explodingClient) CheckConnected() error { 30 return c.err 31 } 32 func (c explodingClient) Env() Env { 33 return Env{} 34 } 35 func (c explodingClient) BuilderVersion() types.BuilderVersion { 36 return types.BuilderVersion("") 37 } 38 func (c explodingClient) ServerVersion() types.Version { 39 return types.Version{} 40 } 41 func (c explodingClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) { 42 return nil, c.err 43 } 44 func (c explodingClient) ContainerRestartNoWait(ctx context.Context, containerID string) error { 45 return c.err 46 } 47 func (c explodingClient) CopyToContainerRoot(ctx context.Context, container string, content io.Reader) error { 48 return c.err 49 } 50 func (c explodingClient) ExecInContainer(ctx context.Context, cID container.ID, cmd model.Cmd, out io.Writer) error { 51 return c.err 52 } 53 func (c explodingClient) ImagePush(ctx context.Context, ref reference.NamedTagged) (io.ReadCloser, error) { 54 return nil, c.err 55 } 56 func (c explodingClient) ImageBuild(ctx context.Context, buildContext io.Reader, options BuildOptions) (types.ImageBuildResponse, error) { 57 return types.ImageBuildResponse{}, c.err 58 } 59 func (c explodingClient) ImageTag(ctx context.Context, source, target string) error { 60 return c.err 61 } 62 func (c explodingClient) ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error) { 63 return types.ImageInspect{}, nil, c.err 64 } 65 func (c explodingClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) { 66 return nil, c.err 67 } 68 func (c explodingClient) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) { 69 return nil, c.err 70 } 71 func (c explodingClient) NewVersionError(APIrequired, feature string) error { 72 return c.err 73 } 74 func (c explodingClient) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) { 75 return nil, c.err 76 } 77 func (c explodingClient) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error) { 78 return types.ContainersPruneReport{}, c.err 79 } 80 81 var _ Client = &explodingClient{}