1package awsat 2 3import ( 4 "testing" 5 6 "github.com/aws/aws-sdk-go/service/route53" 7) 8 9/* 10 Callerreference *string `awsName:"CallerReference" awsType:"awsstr" templateName:"callerreference" required:""` 11 Name *string `awsName:"Name" awsType:"awsstr" templateName:"name" required:""` 12 Delegationsetid *string `awsName:"DelegationSetId" awsType:"awsstr" templateName:"delegationsetid"` 13 Comment *string `awsName:"HostedZoneConfig.Comment" awsType:"awsstr" templateName:"comment"` 14 Isprivate *bool `awsName:"HostedZoneConfig.PrivateZone" awsType:"awsbool" templateName:"isprivate"` 15 Vpcid *string `awsName:"VPC.VPCId" awsType:"awsstr" templateName:"vpcid"` 16 Vpcregion *string `awsName:"VPC.VPCRegion" awsType:"awsstr" templateName:"vpcregion"` 17 18*/ 19 20func TestZone(t *testing.T) { 21 t.Run("create", func(t *testing.T) { 22 Template(`create zone callerreference=caller name=new-zone delegationsetid=1234 comment="new zone" isprivate=true vpcid=any-vpc vpcregion=us-west-2`).Mock(&route53Mock{ 23 CreateHostedZoneFunc: func(input *route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error) { 24 return &route53.CreateHostedZoneOutput{ 25 HostedZone: &route53.HostedZone{Id: String("new-zone-id")}, 26 }, nil 27 }, 28 }).ExpectInput("CreateHostedZone", &route53.CreateHostedZoneInput{ 29 CallerReference: String("caller"), 30 DelegationSetId: String("1234"), 31 HostedZoneConfig: &route53.HostedZoneConfig{ 32 Comment: String("new zone"), 33 PrivateZone: Bool(true), 34 }, 35 Name: String("new-zone"), 36 VPC: &route53.VPC{VPCId: String("any-vpc"), VPCRegion: String("us-west-2")}, 37 }).ExpectCalls("CreateHostedZone").Run(t) 38 }) 39 40 t.Run("delete", func(t *testing.T) { 41 Template("delete zone id=any-zone-id").Mock(&route53Mock{ 42 DeleteHostedZoneFunc: func(input *route53.DeleteHostedZoneInput) (*route53.DeleteHostedZoneOutput, error) { 43 return nil, nil 44 }, 45 }).ExpectInput("DeleteHostedZone", &route53.DeleteHostedZoneInput{ 46 Id: String("any-zone-id"), 47 }).ExpectCalls("DeleteHostedZone").Run(t) 48 }) 49} 50