github.com/Thanhphan1147/cloudfoundry-cli@v7.1.0+incompatible/actor/pushaction/push_plan.go (about)

     1  package pushaction
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/actor/actionerror"
     5  	"code.cloudfoundry.org/cli/actor/sharedaction"
     6  	"code.cloudfoundry.org/cli/actor/v3action"
     7  )
     8  
     9  type PushPlan struct {
    10  	Application        v3action.Application
    11  	SpaceGUID          string
    12  	BitsPath           string
    13  	AllResources       []sharedaction.Resource
    14  	MatchedResources   []sharedaction.Resource
    15  	UnmatchedResources []sharedaction.Resource
    16  	Archive            bool
    17  }
    18  
    19  func (actor Actor) Conceptualize(settings CommandLineSettings, spaceGUID string) ([]PushPlan, Warnings, error) {
    20  	var (
    21  		application v3action.Application
    22  		warnings    v3action.Warnings
    23  		err         error
    24  	)
    25  
    26  	application, warnings, err = actor.V3Actor.GetApplicationByNameAndSpace(settings.Name, spaceGUID)
    27  	if _, ok := err.(actionerror.ApplicationNotFoundError); ok {
    28  		application = v3action.Application{
    29  			Name: settings.Name,
    30  		}
    31  	} else if err != nil {
    32  		return nil, Warnings(warnings), err
    33  	}
    34  
    35  	bitsPath := settings.CurrentDirectory
    36  	if settings.ProvidedAppPath != "" {
    37  		bitsPath = settings.ProvidedAppPath
    38  	}
    39  
    40  	resources, err := actor.SharedActor.GatherDirectoryResources(bitsPath)
    41  
    42  	desiredState := []PushPlan{
    43  		{
    44  			Application:  application,
    45  			SpaceGUID:    spaceGUID,
    46  			BitsPath:     bitsPath,
    47  			AllResources: resources,
    48  		},
    49  	}
    50  	return desiredState, Warnings(warnings), err
    51  }