interface.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package project
  2. import (
  3. "golang.org/x/net/context"
  4. "github.com/docker/libcompose/config"
  5. "github.com/docker/libcompose/project/events"
  6. "github.com/docker/libcompose/project/options"
  7. )
  8. // APIProject is an interface defining the methods a libcompose project should implement.
  9. type APIProject interface {
  10. events.Notifier
  11. events.Emitter
  12. Build(ctx context.Context, options options.Build, sevice ...string) error
  13. Create(ctx context.Context, options options.Create, services ...string) error
  14. Delete(ctx context.Context, options options.Delete, services ...string) error
  15. Down(ctx context.Context, options options.Down, services ...string) error
  16. Kill(ctx context.Context, signal string, services ...string) error
  17. Log(ctx context.Context, follow bool, services ...string) error
  18. Pause(ctx context.Context, services ...string) error
  19. Ps(ctx context.Context, onlyID bool, services ...string) (InfoSet, error)
  20. // FIXME(vdemeester) we could use nat.Port instead ?
  21. Port(ctx context.Context, index int, protocol, serviceName, privatePort string) (string, error)
  22. Pull(ctx context.Context, services ...string) error
  23. Restart(ctx context.Context, timeout int, services ...string) error
  24. Run(ctx context.Context, serviceName string, commandParts []string) (int, error)
  25. Scale(ctx context.Context, timeout int, servicesScale map[string]int) error
  26. Start(ctx context.Context, services ...string) error
  27. Stop(ctx context.Context, timeout int, services ...string) error
  28. Unpause(ctx context.Context, services ...string) error
  29. Up(ctx context.Context, options options.Up, services ...string) error
  30. Parse() error
  31. CreateService(name string) (Service, error)
  32. AddConfig(name string, config *config.ServiceConfig) error
  33. Load(bytes []byte) error
  34. }