Skip to content

Commit 30819be

Browse files
committed
fixed linters
1 parent 1da7f93 commit 30819be

File tree

7 files changed

+38
-133
lines changed

7 files changed

+38
-133
lines changed

internal/service/odb/network_peering_connection.go

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
1-
//Copyright © 2025, Oracle and/or its affiliates. All rights reserved.
1+
//Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
22

33
package odb
44

55
import (
66
"context"
77
"errors"
8-
"github.com/hashicorp/terraform-provider-aws/internal/enum"
9-
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
108
"strings"
119
"time"
1210

13-
"github.com/aws/aws-sdk-go-v2/aws"
11+
"github.com/aws/aws-sdk-go-v2/aws/arn"
1412
"github.com/aws/aws-sdk-go-v2/service/odb"
1513
odbtypes "github.com/aws/aws-sdk-go-v2/service/odb/types"
1614
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
17-
1815
"github.com/hashicorp/terraform-plugin-framework/path"
1916
"github.com/hashicorp/terraform-plugin-framework/resource"
2017
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
2118
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
2219
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
23-
24-
"github.com/aws/aws-sdk-go-v2/aws/arn"
2520
"github.com/hashicorp/terraform-plugin-framework/types"
2621
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
27-
"github.com/hashicorp/terraform-provider-aws/internal/conns"
2822
"github.com/hashicorp/terraform-provider-aws/internal/create"
23+
"github.com/hashicorp/terraform-provider-aws/internal/enum"
2924
"github.com/hashicorp/terraform-provider-aws/internal/errs"
3025
"github.com/hashicorp/terraform-provider-aws/internal/errs/fwdiag"
3126
"github.com/hashicorp/terraform-provider-aws/internal/framework"
3227
"github.com/hashicorp/terraform-provider-aws/internal/framework/flex"
3328
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
34-
"github.com/hashicorp/terraform-provider-aws/internal/sweep"
35-
sweepfw "github.com/hashicorp/terraform-provider-aws/internal/sweep/framework"
29+
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
3630
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
3731
"github.com/hashicorp/terraform-provider-aws/names"
3832
)
@@ -137,23 +131,19 @@ func (r *resourceNetworkPeeringConnection) Schema(ctx context.Context, req resou
137131

138132
func (r *resourceNetworkPeeringConnection) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
139133
conn := r.Meta().ODBClient(ctx)
140-
141134
var plan odbNetworkPeeringConnectionResourceModel
142135
resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)
143136
if resp.Diagnostics.HasError() {
144137
return
145138
}
146-
147139
input := odb.CreateOdbPeeringConnectionInput{
148140
OdbNetworkId: plan.OdbNetworkId.ValueStringPointer(),
149141
PeerNetworkId: plan.PeerNetworkId.ValueStringPointer(),
150142
DisplayName: plan.DisplayName.ValueStringPointer(),
151143
Tags: getTagsIn(ctx),
152144
}
153-
154145
out, err := conn.CreateOdbPeeringConnection(ctx, &input)
155146
if err != nil {
156-
157147
resp.Diagnostics.AddError(
158148
create.ProblemStandardMessage(names.ODB, create.ErrActionCreating, ResNameNetworkPeeringConnection, plan.DisplayName.ValueString(), err),
159149
err.Error(),
@@ -167,12 +157,10 @@ func (r *resourceNetworkPeeringConnection) Create(ctx context.Context, req resou
167157
)
168158
return
169159
}
170-
171160
resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...)
172161
if resp.Diagnostics.HasError() {
173162
return
174163
}
175-
176164
createTimeout := r.CreateTimeout(ctx, plan.Timeouts)
177165
createdPeeredConnection, err := waitNetworkPeeringConnectionCreated(ctx, conn, plan.OdbPeeringConnectionId.ValueString(), createTimeout)
178166
if err != nil {
@@ -187,7 +175,6 @@ func (r *resourceNetworkPeeringConnection) Create(ctx context.Context, req resou
187175
if resp.Diagnostics.HasError() {
188176
return
189177
}
190-
191178
resp.Diagnostics.Append(resp.State.Set(ctx, plan)...)
192179
}
193180

@@ -244,14 +231,12 @@ func (r *resourceNetworkPeeringConnection) Read(ctx context.Context, req resourc
244231

245232
func (r *resourceNetworkPeeringConnection) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
246233
conn := r.Meta().ODBClient(ctx)
247-
248234
var plan, state odbNetworkPeeringConnectionResourceModel
249235
resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)
250236
resp.Diagnostics.Append(req.State.Get(ctx, &state)...)
251237
if resp.Diagnostics.HasError() {
252238
return
253239
}
254-
255240
updateTimeout := r.UpdateTimeout(ctx, plan.Timeouts)
256241
updatedOdbNetPeeringConn, err := waitNetworkPeeringConnectionUpdated(ctx, conn, plan.OdbPeeringConnectionId.ValueString(), updateTimeout)
257242
if err != nil {
@@ -269,7 +254,6 @@ func (r *resourceNetworkPeeringConnection) Update(ctx context.Context, req resou
269254
)
270255
return
271256
}
272-
273257
peerVpcARN, err := arn.Parse(*updatedOdbNetPeeringConn.PeerNetworkArn)
274258
if err != nil {
275259
resp.Diagnostics.AddError(
@@ -300,14 +284,11 @@ func (r *resourceNetworkPeeringConnection) Delete(ctx context.Context, req resou
300284
input := odb.DeleteOdbPeeringConnectionInput{
301285
OdbPeeringConnectionId: state.OdbPeeringConnectionId.ValueStringPointer(),
302286
}
303-
304287
_, err := conn.DeleteOdbPeeringConnection(ctx, &input)
305-
306288
if err != nil {
307289
if errs.IsA[*odbtypes.ResourceNotFoundException](err) {
308290
return
309291
}
310-
311292
resp.Diagnostics.AddError(
312293
create.ProblemStandardMessage(names.ODB, create.ErrActionDeleting, ResNameNetworkPeeringConnection, state.OdbPeeringConnectionId.ValueString(), err),
313294
err.Error(),
@@ -378,7 +359,6 @@ func waitNetworkPeeringConnectionDeleted(ctx context.Context, conn *odb.Client,
378359
if out, ok := outputRaw.(*odbtypes.OdbPeeringConnection); ok {
379360
return out, err
380361
}
381-
382362
return nil, err
383363
}
384364

@@ -388,11 +368,9 @@ func statusNetworkPeeringConnection(ctx context.Context, conn *odb.Client, id st
388368
if tfresource.NotFound(err) {
389369
return nil, "", nil
390370
}
391-
392371
if err != nil {
393372
return nil, "", err
394373
}
395-
396374
return out, string(out.Status), nil
397375
}
398376
}
@@ -439,25 +417,3 @@ type odbNetworkPeeringConnectionResourceModel struct {
439417
Tags tftags.Map `tfsdk:"tags"`
440418
TagsAll tftags.Map `tfsdk:"tags_all"`
441419
}
442-
443-
func sweepNetworkPeeringConnections(ctx context.Context, client *conns.AWSClient) ([]sweep.Sweepable, error) {
444-
input := odb.ListOdbPeeringConnectionsInput{}
445-
conn := client.ODBClient(ctx)
446-
var sweepResources []sweep.Sweepable
447-
448-
pages := odb.NewListOdbPeeringConnectionsPaginator(conn, &input)
449-
for pages.HasMorePages() {
450-
page, err := pages.NextPage(ctx)
451-
if err != nil {
452-
return nil, err
453-
}
454-
455-
for _, v := range page.OdbPeeringConnections {
456-
sweepResources = append(sweepResources, sweepfw.NewSweepResource(newResourceNetworkPeeringConnection, client,
457-
sweepfw.NewAttribute(names.AttrID, aws.ToString(v.OdbPeeringConnectionId))),
458-
)
459-
}
460-
}
461-
462-
return sweepResources, nil
463-
}

internal/service/odb/network_peering_connection_data_source.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
//Copyright © 2025, Oracle and/or its affiliates. All rights reserved.
1+
//Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
22

33
package odb
44

55
import (
66
"context"
7-
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
87
"time"
98

109
"github.com/aws/aws-sdk-go-v2/service/odb"
1110
odbtypes "github.com/aws/aws-sdk-go-v2/service/odb/types"
12-
1311
"github.com/hashicorp/terraform-plugin-framework/datasource"
1412
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1513
"github.com/hashicorp/terraform-plugin-framework/types"
1614
"github.com/hashicorp/terraform-provider-aws/internal/create"
1715
"github.com/hashicorp/terraform-provider-aws/internal/framework"
1816
"github.com/hashicorp/terraform-provider-aws/internal/framework/flex"
1917
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
18+
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
2019
"github.com/hashicorp/terraform-provider-aws/names"
2120
)
2221

@@ -84,7 +83,6 @@ func (d *dataSourceNetworkPeeringConnection) Schema(ctx context.Context, req dat
8483
}
8584

8685
func (d *dataSourceNetworkPeeringConnection) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
87-
8886
conn := d.Meta().ODBClient(ctx)
8987
var data odbNetworkPeeringConnectionDataSourceModel
9088
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)

internal/service/odb/network_peering_connection_data_source_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
//Copyright © 2025, Oracle and/or its affiliates. All rights reserved.
1+
//Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
22

33
package odb_test
44

55
import (
66
"context"
77
"errors"
88
"fmt"
9+
"testing"
10+
911
"github.com/aws/aws-sdk-go-v2/service/odb"
1012
odbtypes "github.com/aws/aws-sdk-go-v2/service/odb/types"
1113
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
@@ -19,7 +21,6 @@ import (
1921
tfodb "github.com/hashicorp/terraform-provider-aws/internal/service/odb"
2022
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
2123
"github.com/hashicorp/terraform-provider-aws/names"
22-
"testing"
2324
)
2425

2526
type odbPeeringDataSourceTest struct {
@@ -36,7 +37,6 @@ var odbPeeringDSTest = odbPeeringDataSourceTest{
3637

3738
// Acceptance test access AWS and cost money to run.
3839
func TestAccODBNetworkPeeringConnectionDataSource_basic(t *testing.T) {
39-
4040
ctx := acctest.Context(t)
4141
if testing.Short() {
4242
t.Skip("skipping long-running test in short mode")
@@ -46,7 +46,6 @@ func TestAccODBNetworkPeeringConnectionDataSource_basic(t *testing.T) {
4646
odbNetPeeringDisplayName := sdkacctest.RandomWithPrefix(odbPeeringDSTest.odbNetworkPeeringDisplayNamePrefix)
4747
odbNetDispName := sdkacctest.RandomWithPrefix(odbPeeringDSTest.odbNetDisplayNamePrefix)
4848
vpcName := sdkacctest.RandomWithPrefix(odbPeeringDSTest.vpcNamePrefix)
49-
5049
resource.Test(t, resource.TestCase{
5150
PreCheck: func() {
5251
acctest.PreCheck(ctx, t)
@@ -68,7 +67,6 @@ func TestAccODBNetworkPeeringConnectionDataSource_basic(t *testing.T) {
6867
func (odbPeeringDataSourceTest) testAccCheckCloudOdbNetworkPeeringDestroy(ctx context.Context) resource.TestCheckFunc {
6968
return func(s *terraform.State) error {
7069
conn := acctest.Provider.Meta().(*conns.AWSClient).ODBClient(ctx)
71-
7270
for _, rs := range s.RootModule().Resources {
7371
if rs.Type != "aws_odb_network_peering_connection" {
7472
continue
@@ -81,10 +79,8 @@ func (odbPeeringDataSourceTest) testAccCheckCloudOdbNetworkPeeringDestroy(ctx co
8179
}
8280
return create.Error(names.ODB, create.ErrActionCheckingDestroyed, tfodb.DSNameNetworkPeeringConnection, rs.Primary.ID, err)
8381
}
84-
8582
return create.Error(names.ODB, create.ErrActionCheckingDestroyed, tfodb.DSNameNetworkPeeringConnection, rs.Primary.ID, errors.New("not destroyed"))
8683
}
87-
8884
return nil
8985
}
9086
}
@@ -110,7 +106,6 @@ func (odbPeeringDataSourceTest) findOdbPeering(ctx context.Context, conn *odb.Cl
110106
return out, nil
111107
}
112108
func (odbPeeringDataSourceTest) basicPeeringConfig(vpcName, odbNetDisplayName, odbPeeringDisplayName string) string {
113-
114109
testData := fmt.Sprintf(`
115110
116111
resource "aws_vpc" "test" {

internal/service/odb/network_peering_connection_test.go

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
//Copyright © 2025, Oracle and/or its affiliates. All rights reserved.
1+
//Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
22

33
package odb_test
44

55
import (
66
"context"
77
"errors"
88
"fmt"
9-
odbtypes "github.com/aws/aws-sdk-go-v2/service/odb/types"
10-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
11-
"github.com/hashicorp/terraform-provider-aws/internal/errs"
12-
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
139
"testing"
1410

1511
"github.com/aws/aws-sdk-go-v2/service/odb"
12+
odbtypes "github.com/aws/aws-sdk-go-v2/service/odb/types"
13+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
1614
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
1715
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1816
"github.com/hashicorp/terraform-plugin-testing/terraform"
1917
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
2018
"github.com/hashicorp/terraform-provider-aws/internal/conns"
2119
"github.com/hashicorp/terraform-provider-aws/internal/create"
22-
"github.com/hashicorp/terraform-provider-aws/names"
23-
20+
"github.com/hashicorp/terraform-provider-aws/internal/errs"
2421
tfodb "github.com/hashicorp/terraform-provider-aws/internal/service/odb"
22+
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
23+
"github.com/hashicorp/terraform-provider-aws/names"
2524
)
2625

2726
type odbNwkPeeringResourceTest struct {
@@ -75,7 +74,7 @@ func TestAccODBNetworkPeeringConnection_basic(t *testing.T) {
7574
})
7675
}
7776

78-
func TestAccODBNetworkPeeringConnectionAddRemoveTag(t *testing.T) {
77+
func TestAccODBNetworkPeeringConnection_tagging(t *testing.T) {
7978
ctx := acctest.Context(t)
8079

8180
if testing.Short() {
@@ -162,23 +161,19 @@ func TestAccODBNetworkPeeringConnection_disappears(t *testing.T) {
162161
func (odbNwkPeeringResourceTest) testAccCheckNetworkPeeringConnectionDestroy(ctx context.Context) resource.TestCheckFunc {
163162
return func(s *terraform.State) error {
164163
conn := acctest.Provider.Meta().(*conns.AWSClient).ODBClient(ctx)
165-
166164
for _, rs := range s.RootModule().Resources {
167165
if rs.Type != "aws_odb_network_peering_connection" {
168166
continue
169167
}
170-
171168
_, err := odbNwkPeeringTestResource.findOdbPeering(ctx, conn, rs.Primary.ID)
172169
if tfresource.NotFound(err) {
173170
return nil
174171
}
175172
if err != nil {
176173
return create.Error(names.ODB, create.ErrActionCheckingDestroyed, tfodb.ResNameNetworkPeeringConnection, rs.Primary.ID, err)
177174
}
178-
179175
return create.Error(names.ODB, create.ErrActionCheckingDestroyed, tfodb.ResNameNetworkPeeringConnection, rs.Primary.ID, errors.New("not destroyed"))
180176
}
181-
182177
return nil
183178
}
184179
}
@@ -189,31 +184,24 @@ func testAccCheckNetworkPeeringConnectionExists(ctx context.Context, name string
189184
if !ok {
190185
return create.Error(names.ODB, create.ErrActionCheckingExistence, tfodb.ResNameNetworkPeeringConnection, name, errors.New("not found"))
191186
}
192-
193187
if rs.Primary.ID == "" {
194188
return create.Error(names.ODB, create.ErrActionCheckingExistence, tfodb.ResNameNetworkPeeringConnection, name, errors.New("not set"))
195189
}
196-
197190
conn := acctest.Provider.Meta().(*conns.AWSClient).ODBClient(ctx)
198191

199192
resp, err := odbNwkPeeringTestResource.findOdbPeering(ctx, conn, rs.Primary.ID)
200193
if err != nil {
201194
return create.Error(names.ODB, create.ErrActionCheckingExistence, tfodb.ResNameNetworkPeeringConnection, rs.Primary.ID, err)
202195
}
203-
204196
*odbPeeringConnection = *resp
205-
206197
return nil
207198
}
208199
}
209200

210201
func (odbNwkPeeringResourceTest) testAccPreCheck(ctx context.Context, t *testing.T) {
211202
conn := acctest.Provider.Meta().(*conns.AWSClient).ODBClient(ctx)
212-
213-
input := &odb.ListOdbPeeringConnectionsInput{}
214-
215-
_, err := conn.ListOdbPeeringConnections(ctx, input)
216-
203+
input := odb.ListOdbPeeringConnectionsInput{}
204+
_, err := conn.ListOdbPeeringConnections(ctx, &input)
217205
if acctest.PreCheckSkipError(err) {
218206
t.Skipf("skipping acceptance testing: %s", err)
219207
}

internal/service/odb/service_package.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)