github.com/mhilton/juju-juju@v0.0.0-20150901100907-a94dd2c73455/worker/proxyupdater/manifold.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package proxyupdater
     5  
     6  import (
     7  	"github.com/juju/juju/api/base"
     8  	"github.com/juju/juju/api/environment"
     9  	"github.com/juju/juju/worker"
    10  	"github.com/juju/juju/worker/dependency"
    11  	"github.com/juju/juju/worker/util"
    12  )
    13  
    14  // ManifoldConfig defines the names of the manifolds on which a Manifold will depend.
    15  type ManifoldConfig util.ApiManifoldConfig
    16  
    17  // Manifold returns a dependency manifold that runs a proxy updater worker,
    18  // using the api connection resource named in the supplied config.
    19  func Manifold(config ManifoldConfig) dependency.Manifold {
    20  	return util.ApiManifold(util.ApiManifoldConfig(config), newWorker)
    21  }
    22  
    23  // newWorker is not currently tested; it should eventually replace New as the
    24  // package's exposed factory func, and then all tests should pass through it.
    25  func newWorker(apiCaller base.APICaller) (worker.Worker, error) {
    26  	// TODO(fwereade): This shouldn't be an "environment" facade, it
    27  	// should be specific to the proxyupdater, and be watching for
    28  	// *proxy settings* changes, not just watching the "environment".
    29  	return New(environment.NewFacade(apiCaller), false), nil
    30  }