cloudprovider

package
v0.0.0-...-6eef5cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2014 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cloudprovider supplies interfaces and implementations for cloud service providers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeCloud

type FakeCloud struct {
	Exists   bool
	Err      error
	Calls    []string
	IP       net.IP
	Machines []string
	Zone     string
}

FakeCloud is a test-double implementation of Interface, TCPLoadBalancer and Instances. It is useful for testing.

func (*FakeCloud) ClearCalls

func (f *FakeCloud) ClearCalls()

ClearCalls clears internal record of method calls to this FakeCloud.

func (*FakeCloud) CreateTCPLoadBalancer

func (f *FakeCloud) CreateTCPLoadBalancer(name, region string, port int, hosts []string) error

CreateTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.CreateTCPLoadBalancer. It adds an entry "create" into the internal method call record.

func (*FakeCloud) DeleteTCPLoadBalancer

func (f *FakeCloud) DeleteTCPLoadBalancer(name, region string) error

DeleteTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.DeleteTCPLoadBalancer. It adds an entry "delete" into the internal method call record.

func (*FakeCloud) GetZone

func (f *FakeCloud) GetZone() (string, error)

func (*FakeCloud) IPAddress

func (f *FakeCloud) IPAddress(instance string) (net.IP, error)

IPAddress is a test-spy implementation of Instances.IPAddress. It adds an entry "ip-address" into the internal method call record.

func (*FakeCloud) Instances

func (f *FakeCloud) Instances() (Instances, bool)

Instances returns a fake implementation of Instances.

Actually it just returns f itself.

func (*FakeCloud) List

func (f *FakeCloud) List(filter string) ([]string, error)

List is a test-spy implementation of Instances.List. It adds an entry "list" into the internal method call record.

func (*FakeCloud) TCPLoadBalancer

func (f *FakeCloud) TCPLoadBalancer() (TCPLoadBalancer, bool)

TCPLoadBalancer returns a fake implementation of TCPLoadBalancer.

Actually it just returns f itself.

func (*FakeCloud) TCPLoadBalancerExists

func (f *FakeCloud) TCPLoadBalancerExists(name, region string) (bool, error)

TCPLoadBalancerExists is a stub implementation of TCPLoadBalancer.TCPLoadBalancerExists.

func (*FakeCloud) UpdateTCPLoadBalancer

func (f *FakeCloud) UpdateTCPLoadBalancer(name, region string, hosts []string) error

UpdateTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.UpdateTCPLoadBalancer. It adds an entry "update" into the internal method call record.

func (*FakeCloud) Zones

func (f *FakeCloud) Zones() (Zones, bool)

type GCECloud

type GCECloud struct {
	// contains filtered or unexported fields
}

GCECloud is an implementation of Interface, TCPLoadBalancer and Instances for Google Compute Engine.

func NewGCECloud

func NewGCECloud() (*GCECloud, error)

NewGCECloud creates a new instance of GCECloud.

func (*GCECloud) CreateTCPLoadBalancer

func (gce *GCECloud) CreateTCPLoadBalancer(name, region string, port int, hosts []string) error

CreateTCPLoadBalancer is an implementation of TCPLoadBalancer.CreateTCPLoadBalancer.

func (*GCECloud) DeleteTCPLoadBalancer

func (gce *GCECloud) DeleteTCPLoadBalancer(name, region string) error

DeleteTCPLoadBalancer is an implementation of TCPLoadBalancer.DeleteTCPLoadBalancer.

func (*GCECloud) GetZone

func (gce *GCECloud) GetZone() (string, error)

func (*GCECloud) IPAddress

func (gce *GCECloud) IPAddress(instance string) (net.IP, error)

IPAddress is an implementation of Instances.IPAddress.

func (*GCECloud) Instances

func (gce *GCECloud) Instances() (Instances, bool)

Instances returns an implementation of Instances for Google Compute Engine.

func (*GCECloud) List

func (gce *GCECloud) List(filter string) ([]string, error)

List is an implementation of Instances.List.

func (*GCECloud) TCPLoadBalancer

func (gce *GCECloud) TCPLoadBalancer() (TCPLoadBalancer, bool)

TCPLoadBalancer returns an implementation of TCPLoadBalancer for Google Compute Engine.

func (*GCECloud) TCPLoadBalancerExists

func (gce *GCECloud) TCPLoadBalancerExists(name, region string) (bool, error)

TCPLoadBalancerExists is an implementation of TCPLoadBalancer.TCPLoadBalancerExists.

func (*GCECloud) UpdateTCPLoadBalancer

func (gce *GCECloud) UpdateTCPLoadBalancer(name, region string, hosts []string) error

UpdateTCPLoadBalancer is an implementation of TCPLoadBalancer.UpdateTCPLoadBalancer.

func (*GCECloud) Zones

func (gce *GCECloud) Zones() (Zones, bool)

Zones returns an implementation of Zones for Google Compute Engine.

type Instances

type Instances interface {
	// IPAddress returns an IP address of the specified instance.
	IPAddress(name string) (net.IP, error)
	// List lists instances that match 'filter' which is a regular expression which must match the entire instance name (fqdn)
	List(filter string) ([]string, error)
}

Instances is an abstract, pluggable interface for sets of instances.

type Interface

type Interface interface {
	// TCPLoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.
	TCPLoadBalancer() (TCPLoadBalancer, bool)
	// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
	Instances() (Instances, bool)
	// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
	Zones() (Zones, bool)
}

Interface is an abstract, pluggable interface for cloud providers

type TCPLoadBalancer

type TCPLoadBalancer interface {
	// TCPLoadBalancerExists returns whether the specified load balancer exists.
	// TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service
	TCPLoadBalancerExists(name, region string) (bool, error)
	// CreateTCPLoadBalancer creates a new tcp load balancer.
	CreateTCPLoadBalancer(name, region string, port int, hosts []string) error
	// UpdateTCPLoadBalancer updates hosts under the specified load balancer.
	UpdateTCPLoadBalancer(name, region string, hosts []string) error
	// DeleteTCPLoadBalancer deletes a specified load balancer.
	DeleteTCPLoadBalancer(name, region string) error
}

TCPLoadBalancer is an abstract, pluggable interface for TCP load balancers.

type Zones

type Zones interface {
	// GetZone returns the name of the current failure zone that the program is running in
	GetZone() (string, error)
}

Zones is an abstract, pluggable interface for zone enumeration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL