ISSUE 79: Create a more readable aws_route53_zone output
parent
738d2234ee
commit
04039f7aff
|
@ -1,5 +1,12 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (r *AwsRoute53Zone) String() string {
|
||||
return *r.Name
|
||||
if r.Name == nil {
|
||||
return r.TerraformId()
|
||||
}
|
||||
return fmt.Sprintf("%s (Id: %s)", *r.Name, r.TerraformId())
|
||||
}
|
||||
|
|
|
@ -12,11 +12,19 @@ func TestAwsRoute53Zone_String(t *testing.T) {
|
|||
zone AwsRoute53Zone
|
||||
want string
|
||||
}{
|
||||
{name: "",
|
||||
{name: "test route53 zone stringer with name and id",
|
||||
zone: AwsRoute53Zone{
|
||||
Name: aws.String("example.com"),
|
||||
Id: "Z04218102KCRRR1DWDYJT",
|
||||
},
|
||||
want: "example.com",
|
||||
want: "example.com (Id: Z04218102KCRRR1DWDYJT)",
|
||||
},
|
||||
{name: "test route53 zone stringer without name",
|
||||
zone: AwsRoute53Zone{
|
||||
Name: nil,
|
||||
Id: "Z04218102KCRRR1DWDYJT",
|
||||
},
|
||||
want: "Z04218102KCRRR1DWDYJT",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
|
Loading…
Reference in New Issue