From 101a2e64a78973f615ba1d859585a0185097435d Mon Sep 17 00:00:00 2001 From: James Kwon <96548424+hongil0316@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:06:30 -0400 Subject: [PATCH] migrate: aws v2 - vpc lattice --- aws/resources/ec2_dhcp_option.go | 2 +- aws/resources/ec2_dhcp_option_test.go | 10 +++++----- aws/resources/ec2_dhcp_option_types.go | 6 +++--- aws/resources/eventbridge_schedule_types.go | 2 +- aws/resources/iam.go | 12 ++++++------ aws/resources/route53_hostedzone_test.go | 16 ++++++++-------- aws/resources/route53_hostedzone_types.go | 8 ++++---- aws/resources/security_group_test.go | 6 +++--- aws/resources/ses_email_receiving_test.go | 6 +++--- .../vpc_lattice_service_network_types.go | 8 ++++---- aws/resources/vpc_lattice_target_group_types.go | 2 +- 11 files changed, 39 insertions(+), 39 deletions(-) diff --git a/aws/resources/ec2_dhcp_option.go b/aws/resources/ec2_dhcp_option.go index f3a7b334..5aa9d582 100644 --- a/aws/resources/ec2_dhcp_option.go +++ b/aws/resources/ec2_dhcp_option.go @@ -81,7 +81,7 @@ func (v *EC2DhcpOption) disAssociatedAttachedVpcs(identifier *string) error { logging.Debugf("[disAssociatedAttachedVpcs] detaching the dhcp option %s from %v", awsgo.StringValue(identifier), awsgo.StringValue(option.VpcId)) _, err := v.Client.AssociateDhcpOptionsWithContext(v.Context, &ec2.AssociateDhcpOptionsInput{ - VpcId: option.VpcId, + VpcId: option.VpcId, DhcpOptionsId: awsgo.String("default"), // The ID of the DHCP options set, or default to associate no DHCP options with the VPC. }) if err != nil { diff --git a/aws/resources/ec2_dhcp_option_test.go b/aws/resources/ec2_dhcp_option_test.go index 8ae5f2b5..7e5851f2 100644 --- a/aws/resources/ec2_dhcp_option_test.go +++ b/aws/resources/ec2_dhcp_option_test.go @@ -14,10 +14,10 @@ import ( type mockedEC2DhcpOption struct { ec2iface.EC2API - DescribeDhcpOptionsOutput ec2.DescribeDhcpOptionsOutput - DeleteDhcpOptionsOutput ec2.DeleteDhcpOptionsOutput - DescribeVpcsOutput ec2.DescribeVpcsOutput - AssociateDhcpOptionsOutput ec2.AssociateDhcpOptionsOutput + DescribeDhcpOptionsOutput ec2.DescribeDhcpOptionsOutput + DeleteDhcpOptionsOutput ec2.DeleteDhcpOptionsOutput + DescribeVpcsOutput ec2.DescribeVpcsOutput + AssociateDhcpOptionsOutput ec2.AssociateDhcpOptionsOutput } func (m mockedEC2DhcpOption) DescribeDhcpOptionsPagesWithContext(_ awsgo.Context, _ *ec2.DescribeDhcpOptionsInput, fn func(*ec2.DescribeDhcpOptionsOutput, bool) bool, _ ...request.Option) error { @@ -36,7 +36,7 @@ func (m mockedEC2DhcpOption) DeleteDhcpOptionsWithContext(_ awsgo.Context, _ *ec func (m mockedEC2DhcpOption) DescribeVpcsWithContext(awsgo.Context, *ec2.DescribeVpcsInput, ...request.Option) (*ec2.DescribeVpcsOutput, error) { return &m.DescribeVpcsOutput, nil } -func (m mockedEC2DhcpOption) AssociateDhcpOptionsWithContext(awsgo.Context, *ec2.AssociateDhcpOptionsInput, ...request.Option) (*ec2.AssociateDhcpOptionsOutput, error){ +func (m mockedEC2DhcpOption) AssociateDhcpOptionsWithContext(awsgo.Context, *ec2.AssociateDhcpOptionsInput, ...request.Option) (*ec2.AssociateDhcpOptionsOutput, error) { return &m.AssociateDhcpOptionsOutput, nil } diff --git a/aws/resources/ec2_dhcp_option_types.go b/aws/resources/ec2_dhcp_option_types.go index 12391043..7735f3c3 100644 --- a/aws/resources/ec2_dhcp_option_types.go +++ b/aws/resources/ec2_dhcp_option_types.go @@ -18,9 +18,9 @@ type DHCPOption struct { type EC2DhcpOption struct { BaseAwsResource - Client ec2iface.EC2API - Region string - VPCIds []string + Client ec2iface.EC2API + Region string + VPCIds []string DhcpOptions map[string]DHCPOption } diff --git a/aws/resources/eventbridge_schedule_types.go b/aws/resources/eventbridge_schedule_types.go index a1ef31fa..9b8e471c 100644 --- a/aws/resources/eventbridge_schedule_types.go +++ b/aws/resources/eventbridge_schedule_types.go @@ -16,7 +16,7 @@ type EventBridgeScheduleAPI interface { type EventBridgeSchedule struct { BaseAwsResource - Client EventBridgeScheduleAPI + Client EventBridgeScheduleAPI Region string Schedules []string } diff --git a/aws/resources/iam.go b/aws/resources/iam.go index 57777845..cd6e0cff 100644 --- a/aws/resources/iam.go +++ b/aws/resources/iam.go @@ -26,15 +26,15 @@ func (iu *IAMUsers) getAll(c context.Context, configObj config.Config) ([]*strin err := iu.Client.ListUsersPagesWithContext(iu.Context, input, func(page *iam.ListUsersOutput, lastPage bool) bool { for _, user := range page.Users { - // Note : - // IAM resource-listing operations return a subset of the available attributes for the resource. + // Note : + // IAM resource-listing operations return a subset of the available attributes for the resource. // This operation does not return the following attributes, even though they are an attribute of the returned object: // PermissionsBoundary - // Tags - // Referene : https://docs.aws.amazon.com/cli/latest/reference/iam/list-users.html - + // Tags + // Referene : https://docs.aws.amazon.com/cli/latest/reference/iam/list-users.html + var tags []*iam.Tag - iu.Client.ListUserTagsPagesWithContext(iu.Context,&iam.ListUserTagsInput{ + iu.Client.ListUserTagsPagesWithContext(iu.Context, &iam.ListUserTagsInput{ UserName: user.UserName, }, func(page *iam.ListUserTagsOutput, lastPage bool) bool { tags = append(tags, page.Tags...) diff --git a/aws/resources/route53_hostedzone_test.go b/aws/resources/route53_hostedzone_test.go index b004c038..52058019 100644 --- a/aws/resources/route53_hostedzone_test.go +++ b/aws/resources/route53_hostedzone_test.go @@ -52,12 +52,12 @@ func TestR53HostedZone_GetAll(t *testing.T) { testName1 := "Test name 01" testName2 := "Test name 02" rc := Route53HostedZone{ - HostedZonesDomains : map[string]*route53.HostedZone{ - testId1 : &route53.HostedZone{ - Name : awsgo.String(testName1), + HostedZonesDomains: map[string]*route53.HostedZone{ + testId1: &route53.HostedZone{ + Name: awsgo.String(testName1), }, - testId2 : &route53.HostedZone{ - Name : awsgo.String(testName2), + testId2: &route53.HostedZone{ + Name: awsgo.String(testName2), }, }, Client: mockedR53HostedZone{ @@ -111,9 +111,9 @@ func TestR53HostedZone_Nuke(t *testing.T) { t.Parallel() rc := Route53HostedZone{ - HostedZonesDomains : map[string]*route53.HostedZone{ - "collection-id-01" : &route53.HostedZone{ - Name : awsgo.String("domain.com"), + HostedZonesDomains: map[string]*route53.HostedZone{ + "collection-id-01": &route53.HostedZone{ + Name: awsgo.String("domain.com"), }, }, Client: mockedR53HostedZone{ diff --git a/aws/resources/route53_hostedzone_types.go b/aws/resources/route53_hostedzone_types.go index 7f636046..22dcea46 100644 --- a/aws/resources/route53_hostedzone_types.go +++ b/aws/resources/route53_hostedzone_types.go @@ -14,15 +14,15 @@ import ( // Route53HostedZone - represents all Route53HostedZone type Route53HostedZone struct { BaseAwsResource - Client route53iface.Route53API - Region string - Ids []string + Client route53iface.Route53API + Region string + Ids []string HostedZonesDomains map[string]*route53.HostedZone } func (r *Route53HostedZone) Init(session *session.Session) { r.Client = route53.New(session) - r.HostedZonesDomains = make(map[string]*route53.HostedZone,0) + r.HostedZonesDomains = make(map[string]*route53.HostedZone, 0) } // ResourceName - the simple name of the aws resource diff --git a/aws/resources/security_group_test.go b/aws/resources/security_group_test.go index f28a1f33..47e6a9d1 100644 --- a/aws/resources/security_group_test.go +++ b/aws/resources/security_group_test.go @@ -98,12 +98,12 @@ func TestSecurityGroup_GetAll(t *testing.T) { expected []string }{ "emptyFilter": { - ctx:ctx, + ctx: ctx, configObj: config.EC2ResourceType{}, expected: []string{testId1, testId2}, }, "nameExclusionFilter": { - ctx:ctx, + ctx: ctx, configObj: config.EC2ResourceType{ ResourceType: config.ResourceType{ ExcludeRule: config.FilterRule{ @@ -115,7 +115,7 @@ func TestSecurityGroup_GetAll(t *testing.T) { expected: []string{testId2}, }, "timeAfterExclusionFilter": { - ctx:ctx, + ctx: ctx, configObj: config.EC2ResourceType{ ResourceType: config.ResourceType{ ExcludeRule: config.FilterRule{ diff --git a/aws/resources/ses_email_receiving_test.go b/aws/resources/ses_email_receiving_test.go index 821da369..9d8f7475 100644 --- a/aws/resources/ses_email_receiving_test.go +++ b/aws/resources/ses_email_receiving_test.go @@ -17,9 +17,9 @@ import ( type mockedSesReceiptRule struct { sesiface.SESAPI - DeleteReceiptRuleSetOutput ses.DeleteReceiptRuleSetOutput - ListReceiptRuleSetsOutput ses.ListReceiptRuleSetsOutput - DescribeActiveReceiptRuleSetOutput ses.DescribeActiveReceiptRuleSetOutput + DeleteReceiptRuleSetOutput ses.DeleteReceiptRuleSetOutput + ListReceiptRuleSetsOutput ses.ListReceiptRuleSetsOutput + DescribeActiveReceiptRuleSetOutput ses.DescribeActiveReceiptRuleSetOutput } func (m mockedSesReceiptRule) ListReceiptRuleSetsWithContext(_ awsgo.Context, _ *ses.ListReceiptRuleSetsInput, _ ...request.Option) (*ses.ListReceiptRuleSetsOutput, error) { diff --git a/aws/resources/vpc_lattice_service_network_types.go b/aws/resources/vpc_lattice_service_network_types.go index 734d12b4..07c483bf 100644 --- a/aws/resources/vpc_lattice_service_network_types.go +++ b/aws/resources/vpc_lattice_service_network_types.go @@ -9,11 +9,11 @@ import ( "github.com/gruntwork-io/go-commons/errors" ) -type VPCLatticeServiceNetworkAPI interface{ +type VPCLatticeServiceNetworkAPI interface { ListServiceNetworks(ctx context.Context, params *vpclattice.ListServiceNetworksInput, optFns ...func(*vpclattice.Options)) (*vpclattice.ListServiceNetworksOutput, error) - DeleteServiceNetwork(ctx context.Context, params *vpclattice.DeleteServiceNetworkInput, optFns ...func(*vpclattice.Options)) (*vpclattice.DeleteServiceNetworkOutput, error) - ListServiceNetworkServiceAssociations(ctx context.Context, params *vpclattice.ListServiceNetworkServiceAssociationsInput, optFns ...func(*vpclattice.Options)) (*vpclattice.ListServiceNetworkServiceAssociationsOutput, error) - DeleteServiceNetworkServiceAssociation(ctx context.Context, params *vpclattice.DeleteServiceNetworkServiceAssociationInput, optFns ...func(*vpclattice.Options)) (*vpclattice.DeleteServiceNetworkServiceAssociationOutput, error) + DeleteServiceNetwork(ctx context.Context, params *vpclattice.DeleteServiceNetworkInput, optFns ...func(*vpclattice.Options)) (*vpclattice.DeleteServiceNetworkOutput, error) + ListServiceNetworkServiceAssociations(ctx context.Context, params *vpclattice.ListServiceNetworkServiceAssociationsInput, optFns ...func(*vpclattice.Options)) (*vpclattice.ListServiceNetworkServiceAssociationsOutput, error) + DeleteServiceNetworkServiceAssociation(ctx context.Context, params *vpclattice.DeleteServiceNetworkServiceAssociationInput, optFns ...func(*vpclattice.Options)) (*vpclattice.DeleteServiceNetworkServiceAssociationOutput, error) } type VPCLatticeServiceNetwork struct { diff --git a/aws/resources/vpc_lattice_target_group_types.go b/aws/resources/vpc_lattice_target_group_types.go index 88281a97..8c024bc9 100644 --- a/aws/resources/vpc_lattice_target_group_types.go +++ b/aws/resources/vpc_lattice_target_group_types.go @@ -27,7 +27,7 @@ type VPCLatticeTargetGroup struct { func (sch *VPCLatticeTargetGroup) InitV2(cfg awsgo.Config) { sch.Client = vpclattice.NewFromConfig(cfg) - sch.TargetGroups = make(map[string]*types.TargetGroupSummary,0) + sch.TargetGroups = make(map[string]*types.TargetGroupSummary, 0) } func (sch *VPCLatticeTargetGroup) IsUsingV2() bool { return true }