github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/apiserver/machineundertaker/backend.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package machineundertaker
     5  
     6  import (
     7  	"github.com/juju/juju/network"
     8  	"github.com/juju/juju/state"
     9  )
    10  
    11  // Backend defines the methods the machine undertaker needs from
    12  // state.State.
    13  type Backend interface {
    14  	// AllRemovedMachines returns all of the machines which have been
    15  	// marked for removal.
    16  	AllMachineRemovals() ([]string, error)
    17  
    18  	// CompleteMachineRemovals removes the machines (and the associated removal
    19  	// requests) after the provider-level cleanup is done.
    20  	CompleteMachineRemovals(machineIDs ...string) error
    21  
    22  	// WatchMachineRemovals returns a NotifyWatcher that triggers
    23  	// whenever machine removal requests are added or removed.
    24  	WatchMachineRemovals() state.NotifyWatcher
    25  
    26  	// Machine gets a specific machine, so we can collect details of
    27  	// its network interfaces.
    28  	Machine(id string) (Machine, error)
    29  }
    30  
    31  // Machine defines the methods we need from state.Machine.
    32  type Machine interface {
    33  	// AllProviderInterfaceInfos returns the details needed to talk to
    34  	// the provider about this machine's attached devices.
    35  	AllProviderInterfaceInfos() ([]network.ProviderInterfaceInfo, error)
    36  }
    37  
    38  type backendShim struct {
    39  	*state.State
    40  }
    41  
    42  // Machine implements Machine.
    43  func (b *backendShim) Machine(id string) (Machine, error) {
    44  	return b.State.Machine(id)
    45  }