ec2test

package
v0.0.0-...-61e57bb Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2014 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

The ec2test package implements a fake EC2 provider with the capability of inducing errors on any given operation, and retrospectively determining what operations have been carried out.

Index

Constants

This section is empty.

Variables

View Source
var (
	Pending      = ec2.InstanceState{0, "pending"}
	Running      = ec2.InstanceState{16, "running"}
	ShuttingDown = ec2.InstanceState{32, "shutting-down"}
	Terminated   = ec2.InstanceState{16, "terminated"}
	Stopped      = ec2.InstanceState{16, "stopped"}
)

Functions

This section is empty.

Types

type Action

type Action struct {
	RequestId string

	// Request holds the requested action as a url.Values instance
	Request url.Values

	// If the action succeeded, Response holds the value that
	// was marshalled to build the XML response for the request.
	Response interface{}

	// If the action failed, Err holds an error giving details of the failure.
	Err *ec2.Error
}

Action represents a request that changes the ec2 state.

type Instance

type Instance struct {
	// UserData holds the data that was passed to the RunInstances request
	// when the instance was started.
	UserData []byte
	// contains filtered or unexported fields
}

instance holds a simulated ec2 instance

type Server

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

Server implements an EC2 simulator for use in testing.

func NewServer

func NewServer() (*Server, error)

NewServer returns a new server.

func (*Server) Instance

func (srv *Server) Instance(id string) *Instance

Instance returns the instance for the given instance id. It returns nil if there is no such instance.

func (*Server) NewInstances

func (srv *Server) NewInstances(n int, instType string, imageId string, state ec2.InstanceState, groups []ec2.SecurityGroup) []string

NewInstances creates n new instances in srv with the given instance type, image ID, initial state and security groups. If any group does not already exist, it will be created. NewInstances returns the ids of the new instances.

func (*Server) Quit

func (srv *Server) Quit()

Quit closes down the server.

func (*Server) SetInitialInstanceState

func (srv *Server) SetInitialInstanceState(state ec2.InstanceState)

SetInitialInstanceState sets the state that any new instances will be started in.

func (*Server) URL

func (srv *Server) URL() string

URL returns the URL of the server.

Jump to

Keyboard shortcuts

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