github.com/Datadog/cnab-go@v0.3.3-beta1.0.20191007143216-bba4b7e723d0/bundle/outputs.go (about)

     1  package bundle
     2  
     3  type Output struct {
     4  	Definition  string   `json:"definition" yaml:"definition"`
     5  	ApplyTo     []string `json:"applyTo,omitempty" yaml:"applyTo,omitempty"`
     6  	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
     7  	Path        string   `json:"path" yaml:"path"`
     8  }
     9  
    10  // AppliesTo returns a boolean value specifying whether or not
    11  // the Output applies to the provided action
    12  func (output *Output) AppliesTo(action string) bool {
    13  	if len(output.ApplyTo) == 0 {
    14  		return true
    15  	}
    16  	for _, act := range output.ApplyTo {
    17  		if action == act {
    18  			return true
    19  		}
    20  	}
    21  	return false
    22  }