Skip to content

Commit

Permalink
Add subdivision
Browse files Browse the repository at this point in the history
  • Loading branch information
bensie committed Mar 30, 2016
1 parent 657c872 commit 54fd7be
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
28 changes: 17 additions & 11 deletions commands.go
Expand Up @@ -314,17 +314,18 @@ func ExportBindToWriter(r53 *route53.Route53, zone *route53.HostedZone, full boo
}

type createArgs struct {
name string
records []string
wait bool
replace bool
identifier string
failover string
healthCheckId string
weight *int
region string
countryCode string
continentCode string
name string
records []string
wait bool
replace bool
identifier string
failover string
healthCheckId string
weight *int
region string
countryCode string
continentCode string
subdivisionCode string
}

func (args createArgs) validate() bool {
Expand Down Expand Up @@ -389,6 +390,11 @@ func (args createArgs) applyRRSetParams(rrset *route53.ResourceRecordSet) {
ContinentCode: aws.String(args.continentCode),
}
}
if args.subdivisionCode != "" {
rrset.GeoLocation = &route53.GeoLocation{
SubdivisionCode: aws.String(args.subdivisionCode),
}
}
}

func equalStringPtrs(a, b *string) bool {
Expand Down
27 changes: 16 additions & 11 deletions main.go
Expand Up @@ -186,6 +186,10 @@ func Main(args []string) int {
Name: "continent-code",
Usage: "continent code for geolocation routing",
},
cli.StringFlag{
Name: "subdivision-code",
Usage: "subdivision code for geolocation routing",
},
),
Action: func(c *cli.Context) {
r53 = getService(c.Bool("debug"), c.String("profile"))
Expand All @@ -199,17 +203,18 @@ func Main(args []string) int {
weight = aws.Int(c.Int("weight"))
}
args := createArgs{
name: c.Args()[0],
records: c.Args()[1:],
wait: c.Bool("wait"),
replace: c.Bool("replace"),
identifier: c.String("identifier"),
failover: c.String("failover"),
healthCheckId: c.String("health-check"),
weight: weight,
region: c.String("region"),
countryCode: c.String("country-code"),
continentCode: c.String("continent-code"),
name: c.Args()[0],
records: c.Args()[1:],
wait: c.Bool("wait"),
replace: c.Bool("replace"),
identifier: c.String("identifier"),
failover: c.String("failover"),
healthCheckId: c.String("health-check"),
weight: weight,
region: c.String("region"),
countryCode: c.String("country-code"),
continentCode: c.String("continent-code"),
subdivisionCode: c.String("subdivision-code"),
}
if args.validate() {
createRecords(args)
Expand Down

0 comments on commit 54fd7be

Please sign in to comment.