Documentation ¶
Overview ¶
Package ecsmock implements mock server for ECS service API. Currently it is only used by ecsobserver extension for unit test.
Index ¶
- func GenContainerInstances(arnPrefix string, count int, modifier func(i int, ci *ecs.ContainerInstance)) []*ecs.ContainerInstance
- func GenEc2Instances(idPrefix string, count int, modifier func(i int, ins *ec2.Instance)) []*ec2.Instance
- func GenServices(arnPrefix string, count int, modifier func(i int, s *ecs.Service)) []*ecs.Service
- func GenTaskDefinitions(arnPrefix string, count int, version int, ...) []*ecs.TaskDefinition
- func GenTasks(arnPrefix string, count int, modifier func(i int, task *ecs.Task)) []*ecs.Task
- type APIStat
- type Cluster
- func (c *Cluster) DescribeContainerInstancesWithContext(_ context.Context, input *ecs.DescribeContainerInstancesInput, ...) (*ecs.DescribeContainerInstancesOutput, error)
- func (c *Cluster) DescribeInstancesWithContext(_ context.Context, input *ec2.DescribeInstancesInput, _ ...request.Option) (*ec2.DescribeInstancesOutput, error)
- func (c *Cluster) DescribeServicesWithContext(_ context.Context, input *ecs.DescribeServicesInput, _ ...request.Option) (*ecs.DescribeServicesOutput, error)
- func (c *Cluster) DescribeTaskDefinitionWithContext(_ context.Context, input *ecs.DescribeTaskDefinitionInput, _ ...request.Option) (*ecs.DescribeTaskDefinitionOutput, error)
- func (c *Cluster) DescribeTasksWithContext(_ context.Context, input *ecs.DescribeTasksInput, _ ...request.Option) (*ecs.DescribeTasksOutput, error)
- func (c *Cluster) ListServicesWithContext(_ context.Context, input *ecs.ListServicesInput, _ ...request.Option) (*ecs.ListServicesOutput, error)
- func (c *Cluster) ListTasksWithContext(_ context.Context, input *ecs.ListTasksInput, _ ...request.Option) (*ecs.ListTasksOutput, error)
- func (c *Cluster) SetContainerInstances(instances []*ecs.ContainerInstance)
- func (c *Cluster) SetEc2Instances(instances []*ec2.Instance)
- func (c *Cluster) SetServices(services []*ecs.Service)
- func (c *Cluster) SetTaskDefinitions(defs []*ecs.TaskDefinition)
- func (c *Cluster) SetTasks(tasks []*ecs.Task)
- func (c *Cluster) Stats() ClusterStats
- type ClusterStats
- type PageLimit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenContainerInstances ¶ added in v0.28.0
func GenContainerInstances(arnPrefix string, count int, modifier func(i int, ci *ecs.ContainerInstance)) []*ecs.ContainerInstance
func GenEc2Instances ¶ added in v0.28.0
func GenServices ¶ added in v0.28.0
func GenTaskDefinitions ¶ added in v0.28.0
func GenTaskDefinitions(arnPrefix string, count int, version int, modifier func(i int, def *ecs.TaskDefinition)) []*ecs.TaskDefinition
GenTaskDefinitions returns tasks with TaskArn set to arnPrefix+offset+version, where offset is [0, count). e.g. foo0:1, foo1:1 the `:` is following the task family version syntax.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster implements both ECS and EC2 API for a single cluster.
func NewCluster ¶
func NewCluster() *Cluster
NewCluster creates a mock ECS cluster with default limits.
func NewClusterWithName ¶ added in v0.30.0
NewClusterWithName creates a cluster that checks for cluster name if request includes a non empty cluster name.
func (*Cluster) DescribeContainerInstancesWithContext ¶ added in v0.28.0
func (c *Cluster) DescribeContainerInstancesWithContext(_ context.Context, input *ecs.DescribeContainerInstancesInput, _ ...request.Option) (*ecs.DescribeContainerInstancesOutput, error)
func (*Cluster) DescribeInstancesWithContext ¶ added in v0.28.0
func (c *Cluster) DescribeInstancesWithContext(_ context.Context, input *ec2.DescribeInstancesInput, _ ...request.Option) (*ec2.DescribeInstancesOutput, error)
DescribeInstancesWithContext supports get all the instances and get instance by ids. It does NOT support filter. Result always has a single reservation, which is not the case in actual EC2 API.
func (*Cluster) DescribeServicesWithContext ¶ added in v0.28.0
func (c *Cluster) DescribeServicesWithContext(_ context.Context, input *ecs.DescribeServicesInput, _ ...request.Option) (*ecs.DescribeServicesOutput, error)
func (*Cluster) DescribeTaskDefinitionWithContext ¶ added in v0.28.0
func (c *Cluster) DescribeTaskDefinitionWithContext(_ context.Context, input *ecs.DescribeTaskDefinitionInput, _ ...request.Option) (*ecs.DescribeTaskDefinitionOutput, error)
func (*Cluster) DescribeTasksWithContext ¶
func (c *Cluster) DescribeTasksWithContext(_ context.Context, input *ecs.DescribeTasksInput, _ ...request.Option) (*ecs.DescribeTasksOutput, error)
func (*Cluster) ListServicesWithContext ¶ added in v0.28.0
func (c *Cluster) ListServicesWithContext(_ context.Context, input *ecs.ListServicesInput, _ ...request.Option) (*ecs.ListServicesOutput, error)
func (*Cluster) ListTasksWithContext ¶
func (c *Cluster) ListTasksWithContext(_ context.Context, input *ecs.ListTasksInput, _ ...request.Option) (*ecs.ListTasksOutput, error)
func (*Cluster) SetContainerInstances ¶ added in v0.28.0
func (c *Cluster) SetContainerInstances(instances []*ecs.ContainerInstance)
SetContainerInstances updates the list and map.
func (*Cluster) SetEc2Instances ¶ added in v0.28.0
SetEc2Instances updates the list and map.
func (*Cluster) SetServices ¶ added in v0.28.0
SetServices updates the list and map.
func (*Cluster) SetTaskDefinitions ¶ added in v0.28.0
func (c *Cluster) SetTaskDefinitions(defs []*ecs.TaskDefinition)
SetTaskDefinitions updates the map. NOTE: we could have both list and map, but we are not using list task def in ecsobserver.
func (*Cluster) Stats ¶ added in v0.28.0
func (c *Cluster) Stats() ClusterStats
type ClusterStats ¶ added in v0.28.0
type ClusterStats struct {
DescribeTaskDefinition APIStat
}
ClusterStats keep track of API methods for one ECS cluster. Not all methods are tracked
type PageLimit ¶
type PageLimit struct { ListTaskOutput int // default 100, max 100 DescribeTaskInput int // max 100 ListServiceOutput int // default 10, max 100 DescribeServiceInput int // max 10 DescribeContainerInstanceInput int // max 100 DescribeInstanceOutput int // max 1000 }
PageLimit defines number of items in a single page for different APIs. Those numbers can be found on the Input and and Output struct comments. Call DefaultPageLimit() to config the mock to use numbers same as the actual AWS API.
func DefaultPageLimit ¶
func DefaultPageLimit() PageLimit