github.com/Pankov404/juju@v0.0.0-20150703034450-be266991dceb/state/leadership/config.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package leadership
     5  
     6  import (
     7  	"github.com/juju/errors"
     8  
     9  	"github.com/juju/juju/state/lease"
    10  )
    11  
    12  // ManagerConfig contains the resources and information required to create a
    13  // Manager.
    14  type ManagerConfig struct {
    15  	Client lease.Client
    16  	Clock  lease.Clock
    17  }
    18  
    19  // Validate returns an error if the configuration contains invalid information
    20  // or missing resources.
    21  func (config ManagerConfig) Validate() error {
    22  	if config.Client == nil {
    23  		return errors.New("missing client")
    24  	}
    25  	if config.Clock == nil {
    26  		return errors.New("missing clock")
    27  	}
    28  	return nil
    29  }