github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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  	"gopkg.in/juju/names.v2"
     8  
     9  	"github.com/juju/juju/api/base"
    10  	"github.com/juju/juju/api/upgradeseries"
    11  	"github.com/juju/juju/core/model"
    12  	"github.com/juju/juju/core/watcher"
    13  )
    14  
    15  // Facade exposes the API surface required by the upgrade-series worker.
    16  type Facade interface {
    17  	// Getters
    18  	WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error)
    19  	MachineStatus() (model.UpgradeSeriesStatus, error)
    20  	UnitsPrepared() ([]names.UnitTag, error)
    21  	UnitsCompleted() ([]names.UnitTag, error)
    22  	TargetSeries() (string, error)
    23  
    24  	// Setters
    25  	StartUnitCompletion(reason string) error
    26  	SetMachineStatus(status model.UpgradeSeriesStatus, reason string) error
    27  	FinishUpgradeSeries(string) error
    28  	PinMachineApplications() (map[string]error, error)
    29  	UnpinMachineApplications() (map[string]error, error)
    30  }
    31  
    32  // NewFacade creates a *upgradeseries.Client and returns it as a Facade.
    33  func NewFacade(apiCaller base.APICaller, tag names.Tag) Facade {
    34  	return upgradeseries.NewClient(apiCaller, tag)
    35  }