func (p *ProxyConfWrapper) UnmarshalYAML(unmarshal func(interface{}) error) error {
	factory, err := NewProxierFactory()
	if err != nil {
		return errors.Annotate(err, "building proxy factory for config")
	}

	proxyConf := struct {
		Type   string    `yaml:"type"`
		Config yaml.Node `yaml:"config"`
	}{}

	err = unmarshal(&proxyConf)
	if err != nil {
		return errors.Annotate(err, "unmarshalling raw proxy config")
	}

	maker, err := factory.MakerForTypeKey(proxyConf.Type)
	if err != nil {
		return errors.Trace(err)
	}

	if err = proxyConf.Config.Decode(maker.Config()); err != nil {
		return errors.Annotatef(err, "decoding config for proxy of type %s", proxyConf.Type)
	}

	p.Proxier, err = maker.Make()
	if err != nil {
		return errors.Annotatef(err, "making proxier for type %s", proxyConf.Type)
	}

	return nil
}
// UnmarshalYAML ingests a previously outputted proxy config. It uses the proxy
// default factory to try and construct the correct proxy based on type.
UnmarshalYAML ingests a previously outputted proxy config. It uses the proxy
default factory to try and construct the correct proxy based on type.
// UnmarshalYAML ingests a previously outputted proxy config . It uses the proxy // default factory to try and construct the correct proxy based on type .
func (p *ProxyConfWrapper) UnmarshalYAML(unmarshal func(interface{}) error) error {
	factory, err := NewProxierFactory()
	if err != nil {
		return errors.Annotate(err, "building proxy factory for config")
	}
	proxyConf := struct {
		Type   string    `yaml:"type"`
		Config yaml.Node `yaml:"config"`
	}{}
	err = unmarshal(&proxyConf)
	if err != nil {
		return errors.Annotate(err, "unmarshalling raw proxy config")
	}
	maker, err := factory.MakerForTypeKey(proxyConf.Type)
	if err != nil {
		return errors.Trace(err)
	}
	if err = proxyConf.Config.Decode(maker.Config()); err != nil {
		return errors.Annotatef(err, "decoding config for proxy of type %s", proxyConf.Type)
	}
	p.Proxier, err = maker.Make()
	if err != nil {
		return errors.Annotatef(err, "making proxier for type %s", proxyConf.Type)
	}
	return nil
}
func ( p * ProxyConfWrapper ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error { factory , err := NewProxierFactory ( ) if err != nil { return errors . Annotate ( err , " " ) } proxyConf := struct { Type string `yaml:"type"` Config yaml . Node `yaml:"config"` } { } err = unmarshal ( & proxyConf ) if err != nil { return errors . Annotate ( err , " " ) } maker , err := factory . MakerForTypeKey ( proxyConf . Type ) if err != nil { return errors . Trace ( err ) } if err = proxyConf . Config . Decode ( maker . Config ( ) ) ; err != nil { return errors . Annotatef ( err , " " , proxyConf . Type ) } p . Proxier , err = maker . Make ( ) if err != nil { return errors . Annotatef ( err , " " , proxyConf . Type ) } return nil }
UnmarshalYAML ingests a previously outputted proxy config.
UnmarshalYAML ingests a previously outputted proxy config .