package ec2test

import "github.com/AdRoll/goamz/ec2/ec2test"

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

Variables

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"}
)

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.

Source Files

filter.go server.go

Version
v0.0.0-20170825154802-2731d20f46f4 (latest)
Published
Aug 25, 2017
Platform
linux/amd64
Imports
12 packages
Last checked
5 days ago

Tools for package owners.