github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/environs/broker.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package environs 5 6 import ( 7 "launchpad.net/juju-core/constraints" 8 "launchpad.net/juju-core/environs/cloudinit" 9 "launchpad.net/juju-core/instance" 10 "launchpad.net/juju-core/tools" 11 ) 12 13 // TODO(wallyworld) - we want this in the environs/instance package but import loops 14 // stop that from being possible right now. 15 type InstanceBroker interface { 16 // StartInstance asks for a new instance to be created, associated with 17 // the provided config in machineConfig. The given config describes the juju 18 // state for the new instance to connect to. The config MachineNonce, which must be 19 // unique within an environment, is used by juju to protect against the 20 // consequences of multiple instances being started with the same machine 21 // id. 22 StartInstance( 23 cons constraints.Value, possibleTools tools.List, 24 machineConfig *cloudinit.MachineConfig, 25 ) (instance.Instance, *instance.HardwareCharacteristics, error) 26 27 // StopInstances shuts down the given instances. 28 StopInstances([]instance.Instance) error 29 30 // AllInstances returns all instances currently known to the broker. 31 AllInstances() ([]instance.Instance, error) 32 }