Exemple #1
0
// open populates the context fields and creates an ECS Client
func (context *Context) open() error {
	// perform libcomposeContext open which loads the compose file and determines projectname
	err := context.Context.Open()
	if err != nil {
		utils.LogError(err, "Unable to open ECS context")
		return err
	}
	context.ECSClient = ecsclient.NewECSClient()
	context.ECSClient.Initialize(context.ECSParams)

	context.EC2Client = ec2client.NewEC2Client(context.ECSParams)
	return nil
}
func clusterPS(context *cli.Context, rdwr config.ReadWriter, ecsClient ecsclient.ECSClient) (project.InfoSet, error) {
	ecsParams, err := newCliParams(context, rdwr)
	if err != nil {
		return nil, err
	}

	// Validate that cluster exists in ECS
	ecsClient.Initialize(ecsParams)
	if err := validateCluster(ecsParams.Cluster, ecsClient); err != nil {
		return nil, err
	}
	ec2Client := ec2client.NewEC2Client(ecsParams)

	ecsContext := &ecscompose.Context{ECSClient: ecsClient, EC2Client: ec2Client}
	task := ecscompose.NewTask(ecsContext)
	return task.Info(false)
}