Merge "Add Plan Status() to ifc.plan interface"
This commit is contained in:
commit
ed271774f6
@ -280,6 +280,20 @@ func (p *plan) Run(ro ifc.RunOptions) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Status returns the status of phases in a given plan
|
||||||
|
func (p *plan) Status(options ifc.StatusOptions) (ifc.PlanStatus, error) {
|
||||||
|
for _, step := range p.apiObj.Phases {
|
||||||
|
phase, err := p.phaseClient.PhaseByID(ifc.ID{Name: step.Name})
|
||||||
|
if err != nil {
|
||||||
|
return ifc.PlanStatus{}, err
|
||||||
|
}
|
||||||
|
if _, err = phase.Status(); err != nil {
|
||||||
|
return ifc.PlanStatus{}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ifc.PlanStatus{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
var _ ifc.Client = &client{}
|
var _ ifc.Client = &client{}
|
||||||
|
|
||||||
type client struct {
|
type client struct {
|
||||||
|
@ -41,8 +41,15 @@ type PhaseStatus struct {
|
|||||||
type Plan interface {
|
type Plan interface {
|
||||||
Validate() error
|
Validate() error
|
||||||
Run(RunOptions) error
|
Run(RunOptions) error
|
||||||
|
Status(StatusOptions) (PlanStatus, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StatusOptions is used to define status options
|
||||||
|
type StatusOptions struct{}
|
||||||
|
|
||||||
|
// PlanStatus is a struct which defines status of PLAN
|
||||||
|
type PlanStatus struct{}
|
||||||
|
|
||||||
// ID uniquely identifies the phase
|
// ID uniquely identifies the phase
|
||||||
type ID struct {
|
type ID struct {
|
||||||
Name string
|
Name string
|
||||||
|
Loading…
Reference in New Issue
Block a user