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 ¶
- Variables
- type Action
- type Instance
- type Server
- func (srv *Server) Instance(id string) *Instance
- func (srv *Server) NewInstances(n int, instType string, imageId string, state ec2.InstanceState, ...) []string
- func (srv *Server) NewInstancesVPC(vpcId, subnetId string, n int, instType string, imageId string, ...) []string
- func (srv *Server) Quit()
- func (srv *Server) SetAvailabilityZones(zones []ec2.AvailabilityZoneInfo)
- func (srv *Server) SetInitialAttributes(attrs map[string][]string)
- func (srv *Server) SetInitialInstanceState(state ec2.InstanceState)
- func (srv *Server) URL() string
Constants ¶
This section is empty.
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"} )
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 (*Server) 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) NewInstancesVPC ¶
func (srv *Server) NewInstancesVPC(vpcId, subnetId string, n int, instType string, imageId string, state ec2.InstanceState, groups []ec2.SecurityGroup) []string
NewInstancesVPC creates n new VPC instances in srv with the given instance type, image ID, initial state, and security groups, belonging to the given vpcId and subnetId. If any group does not already exist, it will be created. NewInstancesVPC returns the ids of the new instances.
If vpcId and subnetId are both empty, this call is equivalent to calling NewInstances.
func (*Server) SetAvailabilityZones ¶
func (srv *Server) SetAvailabilityZones(zones []ec2.AvailabilityZoneInfo)
func (*Server) SetInitialAttributes ¶
SetInitialAttributes sets the given account attributes on the server.
func (*Server) SetInitialInstanceState ¶
func (srv *Server) SetInitialInstanceState(state ec2.InstanceState)
SetInitialInstanceState sets the state that any new instances will be started in.