示例#1
0
文件: oem.go 项目: giantswarm/mayu
	return c.name
}

func (c Config) Flags() map[string]string {
	return c.flags
}

func (c Config) Provider() providers.ProviderCreator {
	return c.provider
}

func (c Config) Config() types.Config {
	return c.config
}

var configs = registry.Create("oem configs")

func init() {
	configs.Register(Config{
		name:     "azure",
		provider: azure.Creator{},
	})
	configs.Register(Config{
		name:     "cloudsigma",
		provider: noop.Creator{},
	})
	configs.Register(Config{
		name:     "cloudstack",
		provider: noop.Creator{},
	})
	configs.Register(Config{
示例#2
0
)

// Stage is responsible for actually executing a stage of the configuration.
type Stage interface {
	Run(config types.Config) bool
	Name() string
}

// StageCreator is responsible for instantiating a particular stage given a
// logger and root path under the root partition.
type StageCreator interface {
	Create(logger *log.Logger, root string) Stage
	Name() string
}

var stages = registry.Create("stages")

func Register(stage StageCreator) {
	stages.Register(stage)
}

func Get(name string) StageCreator {
	if s, ok := stages.Get(name).(StageCreator); ok {
		return s
	}
	return nil
}

func Names() (names []string) {
	return stages.Names()
}