github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20240130060226-cda5ed8e89a5+incompatible/util/manifestparser/application.go (about)

     1  package manifestparser
     2  
     3  // ApplicationModel can be accessed through the top level Application struct To
     4  // add a field for the CLI to extract from the manifest, just add it to this
     5  // struct.
     6  type ApplicationModel struct {
     7  	Name    string  `yaml:"name"`
     8  	Docker  *Docker `yaml:"docker"`
     9  	Path    string  `yaml:"path"`
    10  	NoRoute bool    `yaml:"no-route"`
    11  }
    12  
    13  type Application struct {
    14  	ApplicationModel
    15  	FullUnmarshalledApplication map[string]interface{}
    16  }
    17  
    18  func (application Application) MarshalYAML() (interface{}, error) {
    19  	return application.FullUnmarshalledApplication, nil
    20  }
    21  
    22  func (application *Application) UnmarshalYAML(unmarshal func(v interface{}) error) error {
    23  	err := unmarshal(&application.FullUnmarshalledApplication)
    24  	if err != nil {
    25  		return err
    26  	}
    27  	return unmarshal(&application.ApplicationModel)
    28  }
    29  
    30  type Docker struct {
    31  	Image    string `yaml:"image"`
    32  	Username string `yaml:"username"`
    33  }