github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/facades/agent/proxyupdater/shims.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package proxyupdater
     5  
     6  import (
     7  	"github.com/juju/juju/environs/config"
     8  	"github.com/juju/juju/network"
     9  	"github.com/juju/juju/state"
    10  )
    11  
    12  // stateShim forwards and adapts state.State methods to Backend
    13  // TODO - CAAS(ericclaudejones): This should contain state alone, model will be
    14  // removed once all relevant methods are moved from state to model.
    15  type stateShim struct {
    16  	st *state.State
    17  	m  *state.Model
    18  }
    19  
    20  func (s *stateShim) ModelConfig() (*config.Config, error) {
    21  	return s.m.ModelConfig()
    22  }
    23  
    24  func (s *stateShim) APIHostPortsForAgents() ([][]network.HostPort, error) {
    25  	return s.st.APIHostPortsForAgents()
    26  }
    27  
    28  func (s *stateShim) WatchAPIHostPortsForAgents() state.NotifyWatcher {
    29  	return s.st.WatchAPIHostPortsForAgents()
    30  }
    31  
    32  func (s *stateShim) WatchForModelConfigChanges() state.NotifyWatcher {
    33  	return s.m.WatchForModelConfigChanges()
    34  }