github.com/chenbh/concourse/v6@v6.4.2/fly/commands/unpin_resource.go (about) 1 package commands 2 3 import ( 4 "fmt" 5 6 "github.com/chenbh/concourse/v6/fly/commands/internal/displayhelpers" 7 "github.com/chenbh/concourse/v6/fly/commands/internal/flaghelpers" 8 "github.com/chenbh/concourse/v6/fly/rc" 9 ) 10 11 type UnpinResourceCommand struct { 12 Resource flaghelpers.ResourceFlag `short:"r" long:"resource" required:"true" value-name:"PIPELINE/RESOURCE" description:"Name of the resource"` 13 } 14 15 func (command *UnpinResourceCommand) Execute([]string) error { 16 target, err := rc.LoadTarget(Fly.Target, Fly.Verbose) 17 if err != nil { 18 return err 19 } 20 21 err = target.Validate() 22 if err != nil { 23 return err 24 } 25 26 team := target.Team() 27 28 unpinned, err := team.UnpinResource(command.Resource.PipelineName, command.Resource.ResourceName) 29 if err != nil { 30 return err 31 } 32 33 if unpinned { 34 fmt.Printf("unpinned '%s/%s'\n", command.Resource.PipelineName, command.Resource.ResourceName) 35 } else { 36 displayhelpers.Failf("could not find resource '%s/%s'\n", command.Resource.PipelineName, command.Resource.ResourceName) 37 } 38 39 return nil 40 }