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

     1  package v7pushaction
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"code.cloudfoundry.org/cli/actor/v2action"
     7  )
     8  
     9  type Application struct {
    10  	v2action.Application
    11  	Buildpacks []string
    12  	Stack      v2action.Stack
    13  }
    14  
    15  // CalculatedBuildpacks will return back the buildpacks for the application.
    16  func (app Application) CalculatedBuildpacks() []string {
    17  	buildpack := app.CalculatedBuildpack()
    18  	switch {
    19  	case app.Buildpacks != nil:
    20  		return app.Buildpacks
    21  	case len(buildpack) > 0:
    22  		return []string{buildpack}
    23  	default:
    24  		return nil
    25  	}
    26  }
    27  
    28  func (app Application) String() string {
    29  	return fmt.Sprintf("%s, Stack Name: '%s', Buildpacks: %s", app.Application, app.Stack.Name, app.Buildpacks)
    30  }
    31  
    32  func (app *Application) SetStack(stack v2action.Stack) {
    33  	app.Stack = stack
    34  	app.StackGUID = stack.GUID
    35  }