github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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/core/instance"
     8  	"github.com/juju/juju/core/status"
     9  	"github.com/juju/juju/environs/context"
    10  	"github.com/juju/juju/environs/manual"
    11  	"github.com/juju/juju/network"
    12  )
    13  
    14  type manualBootstrapInstance struct {
    15  	host string
    16  }
    17  
    18  func (manualBootstrapInstance) Id() instance.Id {
    19  	return BootstrapInstanceId
    20  }
    21  
    22  func (manualBootstrapInstance) Status(ctx context.ProviderCallContext) instance.Status {
    23  	// We assume that if we are deploying in manual provider the
    24  	// underlying machine is clearly running.
    25  	return instance.Status{
    26  		Status: status.Running,
    27  	}
    28  }
    29  
    30  func (manualBootstrapInstance) Refresh(ctx context.ProviderCallContext) error {
    31  	return nil
    32  }
    33  
    34  func (inst manualBootstrapInstance) Addresses(ctx context.ProviderCallContext) (addresses []network.Address, err error) {
    35  	addr, err := manual.HostAddress(inst.host)
    36  	if err != nil {
    37  		return nil, err
    38  	}
    39  	return []network.Address{addr}, nil
    40  }
    41  
    42  func (manualBootstrapInstance) OpenPorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error {
    43  	return nil
    44  }
    45  
    46  func (manualBootstrapInstance) ClosePorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error {
    47  	return nil
    48  }
    49  
    50  func (manualBootstrapInstance) IngressRules(ctx context.ProviderCallContext, machineId string) ([]network.IngressRule, error) {
    51  	return nil, nil
    52  }