Skip to content

Commit 559599f

Browse files
authored
Add context setup to proto{5,6}server ListResource() (#1223)
1 parent 6af9164 commit 559599f

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

internal/proto5server/server_listresource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-framework/diag"
1010
"github.com/hashicorp/terraform-plugin-framework/internal/fromproto5"
1111
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
12+
"github.com/hashicorp/terraform-plugin-framework/internal/logging"
1213
"github.com/hashicorp/terraform-plugin-framework/internal/toproto5"
1314
"github.com/hashicorp/terraform-plugin-framework/list"
1415
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
@@ -27,6 +28,9 @@ func ListRequestErrorDiagnostics(ctx context.Context, diags ...diag.Diagnostic)
2728
}
2829

2930
func (s *Server) ListResource(ctx context.Context, protoReq *tfprotov5.ListResourceRequest) (*tfprotov5.ListResourceServerStream, error) {
31+
ctx = s.registerContext(ctx)
32+
ctx = logging.InitContext(ctx)
33+
3034
protoStream := &tfprotov5.ListResourceServerStream{Results: tfprotov5.NoListResults}
3135
allDiags := diag.Diagnostics{}
3236

internal/proto5server/server_validatelistresourceconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import (
88

99
"github.com/hashicorp/terraform-plugin-framework/internal/fromproto5"
1010
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
11+
"github.com/hashicorp/terraform-plugin-framework/internal/logging"
1112
"github.com/hashicorp/terraform-plugin-framework/internal/toproto5"
1213
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
1314
)
1415

1516
// ValidateListResourceConfig satisfies the tfprotov5.ProviderServer interface.
1617
func (s *Server) ValidateListResourceConfig(ctx context.Context, proto5Req *tfprotov5.ValidateListResourceConfigRequest) (*tfprotov5.ValidateListResourceConfigResponse, error) {
1718
ctx = s.registerContext(ctx)
19+
ctx = logging.InitContext(ctx)
1820

1921
fwResp := &fwserver.ValidateListResourceConfigResponse{}
2022

internal/proto6server/server_listresource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-framework/diag"
1010
"github.com/hashicorp/terraform-plugin-framework/internal/fromproto6"
1111
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
12+
"github.com/hashicorp/terraform-plugin-framework/internal/logging"
1213
"github.com/hashicorp/terraform-plugin-framework/internal/toproto6"
1314
"github.com/hashicorp/terraform-plugin-framework/list"
1415
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
@@ -27,6 +28,9 @@ func ListRequestErrorDiagnostics(ctx context.Context, diags ...diag.Diagnostic)
2728
}
2829

2930
func (s *Server) ListResource(ctx context.Context, protoReq *tfprotov6.ListResourceRequest) (*tfprotov6.ListResourceServerStream, error) {
31+
ctx = s.registerContext(ctx)
32+
ctx = logging.InitContext(ctx)
33+
3034
protoStream := &tfprotov6.ListResourceServerStream{Results: tfprotov6.NoListResults}
3135
allDiags := diag.Diagnostics{}
3236

internal/proto6server/server_validatelistresourceconfig.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ package proto6server
55

66
import (
77
"context"
8+
89
"github.com/hashicorp/terraform-plugin-framework/internal/fromproto6"
910
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
11+
"github.com/hashicorp/terraform-plugin-framework/internal/logging"
1012
"github.com/hashicorp/terraform-plugin-framework/internal/toproto6"
1113
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
1214
)
1315

1416
// ValidateListResourceConfig satisfies the tfprotov6.ProviderServer interface.
1517
func (s *Server) ValidateListResourceConfig(ctx context.Context, proto6Req *tfprotov6.ValidateListResourceConfigRequest) (*tfprotov6.ValidateListResourceConfigResponse, error) {
1618
ctx = s.registerContext(ctx)
19+
ctx = logging.InitContext(ctx)
1720

1821
fwResp := &fwserver.ValidateListResourceConfigResponse{}
1922

0 commit comments

Comments
 (0)