github.com/chenbh/concourse/v6@v6.4.2/worker/land/land_runner.go (about)

     1  package land
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  
     7  	"code.cloudfoundry.org/lager"
     8  	"code.cloudfoundry.org/lager/lagerctx"
     9  	"github.com/chenbh/concourse/v6/atc"
    10  	"github.com/chenbh/concourse/v6/worker"
    11  )
    12  
    13  type LandWorkerCommand struct {
    14  	TSA worker.TSAConfig `group:"TSA Configuration" namespace:"tsa" required:"true"`
    15  
    16  	WorkerName string `long:"name" required:"true" description:"The name of the worker you wish to land."`
    17  }
    18  
    19  func (cmd *LandWorkerCommand) Execute(args []string) error {
    20  	logger := lager.NewLogger("land-worker")
    21  	logger.RegisterSink(lager.NewPrettySink(os.Stdout, lager.DEBUG))
    22  
    23  	client := cmd.TSA.Client(atc.Worker{
    24  		Name: cmd.WorkerName,
    25  	})
    26  
    27  	return client.Land(lagerctx.NewContext(context.Background(), logger))
    28  }