source.go raw

   1  package data
   2  
   3  // Config is a flat mapping where values are simple (no slices/maps).
   4  type Config map[string]interface{}
   5  
   6  // Source wraps an NS1 /data/sources resource
   7  type Source struct {
   8  	ID string `json:"id,omitempty"`
   9  
  10  	// Human readable name of the source.
  11  	Name string `json:"name"`
  12  
  13  	Type   string `json:"sourcetype"`
  14  	Config Config `json:"config,omitempty"`
  15  	Status string `json:"status,omitempty"`
  16  
  17  	Feeds []*Feed `json:"feeds,omitempty"`
  18  }
  19  
  20  // NewSource takes a name and type t.
  21  func NewSource(name string, t string) *Source {
  22  	return &Source{
  23  		Name:   name,
  24  		Type:   t,
  25  		Config: Config{},
  26  		Feeds:  []*Feed{},
  27  	}
  28  }
  29