@@ -10,6 +10,14 @@ import (
1010 "github.com/hashicorp/terraform-plugin-framework/tfsdk"
1111)
1212
13+ // List represents an implementation of listing instances of a managed resource
14+ // This is the core interface for all list implementations.
15+ //
16+ // List implementations can optionally implement these additional concepts:
17+ //
18+ // - Configure: Include provider-level data or clients.
19+ // - Validation: Schema-based or entire configuration via
20+ // ListWithConfigValidators or ListWithValidateConfig.
1321type List interface {
1422 Metadata (context.Context , MetadataRequest , * MetadataResponse )
1523 ListSchema (context.Context , SchemaRequest , SchemaResponse )
@@ -21,6 +29,11 @@ type ListWithConfigure interface {
2129 Configure (context.Context , ConfigureRequest , * ConfigureResponse )
2230}
2331
32+ type ListWithConfigValidators interface {
33+ List
34+ ListConfigValidators (context.Context ) []ListConfigValidator
35+ }
36+
2437type ListWithValidateConfig interface {
2538 List
2639 ValidateListConfig (context.Context , ValidateListConfigRequest , * ValidateListConfigResponse )
@@ -42,10 +55,26 @@ type ListResult struct {
4255 Diagnostics diag.Diagnostics
4356}
4457
58+ // ValidateListConfigRequest represents a request to validate the
59+ // configuration of a resource. An instance of this request struct is
60+ // supplied as an argument to the Resource ValidateListConfig receiver method
61+ // or automatically passed through to each ListConfigValidator.
4562type ValidateListConfigRequest struct {
63+ // Config is the configuration the user supplied for the resource.
64+ //
65+ // This configuration may contain unknown values if a user uses
66+ // interpolation or other functionality that would prevent Terraform
67+ // from knowing the value at request time.
4668 Config tfsdk.Config
4769}
4870
71+ // ValidateListConfigResponse represents a response to a
72+ // ValidateListConfigRequest. An instance of this response struct is
73+ // supplied as an argument to the Resource ValidateListConfig receiver method
74+ // or automatically passed through to each ListConfigValidator.
4975type ValidateListConfigResponse struct {
76+ // Diagnostics report errors or warnings related to validating the resource
77+ // configuration. An empty slice indicates success, with no warnings or
78+ // errors generated.
5079 Diagnostics diag.Diagnostics
5180}
0 commit comments