github.com/nimakaviani/cli@v6.37.1-0.20180619223813-e734901a73fa+incompatible/actor/pushaction/actualize.go (about) 1 package pushaction 2 3 import ( 4 log "github.com/sirupsen/logrus" 5 ) 6 7 func (actor Actor) Actualize(state PushState, progressBar ProgressBar) ( 8 <-chan PushState, <-chan Event, <-chan Warnings, <-chan error, 9 ) { 10 stateStream := make(chan PushState) 11 eventStream := make(chan Event) 12 warningsStream := make(chan Warnings) 13 errorStream := make(chan error) 14 15 go func() { 16 log.Debug("starting actualize go routine") 17 defer close(stateStream) 18 defer close(eventStream) 19 defer close(warningsStream) 20 defer close(errorStream) 21 22 if state.Application.GUID != "" { 23 log.WithField("Name", state.Application.Name).Info("skipping app creation as it has a GUID") 24 eventStream <- SkipingApplicationCreation 25 } else { 26 log.WithField("Name", state.Application.Name).Info("creating app") 27 createdApp, createWarnings, err := actor.V3Actor.CreateApplicationInSpace(state.Application, state.SpaceGUID) 28 warningsStream <- Warnings(createWarnings) 29 if err != nil { 30 errorStream <- err 31 return 32 } 33 34 state.Application = createdApp 35 eventStream <- CreatedApplication 36 } 37 38 stateStream <- state 39 40 log.Debug("completed apply") 41 eventStream <- Complete 42 }() 43 return stateStream, eventStream, warningsStream, errorStream 44 }