github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/creds/source.go (about)

     1  package creds
     2  
     3  import (
     4  	"github.com/pf-qiu/concourse/v6/atc"
     5  	"github.com/pf-qiu/concourse/v6/vars"
     6  )
     7  
     8  type Source struct {
     9  	variablesResolver vars.Variables
    10  	rawSource         atc.Source
    11  }
    12  
    13  func NewSource(variables vars.Variables, source atc.Source) Source {
    14  	return Source{
    15  		variablesResolver: variables,
    16  		rawSource:         source,
    17  	}
    18  }
    19  
    20  func (s Source) Evaluate() (atc.Source, error) {
    21  	var source atc.Source
    22  	err := evaluate(s.variablesResolver, s.rawSource, &source)
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  
    27  	return source, nil
    28  }