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