Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Removed strict region checking
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulMaddox committed Sep 5, 2019
1 parent f2fd8fb commit 36660d4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
bin
fargate
dist
fargatecli
vendor
5 changes: 4 additions & 1 deletion acm/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,11 @@ func (acm SDKClient) ImportCertificate(certificate, privateKey, certificateChain
}

resp, err := acm.client.ImportCertificate(input)
if err != nil {
return "", err
}

return aws.StringValue(resp.CertificateArn), err
return aws.StringValue(resp.CertificateArn), nil
}

// InflateCertificate uses a partially hydrated certificate to fetch the rest of its details and
Expand Down
30 changes: 1 addition & 29 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

const (
version = "0.3.0"
version = "0.3.2"

defaultClusterName = "fargate"
defaultRegion = "us-east-1"
Expand Down Expand Up @@ -45,23 +45,6 @@ CPU (CPU Units) Memory (MiB)
4096 8192 through 30720 in 1GiB increments
`)

var validRegions = []string{
"ap-east-1",
"ap-northeast-1",
"ap-northeast-2",
"ap-south-1",
"ap-southeast-1",
"ap-southeast-2",
"ca-central-1",
"eu-central-1",
"eu-west-1",
"eu-west-2",
"us-east-1",
"us-east-2",
"us-west-1",
"us-west-2",
}

var (
clusterName string
noColor bool
Expand Down Expand Up @@ -124,17 +107,6 @@ CloudWatch Logs, and Amazon Route 53 into an easy-to-use CLI.`,
}
}

var foundRegion bool = false
for _, validRegion := range validRegions {
if region == validRegion {
foundRegion = true
break
}
}
if !foundRegion {
console.IssueExit("Invalid region: %s [valid regions: %s]", region, strings.Join(validRegions, ", "))
}

config := &aws.Config{
Region: aws.String(region),
}
Expand Down
5 changes: 4 additions & 1 deletion ecs/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ func (ecs *ECS) CreateCluster() (string, error) {
}

resp, err := ecs.svc.CreateCluster(input)
if err != nil {
return "", err
}

return aws.StringValue(resp.Cluster.ClusterArn), err
return aws.StringValue(resp.Cluster.ClusterArn), nil
}
12 changes: 10 additions & 2 deletions route53/hosted_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ func (route53 SDKClient) CreateResourceRecord(i CreateResourceRecordInput) (stri
},
)

return aws.StringValue(resp.ChangeInfo.Id), err
if err != nil {
return "", err
}

return aws.StringValue(resp.ChangeInfo.Id), nil
}

// CreateAlias creates an alias record in an Amazon Route 53 hosted zone.
Expand All @@ -106,7 +110,11 @@ func (route53 SDKClient) CreateAlias(i CreateAliasInput) (string, error) {
},
)

return aws.StringValue(resp.ChangeInfo.Id), err
if err != nil {
return "", err
}

return aws.StringValue(resp.ChangeInfo.Id), nil
}

// ListHostedZones returns all Amazon Route 53 zones in the caller's account.
Expand Down

0 comments on commit 36660d4

Please sign in to comment.