@@ -11,6 +11,7 @@ import (
1111 "github.com/hashicorp/terraform-plugin-framework/internal/fwschema"
1212 "github.com/hashicorp/terraform-plugin-framework/resource"
1313 "github.com/hashicorp/terraform-plugin-framework/tfsdk"
14+ "github.com/hashicorp/terraform-plugin-go/tfprotov5"
1415)
1516
1617// ListResource represents an implementation of listing instances of a managed resource
@@ -40,6 +41,16 @@ type ListResource interface {
4041 List (context.Context , ListRequest , * ListResultsStream )
4142}
4243
44+ // ListResourceWithProtoSchemas is an interface type that extends ListResource to include a method
45+ // which allows provider developers to supply the ProtoV5 representations of resource and resource identity
46+ // schemas. This is necessary if list functionality is being used with a legacy resource.
47+ type ListResourceWithProtoSchemas interface {
48+ ListResource
49+
50+ // Schemas is called to provide the ProtoV5 representations of the resource and resource identity schemas.
51+ Schemas (context.Context , * SchemaResponse )
52+ }
53+
4354// ListResourceWithConfigure is an interface type that extends ListResource to include a method
4455// which the framework will automatically call so provider developers have the
4556// opportunity to setup any necessary provider-level data or clients.
@@ -175,6 +186,20 @@ type ListResult struct {
175186 Diagnostics diag.Diagnostics
176187}
177188
189+ // SchemaResponse represents a response that is populated by the Schemas method
190+ // and is used to pass along the ProtoV5 representations of the resource and resource identity schemas.
191+ type SchemaResponse struct {
192+ // ProtoV5IdentitySchema is the ProtoV5 representation of the resource identity
193+ // schema. This should only be supplied if framework functionality is being used
194+ // with a legacy resource. Currently, this only applies to list.
195+ ProtoV5IdentitySchema func () * tfprotov5.ResourceIdentitySchema
196+
197+ // ProtoV5Schema is the ProtoV5 representation of the resource schema
198+ // This should only be supplied if framework functionality is being used
199+ // with a legacy resource. Currently, this only applies to list.
200+ ProtoV5Schema func () * tfprotov5.Schema
201+ }
202+
178203// ValidateConfigRequest represents a request to validate the configuration of
179204// a list resource. An instance of this request struct is supplied as an
180205// argument to the [ListResourceWithValidateConfig.ValidateListResourceConfig]
0 commit comments