cloudmock - use ResourceType constants that are now in aws-sdk-go

This commit is contained in:
Peter Rifel 2020-07-07 21:39:49 -05:00
parent 58abaac891
commit 7e34e786ce
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
2 changed files with 4 additions and 10 deletions

View File

@ -128,7 +128,7 @@ func (m *MockEC2) DescribeNatGateways(request *ec2.DescribeNatGatewaysInput) (*e
}
default:
if strings.HasPrefix(*filter.Name, "tag:") {
match = m.hasTag(ResourceTypeNatGateway, *ngw.NatGatewayId, filter)
match = m.hasTag(ec2.ResourceTypeNatgateway, *ngw.NatGatewayId, filter)
} else {
return nil, fmt.Errorf("unknown filter name: %q", *filter.Name)
}
@ -145,7 +145,7 @@ func (m *MockEC2) DescribeNatGateways(request *ec2.DescribeNatGatewaysInput) (*e
}
copy := *ngw
copy.Tags = m.getTags(ResourceTypeNatGateway, id)
copy.Tags = m.getTags(ec2.ResourceTypeNatgateway, id)
ngws = append(ngws, &copy)
}

View File

@ -27,12 +27,6 @@ import (
"k8s.io/klog"
)
const (
// Not (yet?) in aws-sdk-go
ResourceTypeNatGateway = "nat-gateway"
ResourceTypeAddress = "elastic-ip"
)
func (m *MockEC2) CreateTagsRequest(*ec2.CreateTagsInput) (*request.Request, *ec2.CreateTagsOutput) {
panic("Not implemented")
}
@ -70,13 +64,13 @@ func (m *MockEC2) addTag(resourceId string, tag *ec2.Tag) {
} else if strings.HasPrefix(resourceId, "igw-") {
resourceType = ec2.ResourceTypeInternetGateway
} else if strings.HasPrefix(resourceId, "nat-") {
resourceType = ResourceTypeNatGateway
resourceType = ec2.ResourceTypeNatgateway
} else if strings.HasPrefix(resourceId, "dopt-") {
resourceType = ec2.ResourceTypeDhcpOptions
} else if strings.HasPrefix(resourceId, "rtb-") {
resourceType = ec2.ResourceTypeRouteTable
} else if strings.HasPrefix(resourceId, "eipalloc-") {
resourceType = ResourceTypeAddress
resourceType = ec2.ResourceTypeElasticIp
} else {
klog.Fatalf("Unknown resource-type in create tags: %v", resourceId)
}