Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Outposts resources to AWS SDK V2 #38075

Merged
merged 32 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d6d5072
feat: migrated d/ec2_outposts_coip_pool to SDKv2
DanielRieske Jun 22, 2024
2f79ee4
feat: migrated d/ec2_outposts_coip_pools to SDKv2
DanielRieske Jun 22, 2024
b182e74
feat: migrated d/ec2_outposts_local_gateway to SDKv2
DanielRieske Jun 22, 2024
30b7383
feat: migrated d/ec2_outposts_local_gateway_route_table to SDKv2
DanielRieske Jun 22, 2024
6772be7
feat: migrated r/ec2_outposts_local_gateway_route_table_vpc_associati…
DanielRieske Jun 22, 2024
91afc73
feat: migrated r/ec2_outposts_local_gateway_route to SDKv2
DanielRieske Jun 22, 2024
144a087
feat: migrated d/ec2_outposts_local_gateways to SDKv2
DanielRieske Jun 22, 2024
a946086
feat: migrated d/ec2_outposts_local_gateway_route_tables to SDKv2
DanielRieske Jun 22, 2024
05c6592
feat: migrated d/ec2_outposts_local_gateway_virtual_interface to SDKv2
DanielRieske Jun 22, 2024
96a05c0
feat: migrated d/ec2_outposts_local_gateway_virtual_interface_group t…
DanielRieske Jun 22, 2024
86aff35
feat: migrated d/ec2_outposts_local_gateway_virtual_interface_groups …
DanielRieske Jun 22, 2024
b21e1b2
feat: migrate relevant wait functions to SDKv2
DanielRieske Jun 22, 2024
d6441d6
feat: migrate relevant status functions to SDKv2
DanielRieske Jun 22, 2024
5beb567
feat: migrate relevant find functions to SDKv2
DanielRieske Jun 22, 2024
f6106bd
feat: reduce visibility
DanielRieske Jun 22, 2024
a6e3946
feat: run `make gen`
DanielRieske Jun 22, 2024
e327f54
fix: format type of error message
DanielRieske Jun 22, 2024
d909fc3
feat: cleanup unused find functions
DanielRieske Jun 22, 2024
77bf95b
Merge branch 'main' into HEAD
ewbankkit Jun 26, 2024
c40d072
d/aws_ec2_coip_pool: Tidy up.
ewbankkit Jun 26, 2024
4d4405b
d/aws_ec2_coip_pools: Tidy up.
ewbankkit Jun 26, 2024
dcd9583
d/aws_ec2_local_gateway: Tidy up.
ewbankkit Jun 26, 2024
7ae039b
d/aws_ec2_local_gateway_route_table: Tidy up.
ewbankkit Jun 26, 2024
892443e
d/aws_ec2_local_gateway_route_tables: Tidy up.
ewbankkit Jun 26, 2024
0ef2a07
r/aws_ec2_local_gateway_route_table_vpc_association: Tidy up.
ewbankkit Jun 26, 2024
5f91248
r/aws_ec2_local_gateway_route: Tidy up.
ewbankkit Jun 26, 2024
e72f2d1
d/aws_ec2_local_gateway_virtual_interface: Tidy up.
ewbankkit Jun 27, 2024
59dfba2
d/aws_ec2_local_gateway_virtual_interface_group: Tidy up.
ewbankkit Jun 27, 2024
7c720f4
d/aws_ec2_local_gateway_virtual_interface_groups: Tidy up.
ewbankkit Jun 27, 2024
f5aa849
d/aws_ec2_local_gateways: Tidy up.
ewbankkit Jun 27, 2024
073e3c7
Fix semgrep 'ci.caps5-in-const-name' and 'ci.caps5-in-var-name'.
ewbankkit Jun 27, 2024
d7b1b9b
Fix golangci-lint 'SA4010: this result of append is never used, excep…
ewbankkit Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/service/ec2/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const (
errCodeInvalidLaunchTemplateIdNotFound = "InvalidLaunchTemplateId.NotFound"
errCodeInvalidLaunchTemplateIdVersionNotFound = "InvalidLaunchTemplateId.VersionNotFound"
errCodeInvalidLaunchTemplateNameNotFoundException = "InvalidLaunchTemplateName.NotFoundException"
errCodeInvalidLocalGatewayRouteTableIDNotFound = "InvalidLocalGatewayRouteTableID.NotFound"
errCodeInvalidLocalGatewayRouteTableVPCAssociationIDNotFound = "InvalidLocalGatewayRouteTableVpcAssociationID.NotFound"
errCodeInvalidNetworkACLEntryNotFound = "InvalidNetworkAclEntry.NotFound"
errCodeInvalidNetworkACLIDNotFound = "InvalidNetworkAclID.NotFound"
errCodeInvalidNetworkInsightsAnalysisIdNotFound = "InvalidNetworkInsightsAnalysisId.NotFound"
Expand Down
4 changes: 4 additions & 0 deletions internal/service/ec2/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ var (
ResourceInstanceState = resourceInstanceState
ResourceKeyPair = resourceKeyPair
ResourceLaunchTemplate = resourceLaunchTemplate
ResourceLocalGatewayRoute = resourceLocalGatewayRoute
ResourceLocalGatewayRouteTableVPCAssociation = resourceLocalGatewayRouteTableVPCAssociation
ResourceMainRouteTableAssociation = resourceMainRouteTableAssociation
ResourceNetworkACL = resourceNetworkACL
ResourceNetworkACLRule = resourceNetworkACLRule
Expand Down Expand Up @@ -123,6 +125,8 @@ var (
FindInstanceStateByID = findInstanceStateByID
FindKeyPairByName = findKeyPairByName
FindLaunchTemplateByID = findLaunchTemplateByID
FindLocalGatewayRouteByTwoPartKey = findLocalGatewayRouteByTwoPartKey
FindLocalGatewayRouteTableVPCAssociationByID = findLocalGatewayRouteTableVPCAssociationByID
FindMainRouteTableAssociationByID = findMainRouteTableAssociationByID
FindNetworkACLByIDV2 = findNetworkACLByID
FindNetworkInsightsAnalysisByID = findNetworkInsightsAnalysisByID
Expand Down
143 changes: 0 additions & 143 deletions internal/service/ec2/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,149 +19,6 @@ import (
// Move functions to findv2.go as they are migrated to AWS SDK for Go v2.
//

func FindCOIPPools(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeCoipPoolsInput) ([]*ec2.CoipPool, error) {
var output []*ec2.CoipPool

err := conn.DescribeCoipPoolsPagesWithContext(ctx, input, func(page *ec2.DescribeCoipPoolsOutput, lastPage bool) bool {
if page == nil {
return !lastPage
}

for _, v := range page.CoipPools {
if v != nil {
output = append(output, v)
}
}

return !lastPage
})

if tfawserr.ErrCodeEquals(err, errCodeInvalidPoolIDNotFound) {
return nil, &retry.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

return output, nil
}

func FindCOIPPool(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeCoipPoolsInput) (*ec2.CoipPool, error) {
output, err := FindCOIPPools(ctx, conn, input)

if err != nil {
return nil, err
}

return tfresource.AssertSinglePtrResult(output)
}

func FindLocalGatewayRouteTables(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeLocalGatewayRouteTablesInput) ([]*ec2.LocalGatewayRouteTable, error) {
var output []*ec2.LocalGatewayRouteTable

err := conn.DescribeLocalGatewayRouteTablesPagesWithContext(ctx, input, func(page *ec2.DescribeLocalGatewayRouteTablesOutput, lastPage bool) bool {
if page == nil {
return !lastPage
}

for _, v := range page.LocalGatewayRouteTables {
if v != nil {
output = append(output, v)
}
}

return !lastPage
})

if err != nil {
return nil, err
}

return output, nil
}

func FindLocalGatewayRouteTable(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeLocalGatewayRouteTablesInput) (*ec2.LocalGatewayRouteTable, error) {
output, err := FindLocalGatewayRouteTables(ctx, conn, input)

if err != nil {
return nil, err
}

return tfresource.AssertSinglePtrResult(output)
}

func FindLocalGatewayVirtualInterfaceGroups(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeLocalGatewayVirtualInterfaceGroupsInput) ([]*ec2.LocalGatewayVirtualInterfaceGroup, error) {
var output []*ec2.LocalGatewayVirtualInterfaceGroup

err := conn.DescribeLocalGatewayVirtualInterfaceGroupsPagesWithContext(ctx, input, func(page *ec2.DescribeLocalGatewayVirtualInterfaceGroupsOutput, lastPage bool) bool {
if page == nil {
return !lastPage
}

for _, v := range page.LocalGatewayVirtualInterfaceGroups {
if v != nil {
output = append(output, v)
}
}

return !lastPage
})

if err != nil {
return nil, err
}

return output, nil
}

func FindLocalGatewayVirtualInterfaceGroup(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeLocalGatewayVirtualInterfaceGroupsInput) (*ec2.LocalGatewayVirtualInterfaceGroup, error) {
output, err := FindLocalGatewayVirtualInterfaceGroups(ctx, conn, input)

if err != nil {
return nil, err
}

return tfresource.AssertSinglePtrResult(output)
}

func FindLocalGateways(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeLocalGatewaysInput) ([]*ec2.LocalGateway, error) {
var output []*ec2.LocalGateway

err := conn.DescribeLocalGatewaysPagesWithContext(ctx, input, func(page *ec2.DescribeLocalGatewaysOutput, lastPage bool) bool {
if page == nil {
return !lastPage
}

for _, v := range page.LocalGateways {
if v != nil {
output = append(output, v)
}
}

return !lastPage
})

if err != nil {
return nil, err
}

return output, nil
}

func FindLocalGateway(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeLocalGatewaysInput) (*ec2.LocalGateway, error) {
output, err := FindLocalGateways(ctx, conn, input)

if err != nil {
return nil, err
}

return tfresource.AssertSinglePtrResult(output)
}

func FindNetworkACL(ctx context.Context, conn *ec2.EC2, input *ec2.DescribeNetworkAclsInput) (*ec2.NetworkAcl, error) {
output, err := FindNetworkACLs(ctx, conn, input)

Expand Down
Loading
Loading