// Rsyslog returns access to the Rsyslog API func (st *State) Rsyslog() *rsyslog.State { return rsyslog.NewState(st) }
// Manifold will depend. type ManifoldConfig util.AgentApiManifoldConfig // Manifold returns a dependency manifold that runs an rsyslog // worker, using the resource names defined in the supplied config. func Manifold(config ManifoldConfig) dependency.Manifold { return util.AgentApiManifold(util.AgentApiManifoldConfig(config), newWorker) } // newWorker exists to wrap NewRsyslogConfigWorker in a format convenient for an // AgentApiManifold. // TODO(fwereade) 2015-05-11 Eventually, the method should be the sole accessible // package factory function -- as part of the manifold -- and all tests should // thus be routed through it. var newWorker = func(agent agent.Agent, apiCaller base.APICaller) (worker.Worker, error) { agentConfig := agent.CurrentConfig() tag := agentConfig.Tag() namespace := agentConfig.Value(coreagent.Namespace) addrs, err := agentConfig.APIAddresses() if err != nil { return nil, err } return NewRsyslogConfigWorker( rsyslog.NewState(apiCaller), RsyslogModeForwarding, tag, namespace, addrs, ) }