github.com/jcarley/cli@v0.0.0-20180201210820-966d90434c30/lib/jobs/contract.go (about)

     1  package jobs
     2  
     3  import "github.com/daticahealth/cli/models"
     4  
     5  // IJobs
     6  type IJobs interface {
     7  	Delete(jobID, svcID string) error
     8  	Deploy(redeploy bool, releaseName, target, svcID string) error
     9  	DeployRelease(releaseName, svcID string) error
    10  	DeployTarget(target, svcID string) error
    11  	Redeploy(svcID string) error
    12  	Retrieve(jobID, svcID string, includeSpec bool) (*models.Job, error)
    13  	RetrieveByStatus(svcID, status string) (*[]models.Job, error)
    14  	RetrieveByType(svcID, jobType string, page, pageSize int) (*[]models.Job, error)
    15  	RetrieveByTarget(svcID, target string, page, pageSize int) (*[]models.Job, error)
    16  	PollForStatus(statuses []string, jobID, svcID string) (string, error)
    17  	PollTillFinished(jobID, svcID string) (string, error)
    18  	List(svcID string, page, pageSize int) (*[]models.Job, error)
    19  	WaitToAppear(jobID, svcID string) error
    20  }
    21  
    22  // SJobs is a concrete implementation of IJobs
    23  type SJobs struct {
    24  	Settings *models.Settings
    25  }
    26  
    27  // New returns an instance of IJobs
    28  func New(settings *models.Settings) IJobs {
    29  	return &SJobs{
    30  		Settings: settings,
    31  	}
    32  }