github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/util/v6manifestparser/application.go (about)

     1  package v6manifestparser
     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  	RandomRoute bool    `yaml:"random-route"`
    12  }
    13  
    14  type Application struct {
    15  	ApplicationModel
    16  	FullUnmarshalledApplication map[string]interface{}
    17  }
    18  
    19  func (application Application) MarshalYAML() (interface{}, error) {
    20  	return application.FullUnmarshalledApplication, nil
    21  }
    22  
    23  func (application *Application) UnmarshalYAML(unmarshal func(v interface{}) error) error {
    24  	err := unmarshal(&application.FullUnmarshalledApplication)
    25  	if err != nil {
    26  		return err
    27  	}
    28  	return unmarshal(&application.ApplicationModel)
    29  }
    30  
    31  type Docker struct {
    32  	Image    string `yaml:"image"`
    33  	Username string `yaml:"username"`
    34  }