コード例 #1
0
func NewBlueGreenController(ecs *aws.ECSManager, projectDir string, targetResource string) (*BlueGreenController, error) {

	ccon, errcc := service.NewServiceController(ecs, projectDir, "")

	if errcc != nil {
		return nil, errcc
	}

	con := &BlueGreenController{
		Ecs:               ecs,
		ClusterController: ccon,
		TargetResource:    targetResource,
	}

	defs, errs := con.searchBlueGreen(projectDir)
	if errs != nil {
		return nil, errs
	}

	con.blueGreenMap = defs
	return con, nil
}
コード例 #2
0
ファイル: commands.go プロジェクト: TanUkkii007/ecs-formation
func doService(c *cli.Context) {

	ecsManager, err := buildECSManager()

	if err != nil {
		logger.Main.Error(color.Red(err.Error()))
		os.Exit(1)
	}

	operation, errSubCommand := createOperation(c.Args())

	if errSubCommand != nil {
		logger.Main.Error(color.Red(errSubCommand.Error()))
		os.Exit(1)
	}

	projectDir, err := os.Getwd()
	if err != nil {
		logger.Main.Error(color.Red(err.Error()))
		os.Exit(1)
	}

	jsonOutput := c.Bool("json-output")
	clusterController, err := service.NewServiceController(ecsManager, projectDir, operation.TargetResource)

	plans, err := createClusterPlans(clusterController, projectDir, jsonOutput)

	if err != nil {
		logger.Main.Error(color.Red(err.Error()))
		os.Exit(1)
	}

	if operation.SubCommand == "apply" {
		clusterController.ApplyServicePlans(plans)
	}
}