forked from vmware-archive/fly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pause_pipeline.go
40 lines (31 loc) · 825 Bytes
/
pause_pipeline.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package commands
import (
"fmt"
"github.com/concourse/fly/commands/internal/displayhelpers"
"github.com/concourse/fly/commands/internal/flaghelpers"
"github.com/concourse/fly/rc"
)
type PausePipelineCommand struct {
Pipeline flaghelpers.PipelineFlag `short:"p" long:"pipeline" required:"true" description:"Pipeline to pause"`
}
func (command *PausePipelineCommand) Execute(args []string) error {
pipelineName := string(command.Pipeline)
target, err := rc.LoadTarget(Fly.Target)
if err != nil {
return err
}
err = target.Validate()
if err != nil {
return err
}
found, err := target.Team().PausePipeline(pipelineName)
if err != nil {
return err
}
if found {
fmt.Printf("paused '%s'\n", pipelineName)
} else {
displayhelpers.Failf("pipeline '%s' not found\n", pipelineName)
}
return nil
}