github.com/billybanfield/evergreen@v0.0.0-20170525200750-eeee692790f7/model/artifact/artifact_file.go (about)

     1  package artifact
     2  
     3  const Collection = "artifact_files"
     4  
     5  const (
     6  	// strings for setting visibility
     7  	Public  = "public"
     8  	Private = "private"
     9  	None    = "none"
    10  )
    11  
    12  var ValidVisibilities = []string{Public, Private, None, ""}
    13  
    14  // Entry stores groups of names and links (not content!) for
    15  // files uploaded to the api server by a running agent. These links could
    16  // be for build or task-relevant files (things like extra results,
    17  // test coverage, etc.)
    18  type Entry struct {
    19  	TaskId          string `json:"task" bson:"task"`
    20  	TaskDisplayName string `json:"task_name" bson:"task_name"`
    21  	BuildId         string `json:"build" bson:"build"`
    22  	Files           []File `json:"files" bson:"files"`
    23  }
    24  
    25  // Params stores file entries as key-value pairs, for easy parameter parsing.
    26  //  Key = Human-readable name for file
    27  //  Value = link for the file
    28  type Params map[string]string
    29  
    30  // File is a pairing of name and link for easy storage/display
    31  type File struct {
    32  	// Name is a human-readable name for the file being linked, e.g. "Coverage Report"
    33  	Name string `json:"name" bson:"name"`
    34  	// Link is the link to the file, e.g. "http://fileserver/coverage.html"
    35  	Link string `json:"link" bson:"link"`
    36  	// Visibility determines who can see the file in the UI
    37  	Visibility string `json:"visibility" bson:"visibility"`
    38  }
    39  
    40  // Array turns the parameter map into an array of File structs.
    41  // Deprecated.
    42  func (params Params) Array() []File {
    43  	var files []File
    44  	for name, link := range params {
    45  		files = append(files, File{name, link, ""})
    46  	}
    47  	return files
    48  }