github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/apiserver/modelconfig/backend.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package modelconfig
     5  
     6  import (
     7  	"github.com/juju/juju/apiserver/common"
     8  	"github.com/juju/juju/environs/config"
     9  	"github.com/juju/juju/state"
    10  	names "gopkg.in/juju/names.v2"
    11  )
    12  
    13  // Backend contains the state.State methods used in this package,
    14  // allowing stubs to be created for testing.
    15  type Backend interface {
    16  	common.BlockGetter
    17  	ControllerTag() names.ControllerTag
    18  	ModelTag() names.ModelTag
    19  	ModelConfigValues() (config.ConfigValues, error)
    20  	UpdateModelConfig(map[string]interface{}, []string, state.ValidateConfigFunc) error
    21  }
    22  
    23  type stateShim struct {
    24  	*state.State
    25  }
    26  
    27  // NewStateBackend creates a backend for the facade to use.
    28  func NewStateBackend(st *state.State) Backend {
    29  	return stateShim{st}
    30  }