github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/resource/resourceadapters/workers.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package resourceadapters
     5  
     6  import (
     7  	"github.com/juju/errors"
     8  
     9  	"github.com/juju/juju/apiserver/charmrevisionupdater"
    10  	"github.com/juju/juju/resource/workers"
    11  	"github.com/juju/juju/state"
    12  )
    13  
    14  // NewLatestCharmHandler returns a LatestCharmHandler that uses the
    15  // given Juju state.
    16  func NewLatestCharmHandler(st *state.State) (charmrevisionupdater.LatestCharmHandler, error) {
    17  	resources, err := st.Resources()
    18  	if err != nil {
    19  		return nil, errors.Trace(err)
    20  	}
    21  	handler := workers.NewLatestCharmHandler(resources)
    22  	return handler, nil
    23  }