static Object updateDeploymentGroup()

in src/main/java/com/ecs/cicd/DeploymentGroupRequestCreator.java [78:118]


    static Object updateDeploymentGroup(EcsApplication ecsApplication,
                                      Role serviceRole,
                                      NetworkListener productionListener,
                                      NetworkListener greenListener,
                                      String blueTarget,
                                      String targetGreen,
                                      String clusterName,
                                      String serviceName,
                                      String deploymentGroupName) {

        LoadBalancerInfo loadBalancerInfo = new LoadBalancerInfo()
                .withTargetGroupPairInfoList(new TargetGroupPairInfo()
                        .withProdTrafficRoute(new TrafficRoute()
                                .withListenerArns(productionListener.getListenerArn()))
                        .withTestTrafficRoute(new TrafficRoute()
                                .withListenerArns(greenListener.getListenerArn()))
                        .withTargetGroups(new TargetGroupInfo()
                                        .withName(blueTarget),
                                new TargetGroupInfo()
                                        .withName(targetGreen)));

        UpdateDeploymentGroupRequest deploymentGroup = new UpdateDeploymentGroupRequest()
                .withApplicationName(ecsApplication.getApplicationName())
                .withCurrentDeploymentGroupName(deploymentGroupName)
                .withServiceRoleArn(serviceRole.getRoleArn())
                .withDeploymentStyle(new DeploymentStyle()
                        .withDeploymentOption(DeploymentOption.WITH_TRAFFIC_CONTROL)
                        .withDeploymentType(DeploymentType.BLUE_GREEN))
                .withBlueGreenDeploymentConfiguration(new BlueGreenDeploymentConfiguration()
                        .withTerminateBlueInstancesOnDeploymentSuccess(new BlueInstanceTerminationOption()
                                .withAction(InstanceAction.TERMINATE)
                                .withTerminationWaitTimeInMinutes(5))
                        .withDeploymentReadyOption(new DeploymentReadyOption()
                                .withActionOnTimeout(DeploymentReadyAction.CONTINUE_DEPLOYMENT)))
                .withEcsServices(new ECSService()
                        .withServiceName(serviceName)
                        .withClusterName(clusterName))
                .withLoadBalancerInfo(loadBalancerInfo);

        return MAPPER.convertValue(deploymentGroup, Map.class);
    }