github.com/cloudfoundry/cli@v7.1.0+incompatible/actor/v2v3action/manifest.go (about)

     1  package v2v3action
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/actor/v2action"
     5  	"code.cloudfoundry.org/cli/actor/v3action"
     6  	"code.cloudfoundry.org/cli/util/manifest"
     7  )
     8  
     9  type ManifestV2Actor interface {
    10  	CreateApplicationManifestByNameAndSpace(string, string) (manifest.Application, v2action.Warnings, error)
    11  }
    12  
    13  type ManifestV3Actor interface {
    14  	GetApplicationByNameAndSpace(string, string) (v3action.Application, v3action.Warnings, error)
    15  }
    16  
    17  func (actor *Actor) CreateApplicationManifestByNameAndSpace(appName string, appSpace string) (manifest.Application, Warnings, error) {
    18  	var allWarnings Warnings
    19  
    20  	manifestApp, v2warnings, err := actor.V2Actor.CreateApplicationManifestByNameAndSpace(appName, appSpace)
    21  	allWarnings = append(allWarnings, v2warnings...)
    22  	if err != nil {
    23  		return manifest.Application{}, allWarnings, err
    24  	}
    25  
    26  	v3App, v3warnings, v3Err := actor.V3Actor.GetApplicationByNameAndSpace(appName, appSpace)
    27  	allWarnings = append(allWarnings, v3warnings...)
    28  	if v3Err != nil {
    29  		return manifest.Application{}, allWarnings, v3Err
    30  	}
    31  
    32  	manifestApp.Buildpacks = v3App.LifecycleBuildpacks
    33  
    34  	return manifestApp, allWarnings, err
    35  }
    36  
    37  func (Actor) WriteApplicationManifest(manifestApp manifest.Application, manifestPath string) error {
    38  	return manifest.WriteApplicationManifest(manifestApp, manifestPath)
    39  }