Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature for attaching multiple target groups in a service #1013

Merged
merged 12 commits into from
Apr 28, 2020
10 changes: 8 additions & 2 deletions ecs-cli/modules/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import (

const (
// ECSCLIResourcePrefix is prepended to the names of resources created through the ecs-cli
ECSCLIResourcePrefix = "amazon-ecs-cli-setup-"
ECSCLIResourcePrefix = "amazon-ecs-cli-setup-"
containerNameParamKey = "containerName"
seongm-1 marked this conversation as resolved.
Show resolved Hide resolved
containerPortParamKey = "containerPort"
loadBalancerNameParamKey = "loadBalancerName"
targetGroupArnParamKey = "targetGroupArn"
)

// InSlice checks if the given string exists in the given slice:
Expand Down Expand Up @@ -115,7 +119,8 @@ func ParseLoadBalancers(flagValues []string) ([]*ecs.LoadBalancer, error) {

seongm-1 marked this conversation as resolved.
Show resolved Hide resolved
for _, flagValue := range flagValues {
m := make(map[string]string)
validFlags := []string{"targetGroupArn", "loadBalancerName", "containerName", "containerPort"}

validFlags := []string{containerNameParamKey, containerPortParamKey, loadBalancerNameParamKey, targetGroupArnParamKey}
currentFlags := map[string]bool{
"containerName": false,
"containerPort": false,
Expand All @@ -130,6 +135,7 @@ func ParseLoadBalancers(flagValues []string) ([]*ecs.LoadBalancer, error) {
if len(pair) > 2 {
seongm-1 marked this conversation as resolved.
Show resolved Hide resolved
return nil, fmt.Errorf("Only include one = to indicate your value in your %s", key)
}

if ok := contains(validFlags, key); !ok {
return nil, fmt.Errorf("[--%s] is an invalid flag", key)
}
Expand Down