github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/worker/upgradeseries/shim.go (about) 1 // Copyright 2018 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package upgradeseries 5 6 import ( 7 "github.com/juju/names/v5" 8 9 "github.com/juju/juju/api/agent/upgradeseries" 10 "github.com/juju/juju/api/base" 11 corebase "github.com/juju/juju/core/base" 12 "github.com/juju/juju/core/model" 13 "github.com/juju/juju/core/watcher" 14 ) 15 16 // Facade exposes the API surface required by the upgrade-series worker. 17 type Facade interface { 18 // Getters 19 WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error) 20 MachineStatus() (model.UpgradeSeriesStatus, error) 21 UnitsPrepared() ([]names.UnitTag, error) 22 UnitsCompleted() ([]names.UnitTag, error) 23 24 // Setters 25 StartUnitCompletion(reason string) error 26 SetMachineStatus(status model.UpgradeSeriesStatus, reason string) error 27 FinishUpgradeSeries(corebase.Base) error 28 PinMachineApplications() (map[string]error, error) 29 UnpinMachineApplications() (map[string]error, error) 30 SetInstanceStatus(model.UpgradeSeriesStatus, string) error 31 } 32 33 // NewFacade creates a new upgrade-series client and returns its 34 // reference as the facade indirection above. 35 func NewFacade(apiCaller base.APICaller, tag names.Tag) Facade { 36 return upgradeseries.NewClient(apiCaller, tag) 37 }