github.com/rogpeppe/juju@v0.0.0-20140613142852-6337964b789e/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  )
    11  
    12  type manualBootstrapInstance struct {
    13  	host string
    14  }
    15  
    16  func (manualBootstrapInstance) Id() instance.Id {
    17  	// The only way to bootrap is via manual bootstrap.
    18  	return manual.BootstrapInstanceId
    19  }
    20  
    21  func (manualBootstrapInstance) Status() string {
    22  	return ""
    23  }
    24  
    25  func (manualBootstrapInstance) Refresh() error {
    26  	return nil
    27  }
    28  
    29  func (inst manualBootstrapInstance) Addresses() (addresses []network.Address, err error) {
    30  	addr, err := manual.HostAddress(inst.host)
    31  	if err != nil {
    32  		return nil, err
    33  	}
    34  	return []network.Address{addr}, nil
    35  }
    36  
    37  func (manualBootstrapInstance) OpenPorts(machineId string, ports []network.Port) error {
    38  	return nil
    39  }
    40  
    41  func (manualBootstrapInstance) ClosePorts(machineId string, ports []network.Port) error {
    42  	return nil
    43  }
    44  
    45  func (manualBootstrapInstance) Ports(machineId string) ([]network.Port, error) {
    46  	return []network.Port{}, nil
    47  }