github.com/argoproj/argo-cd/v3@v3.2.1/util/helm/index.go (about)

     1  package helm
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  )
     7  
     8  type Entry struct {
     9  	Version string
    10  	Created time.Time
    11  }
    12  
    13  type Entries []Entry
    14  
    15  func (es Entries) Tags() []string {
    16  	tags := make([]string, len(es))
    17  	for i, e := range es {
    18  		tags[i] = e.Version
    19  	}
    20  	return tags
    21  }
    22  
    23  type Index struct {
    24  	Entries map[string]Entries
    25  }
    26  
    27  func (i *Index) GetEntries(chart string) (Entries, error) {
    28  	entries, ok := i.Entries[chart]
    29  	if !ok {
    30  		return nil, fmt.Errorf("chart '%s' not found in index", chart)
    31  	}
    32  	return entries, nil
    33  }