// 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), facade: facadeCaller} }
// newStateForVersion creates a new client-side Uniter facade for the // given version. func newStateForVersion( caller base.APICaller, authTag names.UnitTag, version int, ) *State { facadeCaller := base.NewFacadeCallerForVersion( caller, uniterFacade, version, ) state := &State{ ModelWatcher: common.NewModelWatcher(facadeCaller), APIAddresser: common.NewAPIAddresser(facadeCaller), StorageAccessor: NewStorageAccessor(facadeCaller), facade: facadeCaller, unitTag: authTag, } newWatcher := func(result params.NotifyWatchResult) watcher.NotifyWatcher { return apiwatcher.NewNotifyWatcher(caller, result) } state.LeadershipSettings = NewLeadershipSettingsAccessor( facadeCaller.FacadeCall, newWatcher, ErrIfNotVersionFn(2, state.BestAPIVersion()), ) return state }
// NewState creates a new client-side Firewaller API facade. func NewState(caller base.APICaller) *State { facadeCaller := base.NewFacadeCaller(caller, firewallerFacade) return &State{ facade: facadeCaller, ModelWatcher: common.NewModelWatcher(facadeCaller), } }
// 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), } }
// NewAPI creates a new client-side InstancePoller facade. func NewAPI(caller base.APICaller) *API { if caller == nil { panic("caller is nil") } facadeCaller := base.NewFacadeCaller(caller, instancePollerFacade) return &API{ ModelWatcher: common.NewModelWatcher(facadeCaller), facade: facadeCaller, } }
// NewState creates a new client-side StorageProvisioner facade. func NewState(caller base.APICaller, scope names.Tag) (*State, error) { switch scope.(type) { case names.ModelTag: case names.MachineTag: default: return nil, errors.Errorf("expected ModelTag or MachineTag, got %T", scope) } facadeCaller := base.NewFacadeCaller(caller, storageProvisionerFacade) return &State{ facadeCaller, scope, common.NewModelWatcher(facadeCaller), }, nil }
// NewFacade returns a new api client facade instance. func NewFacade(caller base.APICaller) *Facade { facadeCaller := base.NewFacadeCaller(caller, apiName) return &Facade{ ModelWatcher: common.NewModelWatcher(facadeCaller), } }