github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/provider/manual/instance.go (about)

     1  // Copyright 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package manual
     5  
     6  import (
     7  	"github.com/juju/juju/environs/manual"
     8  	"github.com/juju/juju/instance"
     9  	"github.com/juju/juju/network"
    10  	"github.com/juju/juju/status"
    11  )
    12  
    13  type manualBootstrapInstance struct {
    14  	host string
    15  }
    16  
    17  func (manualBootstrapInstance) Id() instance.Id {
    18  	return BootstrapInstanceId
    19  }
    20  
    21  func (manualBootstrapInstance) Status() instance.InstanceStatus {
    22  	// We asume that if we are deploying in manual provider the
    23  	// underlying machine is clearly running.
    24  	return instance.InstanceStatus{
    25  		Status: status.Running,
    26  	}
    27  }
    28  
    29  func (manualBootstrapInstance) Refresh() error {
    30  	return nil
    31  }
    32  
    33  func (inst manualBootstrapInstance) Addresses() (addresses []network.Address, err error) {
    34  	addr, err := manual.HostAddress(inst.host)
    35  	if err != nil {
    36  		return nil, err
    37  	}
    38  	return []network.Address{addr}, nil
    39  }
    40  
    41  func (manualBootstrapInstance) OpenPorts(machineId string, ports []network.PortRange) error {
    42  	return nil
    43  }
    44  
    45  func (manualBootstrapInstance) ClosePorts(machineId string, ports []network.PortRange) error {
    46  	return nil
    47  }
    48  
    49  func (manualBootstrapInstance) Ports(machineId string) ([]network.PortRange, error) {
    50  	return nil, nil
    51  }