26 lines
552 B
Go
26 lines
552 B
Go
// Definition fetcher
|
|
//
|
|
// Handles fetching and building ServiceDefinition structs from different
|
|
// data sources.
|
|
|
|
package service_definition
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type DefinitionFetcher interface {
|
|
GetDefinition(path string) (ServiceDefinition, error)
|
|
}
|
|
|
|
func NewDefinitionFetcher(fetcher_type string) (DefinitionFetcher, error) {
|
|
if fetcher_type == "git" {
|
|
return NewGitDefinitionFetcher(), nil
|
|
}
|
|
|
|
if fetcher_type == "file" {
|
|
return NewFileDefinitionFetcher(), nil
|
|
}
|
|
|
|
return nil, fmt.Errorf("Unrecognized fetcher type: %s", fetcher_type)
|
|
}
|