From 7e34e786cec46874c33edff55ee3699a6e551dad Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Tue, 7 Jul 2020 21:39:49 -0500 Subject: [PATCH] cloudmock - use ResourceType constants that are now in aws-sdk-go --- cloudmock/aws/mockec2/natgateway.go | 4 ++-- cloudmock/aws/mockec2/tags.go | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cloudmock/aws/mockec2/natgateway.go b/cloudmock/aws/mockec2/natgateway.go index 82fe5507a2..d9ffddad9a 100644 --- a/cloudmock/aws/mockec2/natgateway.go +++ b/cloudmock/aws/mockec2/natgateway.go @@ -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, ©) } diff --git a/cloudmock/aws/mockec2/tags.go b/cloudmock/aws/mockec2/tags.go index f0f3a22f03..294e9a9b82 100644 --- a/cloudmock/aws/mockec2/tags.go +++ b/cloudmock/aws/mockec2/tags.go @@ -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) }