Documentation ¶
Index ¶
- Constants
- Variables
- type MockEC2Client
- func (ms *MockEC2Client) DescribeImages(input *ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error)
- func (ms *MockEC2Client) DescribeInstances(input *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
- func (ms *MockEC2Client) RunInstances(input *ec2.RunInstancesInput) (*ec2.Reservation, error)
- func (ms *MockEC2Client) StopInstances(input *ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error)
- func (ms *MockEC2Client) TerminateInstances(input *ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)
- type MockPluginSPIImpl
Constants ¶
View Source
const ( // FailAtRegion string to fail call due to invalid region FailAtRegion string = "fail-at-region" // FailQueryAtDescribeImages string to fail call at Describeimages call FailQueryAtDescribeImages string = "fail-query-at-DescribeImages" // FailQueryAtRunInstances string to fail call at RunInstances call FailQueryAtRunInstances string = "aws:///eu-west-1/i-fail-query-at-RunInstances" // FailQueryAtTerminateInstances string to fail call at TerminateInstances call FailQueryAtTerminateInstances string = "fail-query-at-TerminateInstances" // InstanceDoesntExistError string returns instance doesn't exist error InstanceDoesntExistError string = "i-instance-doesnt-exist" // InstanceStopError string returns error mentioning instance has been stopped InstanceStopError string = "i-instance-stop-error" // ReturnEmptyListAtDescribeInstances string returns empty list at DescribeInstances call ReturnEmptyListAtDescribeInstances string = "return-empty-list-at-DescribeInstances" // ReturnErrorAtDescribeInstances string returns error at DescribeInstances call ReturnErrorAtDescribeInstances string = "return-error-at-DescribeInstances" // SetInstanceID string sets the instance ID provided at keyname SetInstanceID string = "set-instance-id" // InconsistencyInAPIs string makes RunInstances and DescribeInstances APIs out of sync InconsistencyInAPIs string = "apis-are-inconsistent" // InsufficientCapacity string makes RunInstances return an InsufficientCapacity error code InsufficientCapacity = "insufficient-capacity" )
Variables ¶
View Source
var ( // AWSInvalidRegionError denotes an error with an InvalidRegion error code. AWSInvalidRegionError = awserr.New("InvalidRegion", "region doesn't exist while trying to create session", fmt.Errorf("region doesn't exist while trying to create session")) // AWSImageNotFoundError denotes an error with an ImageNotFound error code. AWSImageNotFoundError = awserr.New("ImageNotFound", "couldn't find image with given ID", fmt.Errorf("couldn't find image with given ID")) // AWSInternalErrorForRunInstances denotes an error returned by RunInstances call with Internal error code AWSInternalErrorForRunInstances = awserr.New("Internal", "couldn't run instance with given ID", fmt.Errorf("couldn't run instance with given ID")) // AWSInsufficientCapacityError denotes an error with an InsufficientCapacity error code. AWSInsufficientCapacityError = awserr.New(awserror.InsufficientCapacity, "insufficient capacity on cloud provider side", fmt.Errorf("insufficient capacity on cloud provider side")) // AWSInternalErrorForDescribeInstances denotes an error returned by DescribeInstances call with an Internal error code AWSInternalErrorForDescribeInstances = awserr.New("Internal", "cloud provider returned error", fmt.Errorf("cloud provider returned error")) // AWSInstanceNotFoundError returns denotes an error with InvalidInstanceID.NotFound error code AWSInstanceNotFoundError = awserr.New(awserror.InstanceIDNotFound, "InvalidInstanceID.NotFound: The instance IDs do not exist", fmt.Errorf("InvalidInstanceID.NotFound: The instance IDs do not exist")) )
Functions ¶
This section is empty.
Types ¶
type MockEC2Client ¶
MockEC2Client is the mock implementation of an EC2Client
func (*MockEC2Client) DescribeImages ¶
func (ms *MockEC2Client) DescribeImages(input *ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error)
DescribeImages implements a mock describe image method
func (*MockEC2Client) DescribeInstances ¶
func (ms *MockEC2Client) DescribeInstances(input *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
DescribeInstances implements a mock run instance method
func (*MockEC2Client) RunInstances ¶
func (ms *MockEC2Client) RunInstances(input *ec2.RunInstancesInput) (*ec2.Reservation, error)
RunInstances implements a mock run instance method The name of the newly created instances depends on the number of instances in cache starts from 0
func (*MockEC2Client) StopInstances ¶
func (ms *MockEC2Client) StopInstances(input *ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error)
StopInstances implements a mock stop instance method
func (*MockEC2Client) TerminateInstances ¶
func (ms *MockEC2Client) TerminateInstances(input *ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)
TerminateInstances implements a mock terminate instance method
type MockPluginSPIImpl ¶
MockPluginSPIImpl is the mock implementation of PluginSPI interface that makes dummy calls
func (*MockPluginSPIImpl) NewEC2API ¶
func (ms *MockPluginSPIImpl) NewEC2API(_ *awssession.Session) ec2iface.EC2API
NewEC2API Returns a EC2API object
func (*MockPluginSPIImpl) NewSession ¶
func (ms *MockPluginSPIImpl) NewSession(_ *corev1.Secret, region string) (*awssession.Session, error)
NewSession starts a new AWS session
Click to show internal directories.
Click to hide internal directories.