Skip to content

Commit e92f247

Browse files
committed
Applied change suggestions
1 parent 35d0298 commit e92f247

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

internal/service/bedrockagentcore/online_evaluation_config.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func (r *onlineEvaluationConfigResource) Read(ctx context.Context, request resou
344344
return
345345
}
346346

347-
smerr.AddEnrich(ctx, &response.Diagnostics, r.flatten(ctx, out, &data))
347+
smerr.AddEnrich(ctx, &response.Diagnostics, fwflex.Flatten(ctx, out, &data))
348348
if response.Diagnostics.HasError() {
349349
return
350350
}
@@ -423,12 +423,6 @@ func (r *onlineEvaluationConfigResource) Delete(ctx context.Context, request res
423423
}
424424
}
425425

426-
func (r *onlineEvaluationConfigResource) flatten(ctx context.Context, onlineEvaluationConfig *bedrockagentcorecontrol.GetOnlineEvaluationConfigOutput, data *onlineEvaluationConfigResourceModel) diag.Diagnostics {
427-
var diags diag.Diagnostics
428-
diags.Append(fwflex.Flatten(ctx, onlineEvaluationConfig, data)...)
429-
return diags
430-
}
431-
432426
// Waiters.
433427

434428
func waitOnlineEvaluationConfigCreated(ctx context.Context, conn *bedrockagentcorecontrol.Client, id string, timeout time.Duration) (*bedrockagentcorecontrol.GetOnlineEvaluationConfigOutput, error) {

internal/service/bedrockagentcore/online_evaluation_config_list.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/hashicorp/terraform-plugin-log/tflog"
1616
"github.com/hashicorp/terraform-provider-aws/internal/errs/fwdiag"
1717
"github.com/hashicorp/terraform-provider-aws/internal/framework"
18+
fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex"
1819
"github.com/hashicorp/terraform-provider-aws/internal/logging"
1920
"github.com/hashicorp/terraform-provider-aws/internal/smerr"
2021
inttypes "github.com/hashicorp/terraform-provider-aws/internal/types"
@@ -69,7 +70,7 @@ func (l *onlineEvaluationConfigListResource) List(ctx context.Context, request l
6970
var data onlineEvaluationConfigResourceModel
7071

7172
l.SetResult(ctx, l.Meta(), request.IncludeResource, &data, &result, func() {
72-
smerr.AddEnrich(ctx, &result.Diagnostics, l.flatten(ctx, output, &data))
73+
smerr.AddEnrich(ctx, &result.Diagnostics, fwflex.Flatten(ctx, output, &data))
7374
if result.Diagnostics.HasError() {
7475
return
7576
}

internal/service/bedrockagentcore/online_evaluation_config_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ func TestAccBedrockAgentCoreOnlineEvaluationConfig_update(t *testing.T) {
242242
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate),
243243
},
244244
},
245+
ConfigStateChecks: []statecheck.StateCheck{
246+
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrDescription), knownvalue.StringExact("Updated description")),
247+
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("rule").AtSliceIndex(0).AtMapKey("sampling_config").AtSliceIndex(0).AtMapKey("sampling_percentage"), knownvalue.Float64Exact(50.0)),
248+
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("rule").AtSliceIndex(0).AtMapKey("session_config").AtSliceIndex(0).AtMapKey("session_timeout_minutes"), knownvalue.Int64Exact(30)),
249+
},
245250
},
246251
},
247252
})
@@ -325,6 +330,12 @@ func TestAccBedrockAgentCoreOnlineEvaluationConfig_filters(t *testing.T) {
325330
Check: resource.ComposeAggregateTestCheckFunc(
326331
testAccCheckOnlineEvaluationConfigExists(ctx, t, resourceName, &v),
327332
),
333+
ConfigStateChecks: []statecheck.StateCheck{
334+
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("rule").AtSliceIndex(0).AtMapKey("filter").AtSliceIndex(0).AtMapKey("key"), knownvalue.StringExact("environment")),
335+
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("rule").AtSliceIndex(0).AtMapKey("filter").AtSliceIndex(0).AtMapKey("operator"), knownvalue.StringExact("Equals")),
336+
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("rule").AtSliceIndex(0).AtMapKey("sampling_config").AtSliceIndex(0).AtMapKey("sampling_percentage"), knownvalue.Float64Exact(25.0)),
337+
statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("rule").AtSliceIndex(0).AtMapKey("session_config").AtSliceIndex(0).AtMapKey("session_timeout_minutes"), knownvalue.Int64Exact(20)),
338+
},
328339
},
329340
},
330341
})

0 commit comments

Comments
 (0)