fix go formatting after rebase

This commit is contained in:
Clint Shryock 2015-04-16 13:42:16 -05:00
parent 1545dbb803
commit 1da9bc8f4c
6 changed files with 49 additions and 49 deletions

View File

@ -10,8 +10,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
)
func resourceAwsRoute53Record() *schema.Resource {
@ -74,7 +74,7 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
conn := meta.(*AWSClient).r53conn
zone := cleanZoneID(d.Get("zone_id").(string))
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(zone)})
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(zone)})
if err != nil {
return err
}
@ -90,15 +90,15 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
// operation happening at the same time.
changeBatch := &route53.ChangeBatch{
Comment: aws.String("Managed by Terraform"),
Changes: []*route53.Change{
&route53.Change{
Changes: []*route53.Change{
&route53.Change{
Action: aws.String("UPSERT"),
ResourceRecordSet: rec,
},
},
}
req := &route53.ChangeResourceRecordSetsInput{
req := &route53.ChangeResourceRecordSetsInput{
HostedZoneID: aws.String(cleanZoneID(*zoneRecord.HostedZone.ID)),
ChangeBatch: changeBatch,
}
@ -133,7 +133,7 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
if err != nil {
return err
}
changeInfo := respRaw.(*route53.ChangeResourceRecordSetsOutput).ChangeInfo
changeInfo := respRaw.(*route53.ChangeResourceRecordSetsOutput).ChangeInfo
// Generate an ID
d.SetId(fmt.Sprintf("%s_%s_%s", zone, d.Get("name").(string), d.Get("type").(string)))
@ -146,7 +146,7 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
Timeout: 30 * time.Minute,
MinTimeout: 5 * time.Second,
Refresh: func() (result interface{}, state string, err error) {
changeRequest := &route53.GetChangeInput{
changeRequest := &route53.GetChangeInput{
ID: aws.String(cleanChangeID(*changeInfo.ID)),
}
return resourceAwsGoRoute53Wait(conn, changeRequest)
@ -166,13 +166,13 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro
zone := cleanZoneID(d.Get("zone_id").(string))
// get expanded name
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(zone)})
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(zone)})
if err != nil {
return err
}
en := expandRecordName(d.Get("name").(string), *zoneRecord.HostedZone.Name)
lopts := &route53.ListResourceRecordSetsInput{
lopts := &route53.ListResourceRecordSetsInput{
HostedZoneID: aws.String(cleanZoneID(zone)),
StartRecordName: aws.String(en),
StartRecordType: aws.String(d.Get("type").(string)),
@ -218,7 +218,7 @@ func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) er
zone := cleanZoneID(d.Get("zone_id").(string))
log.Printf("[DEBUG] Deleting resource records for zone: %s, name: %s",
zone, d.Get("name").(string))
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(zone)})
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(zone)})
if err != nil {
return err
}
@ -231,15 +231,15 @@ func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) er
// Create the new records
changeBatch := &route53.ChangeBatch{
Comment: aws.String("Deleted by Terraform"),
Changes: []*route53.Change{
&route53.Change{
Changes: []*route53.Change{
&route53.Change{
Action: aws.String("DELETE"),
ResourceRecordSet: rec,
},
},
}
req := &route53.ChangeResourceRecordSetsInput{
req := &route53.ChangeResourceRecordSetsInput{
HostedZoneID: aws.String(cleanZoneID(zone)),
ChangeBatch: changeBatch,
}

View File

@ -8,8 +8,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
)
func TestCleanRecordName(t *testing.T) {
@ -134,7 +134,7 @@ func testAccCheckRoute53RecordDestroy(s *terraform.State) error {
name := parts[1]
rType := parts[2]
lopts := &route53.ListResourceRecordSetsInput{
lopts := &route53.ListResourceRecordSetsInput{
HostedZoneID: aws.String(cleanZoneID(zone)),
StartRecordName: aws.String(name),
StartRecordType: aws.String(rType),
@ -174,7 +174,7 @@ func testAccCheckRoute53RecordExists(n string) resource.TestCheckFunc {
en := expandRecordName(name, "notexample.com")
lopts := &route53.ListResourceRecordSetsInput{
lopts := &route53.ListResourceRecordSetsInput{
HostedZoneID: aws.String(cleanZoneID(zone)),
StartRecordName: aws.String(en),
StartRecordType: aws.String(rType),

View File

@ -8,8 +8,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
)
func resourceAwsRoute53Zone() *schema.Resource {
@ -40,7 +40,7 @@ func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) erro
r53 := meta.(*AWSClient).r53conn
comment := &route53.HostedZoneConfig{Comment: aws.String("Managed by Terraform")}
req := &route53.CreateHostedZoneInput{
req := &route53.CreateHostedZoneInput{
Name: aws.String(d.Get("name").(string)),
HostedZoneConfig: comment,
CallerReference: aws.String(time.Now().Format(time.RFC3339Nano)),
@ -65,7 +65,7 @@ func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) erro
Timeout: 10 * time.Minute,
MinTimeout: 2 * time.Second,
Refresh: func() (result interface{}, state string, err error) {
changeRequest := &route53.GetChangeInput{
changeRequest := &route53.GetChangeInput{
ID: aws.String(cleanChangeID(*resp.ChangeInfo.ID)),
}
return resourceAwsGoRoute53Wait(r53, changeRequest)
@ -80,7 +80,7 @@ func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) erro
func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error {
r53 := meta.(*AWSClient).r53conn
_, err := r53.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(d.Id())})
_, err := r53.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(d.Id())})
if err != nil {
// Handle a deleted zone
if r53err, ok := err.(aws.APIError); ok && r53err.Code == "NoSuchHostedZone" {
@ -91,7 +91,7 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error
}
// get tags
req := &route53.ListTagsForResourceInput{
req := &route53.ListTagsForResourceInput{
ResourceID: aws.String(d.Id()),
ResourceType: aws.String("hostedzone"),
}
@ -101,7 +101,7 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error
return err
}
var tags []*route53.Tag
var tags []*route53.Tag
if resp.ResourceTagSet != nil {
tags = resp.ResourceTagSet.Tags
}
@ -130,7 +130,7 @@ func resourceAwsRoute53ZoneDelete(d *schema.ResourceData, meta interface{}) erro
log.Printf("[DEBUG] Deleting Route53 hosted zone: %s (ID: %s)",
d.Get("name").(string), d.Id())
_, err := r53.DeleteHostedZone(&route53.DeleteHostedZoneInput{ID: aws.String(d.Id())})
_, err := r53.DeleteHostedZone(&route53.DeleteHostedZoneInput{ID: aws.String(d.Id())})
if err != nil {
return err
}

View File

@ -7,8 +7,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
)
func TestCleanPrefix(t *testing.T) {
@ -90,7 +90,7 @@ func testAccCheckRoute53ZoneDestroy(s *terraform.State) error {
continue
}
_, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(rs.Primary.ID)})
_, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(rs.Primary.ID)})
if err == nil {
return fmt.Errorf("Hosted zone still exists")
}
@ -110,7 +110,7 @@ func testAccCheckRoute53ZoneExists(n string, zone *route53.HostedZone) resource.
}
conn := testAccProvider.Meta().(*AWSClient).r53conn
resp, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(rs.Primary.ID)})
resp, err := conn.GetHostedZone(&route53.GetHostedZoneInput{ID: aws.String(rs.Primary.ID)})
if err != nil {
return fmt.Errorf("Hosted zone err: %v", err)
}
@ -124,7 +124,7 @@ func testAccLoadTagsR53(zone *route53.HostedZone, td *route53.ResourceTagSet) re
conn := testAccProvider.Meta().(*AWSClient).r53conn
zone := cleanZoneID(*zone.ID)
req := &route53.ListTagsForResourceInput{
req := &route53.ListTagsForResourceInput{
ResourceID: aws.String(zone),
ResourceType: aws.String("hostedzone"),
}

View File

@ -3,8 +3,8 @@ package aws
import (
"log"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/hashicorp/terraform/helper/schema"
)
@ -18,21 +18,21 @@ func setTagsR53(conn *route53.Route53, d *schema.ResourceData) error {
create, remove := diffTagsR53(tagsFromMapR53(o), tagsFromMapR53(n))
// Set tags
r := make([]*string, len(remove))
r := make([]*string, len(remove))
for i, t := range remove {
r[i] = t.Key
r[i] = t.Key
}
log.Printf("[DEBUG] Changing tags: \n\tadding: %#v\n\tremoving:%#v", create, remove)
req := &route53.ChangeTagsForResourceInput{
ResourceID: aws.String(d.Id()),
ResourceType: aws.String("hostedzone"),
}
req := &route53.ChangeTagsForResourceInput{
ResourceID: aws.String(d.Id()),
ResourceType: aws.String("hostedzone"),
}
if len(create) > 0 {
req.AddTags = create
}
if len(r) > 0 {
req.RemoveTagKeys = r
if len(create) > 0 {
req.AddTags = create
}
if len(r) > 0 {
req.RemoveTagKeys = r
}
_, err := conn.ChangeTagsForResource(req)
@ -55,7 +55,7 @@ func diffTagsR53(oldTags, newTags []*route53.Tag) ([]*route53.Tag, []*route53.Ta
}
// Build the list of what to remove
var remove []*route53.Tag
var remove []*route53.Tag
for _, t := range oldTags {
old, ok := create[*t.Key]
if !ok || old != *t.Value {
@ -69,9 +69,9 @@ func diffTagsR53(oldTags, newTags []*route53.Tag) ([]*route53.Tag, []*route53.Ta
// tagsFromMap returns the tags for the given map of data.
func tagsFromMapR53(m map[string]interface{}) []*route53.Tag {
result := make([]*route53.Tag, 0, len(m))
result := make([]*route53.Tag, 0, len(m))
for k, v := range m {
result = append(result, &route53.Tag{
result = append(result, &route53.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
})

View File

@ -5,7 +5,7 @@ import (
"reflect"
"testing"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/awslabs/aws-sdk-go/service/route53"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
@ -63,7 +63,7 @@ func TestDiffTagsR53(t *testing.T) {
// testAccCheckTags can be used to check the tags on a resource.
func testAccCheckTagsR53(
ts *[]*route53.Tag, key string, value string) resource.TestCheckFunc {
ts *[]*route53.Tag, key string, value string) resource.TestCheckFunc {
return func(s *terraform.State) error {
m := tagsToMapR53(*ts)
v, ok := m[key]