@@ -11,6 +11,7 @@ import (
11
11
"github.com/hashicorp/terraform-plugin-framework/internal/fwschema"
12
12
"github.com/hashicorp/terraform-plugin-framework/resource"
13
13
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
14
+ "github.com/hashicorp/terraform-plugin-go/tfprotov5"
14
15
"github.com/hashicorp/terraform-plugin-go/tftypes"
15
16
)
16
17
@@ -41,6 +42,16 @@ type ListResource interface {
41
42
List (context.Context , ListRequest , * ListResultsStream )
42
43
}
43
44
45
+ // ListResourceWithProtoSchemas is an interface type that extends ListResource to include a method
46
+ // which allows provider developers to supply the ProtoV5 representations of resource and resource identity
47
+ // schemas. This is necessary if list functionality is being used with a legacy resource.
48
+ type ListResourceWithProtoSchemas interface {
49
+ ListResource
50
+
51
+ // Schemas is called to provide the ProtoV5 representations of the resource and resource identity schemas.
52
+ Schemas (context.Context , * SchemaResponse )
53
+ }
54
+
44
55
// ListResourceWithConfigure is an interface type that extends ListResource to include a method
45
56
// which the framework will automatically call so provider developers have the
46
57
// opportunity to setup any necessary provider-level data or clients.
@@ -182,6 +193,20 @@ type ListResult struct {
182
193
Diagnostics diag.Diagnostics
183
194
}
184
195
196
+ // SchemaResponse represents a response that is populated by the Schemas method
197
+ // and is used to pass along the ProtoV5 representations of the resource and resource identity schemas.
198
+ type SchemaResponse struct {
199
+ // ProtoV5IdentitySchema is the ProtoV5 representation of the resource identity
200
+ // schema. This should only be supplied if framework functionality is being used
201
+ // with a legacy resource. Currently, this only applies to list.
202
+ ProtoV5IdentitySchema func () * tfprotov5.ResourceIdentitySchema
203
+
204
+ // ProtoV5Schema is the ProtoV5 representation of the resource schema
205
+ // This should only be supplied if framework functionality is being used
206
+ // with a legacy resource. Currently, this only applies to list.
207
+ ProtoV5Schema func () * tfprotov5.Schema
208
+ }
209
+
185
210
// ValidateConfigRequest represents a request to validate the configuration of
186
211
// a list resource. An instance of this request struct is supplied as an
187
212
// argument to the [ListResourceWithValidateConfig.ValidateListResourceConfig]
0 commit comments