// populateContext sets the required CLI arguments to the context func (projectFactory projectFactory) populateContext(ecsContext *ecscompose.Context, cliContext *cli.Context) error { // populate CLI context populate(ecsContext, cliContext) ecsContext.CLIContext = cliContext // reads and sets the parameters (required to create ECS Service Client) from the cli context to ecs context rdwr, err := config.NewReadWriter() if err != nil { utils.LogError(err, "Error loading config") return err } params, err := config.NewCliParams(cliContext, rdwr) if err != nil { utils.LogError(err, "Unable to create an instance of ECSParams given the cli context") return err } ecsContext.ECSParams = params // populate libcompose context if err = projectFactory.populateLibcomposeContext(ecsContext); err != nil { return err } return nil }
func ClusterScale(c *cli.Context) { rdwr, err := config.NewReadWriter() if err != nil { logrus.Error("Error executing 'scale': ", err) return } ecsClient := ecsclient.NewECSClient() cfnClient := cloudformation.NewCloudformationClient() if err := scaleCluster(c, rdwr, ecsClient, cfnClient); err != nil { logrus.Error("Error executing 'scale': ", err) return } }
func ClusterPS(c *cli.Context) { rdwr, err := config.NewReadWriter() if err != nil { logrus.Error("Error executing 'ps ", err) return } ecsClient := ecsclient.NewECSClient() infoSet, err := clusterPS(c, rdwr, ecsClient) if err != nil { logrus.Error("Error executing 'ps ", err) return } os.Stdout.WriteString(infoSet.String(ecscompose.ContainerInfoColumns, displayTitle)) }
func ClusterUp(c *cli.Context) { rdwr, err := config.NewReadWriter() if err != nil { logrus.Error("Error executing 'up': ", err) return } ecsClient := ecsclient.NewECSClient() cfnClient := cloudformation.NewCloudformationClient() amiIds := ami.NewStaticAmiIds() if err := createCluster(c, rdwr, ecsClient, cfnClient, amiIds); err != nil { logrus.Error("Error executing 'up': ", err) return } }
// configure is the callback for ConfigureCommand. func configure(context *cli.Context) { ecsConfig, err := createECSConfigFromCli(context) if err != nil { logrus.Error("Error initializing: ", err) return } rdwr, err := config.NewReadWriter() if err != nil { logrus.Error("Error initializing: ", err) return } err = saveConfig(ecsConfig, rdwr, rdwr.Destination) if err != nil { logrus.Error("Error initializing: ", err) } }