github.com/rogpeppe/juju@v0.0.0-20140613142852-6337964b789e/juju/export_test.go (about)

     1  package juju
     2  
     3  import (
     4  	"github.com/juju/juju/environs/configstore"
     5  	"github.com/juju/juju/state/api"
     6  )
     7  
     8  var (
     9  	ProviderConnectDelay = &providerConnectDelay
    10  	GetConfig            = getConfig
    11  )
    12  
    13  type APIState apiState
    14  
    15  type APIOpenFunc func(*api.Info, api.DialOpts) (APIState, error)
    16  
    17  func NewAPIFromStore(envName string, store configstore.Storage, f APIOpenFunc) (APIState, error) {
    18  	apiOpen := func(info *api.Info, opts api.DialOpts) (apiState, error) {
    19  		return f(info, opts)
    20  	}
    21  	return newAPIFromStore(envName, store, apiOpen)
    22  }
    23  
    24  func APIEndpointInStore(envName string, refresh bool, store configstore.Storage, f APIOpenFunc) (configstore.APIEndpoint, error) {
    25  	apiOpen := func(info *api.Info, opts api.DialOpts) (apiState, error) {
    26  		return f(info, opts)
    27  	}
    28  	return apiEndpointInStore(envName, refresh, store, apiOpen)
    29  }