360
361
// UnmarshalYAML loads the state of a generic connection from parsed YAML
362
>
func (c *connection) UnmarshalYAML(n *yaml.Node) error {
config.go
363
>
type conn connection
364
>
type overlay struct {
365
>
*conn `yaml:",inline"`
366
>
Spec yaml.Node `yaml:"spec"`
367
>
}
368
>
obj := overlay{conn: (*conn)(c)}
369
>
err := n.Decode(&obj)
370
>
if err != nil {
371
return err
372
}
374
>
case "grpc":
375
>
c.Spec = &grpcconn{}
376
default:
377
return fmt.Errorf("unsupported connection kind: %q", c.Kind)
378
}
379
>
return obj.Spec.Decode(c.Spec)
config.go
380
}
381