forked from vmware-archive/fly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unpause_resource.go
35 lines (28 loc) · 887 Bytes
/
unpause_resource.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
package commands
import (
"fmt"
"github.com/concourse/fly/commands/internal/flaghelpers"
"github.com/concourse/fly/rc"
)
type UnpauseResourceCommand struct {
Resource flaghelpers.ResourceFlag `short:"r" long:"resource" required:"true" value-name:"PIPELINE/RESOURCE" description:"Name of a resource to unpause"`
}
func (command *UnpauseResourceCommand) Execute(args []string) error {
target, err := rc.LoadTarget(Fly.Target)
if err != nil {
return err
}
err = target.Validate()
if err != nil {
return err
}
found, err := target.Team().UnpauseResource(command.Resource.PipelineName, command.Resource.ResourceName)
if err != nil {
return err
}
if !found {
return fmt.Errorf("pipeline '%s' or resource '%s' not found\n", command.Resource.PipelineName, command.Resource.ResourceName)
}
fmt.Printf("unpaused '%s'\n", command.Resource.ResourceName)
return nil
}