diff --git a/commands.go b/commands.go index 3a6f921a..4e15cfbe 100644 --- a/commands.go +++ b/commands.go @@ -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 { @@ -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 { diff --git a/main.go b/main.go index 4e55e339..0c141b34 100644 --- a/main.go +++ b/main.go @@ -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")) @@ -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)