// NewState returns a version of the state that provides functionality // required by agent code. func NewState(caller base.APICaller) *State { facadeCaller := base.NewFacadeCaller(caller, "Agent") return &State{ facade: facadeCaller, ModelWatcher: common.NewModelWatcher(facadeCaller), CloudSpecAPI: cloudspec.NewCloudSpecAPI(facadeCaller), ControllerConfigAPI: common.NewControllerConfig(facadeCaller), } }
// NewState creates a new client-side Machiner facade. func NewState(caller base.APICaller) *State { facadeCaller := base.NewFacadeCaller(caller, provisionerFacade) return &State{ ModelWatcher: common.NewModelWatcher(facadeCaller), APIAddresser: common.NewAPIAddresser(facadeCaller), ControllerConfigAPI: common.NewControllerConfig(facadeCaller), facade: facadeCaller, } }
// NewClient creates a new `Client` based on an existing authenticated API // connection. func NewClient(st base.APICallCloser) *Client { frontend, backend := base.NewClientFacade(st, "Controller") return &Client{ ClientFacade: frontend, facade: backend, ControllerConfigAPI: common.NewControllerConfig(backend), CloudSpecAPI: cloudspec.NewCloudSpecAPI(backend), } }