@@ -85,35 +85,39 @@ type ListResourceWithValidateConfig interface {
8585 ValidateListResourceConfig (context.Context , ValidateConfigRequest , * ValidateConfigResponse )
8686}
8787
88- // ListRequest represents a request for the provider to list instances
89- // of a managed resource type that satisfy a user-defined request. An instance
90- // of this reqeuest struct is passed as an argument to the provider's
91- // ListResource function implementation.
88+ // ListRequest represents a request for the provider to list instances of a
89+ // managed resource type that satisfy a user-defined request. An instance of
90+ // this reqeuest struct is passed as an argument to the provider's List
91+ // function implementation.
9292type ListRequest struct {
9393 // Config is the configuration the user supplied for listing resource
9494 // instances.
9595 Config tfsdk.Config
9696
9797 // IncludeResource indicates whether the provider should populate the
98- // Resource field in the ListResult struct .
98+ // [ListResult. Resource] field.
9999 IncludeResource bool
100100}
101101
102- // ListResultsStream represents a streaming response to a ListRequest.
103- // An instance of this struct is supplied as an argument to the provider's
104- // ListResource function implementation function . The provider should set a Results
105- // iterator function that yields zero or more results of type ListResult.
102+ // ListResultsStream represents a streaming response to a [ ListRequest]. An
103+ // instance of this struct is supplied as an argument to the provider's
104+ // [ ListResource.List] function. The provider should set a Results iterator
105+ // function that pushes zero or more results of type [ ListResult] .
106106//
107107// For convenience, a provider implementation may choose to convert a slice of
108108// results into an iterator using [slices.Values].
109- //
110- // [slices.Values]: https://pkg.go.dev/slices#Values
111109type ListResultsStream struct {
112- // Results is a function that emits ListResult values via its yield
110+ // Results is a function that emits [ ListResult] values via its push
113111 // function argument.
112+ //
113+ // To indicate a fatal processing error, push a [ListResult] that contains
114+ // a [diag.ErrorDiagnostic].
114115 Results iter.Seq [ListResult ]
115116}
116117
118+ // NoListResults is an iterator that pushes zero results.
119+ var NoListResults = func (func (ListResult ) bool ) {}
120+
117121// ListResult represents a listed managed resource instance.
118122type ListResult struct {
119123 // Identity is the identity of the managed resource instance.
@@ -124,7 +128,7 @@ type ListResult struct {
124128 // Resource is the provider's representation of the attributes of the
125129 // listed managed resource instance.
126130 //
127- // If ListRequest.IncludeResource is true, a nil value will raise
131+ // If [ ListRequest.IncludeResource] is true, a nil value will raise
128132 // a warning diagnostic.
129133 Resource * tfsdk.Resource
130134
@@ -140,8 +144,8 @@ type ListResult struct {
140144
141145// ValidateConfigRequest represents a request to validate the configuration of
142146// a list resource. An instance of this request struct is supplied as an
143- // argument to the ValidateListResourceConfig receiver method or automatically
144- // passed through to each ListResourceConfigValidator .
147+ // argument to the [ListResourceWithValidateConfig. ValidateListResourceConfig]
148+ // receiver method or automatically passed through to each [ConfigValidator] .
145149type ValidateConfigRequest struct {
146150 // Config is the configuration the user supplied for the resource.
147151 //
@@ -151,10 +155,10 @@ type ValidateConfigRequest struct {
151155 Config tfsdk.Config
152156}
153157
154- // ValidateConfigResponse represents a response to a ValidateConfigRequest. An
155- // instance of this response struct is supplied as an argument to the
156- // list.ValidateListResourceConfig receiver method or automatically passed
157- // through to each ConfigValidator.
158+ // ValidateConfigResponse represents a response to a [ ValidateConfigRequest].
159+ // An instance of this response struct is supplied as an argument to the
160+ // [ list.ValidateListResourceConfig] receiver method or automatically passed
161+ // through to each [ ConfigValidator] .
158162type ValidateConfigResponse struct {
159163 // Diagnostics report errors or warnings related to validating the list
160164 // configuration. An empty slice indicates success, with no warnings
0 commit comments