@@ -85,35 +85,39 @@ type ListResourceWithValidateConfig interface {
85
85
ValidateListResourceConfig (context.Context , ValidateConfigRequest , * ValidateConfigResponse )
86
86
}
87
87
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.
92
92
type ListRequest struct {
93
93
// Config is the configuration the user supplied for listing resource
94
94
// instances.
95
95
Config tfsdk.Config
96
96
97
97
// IncludeResource indicates whether the provider should populate the
98
- // Resource field in the ListResult struct .
98
+ // [ListResult. Resource] field.
99
99
IncludeResource bool
100
100
}
101
101
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] .
106
106
//
107
107
// For convenience, a provider implementation may choose to convert a slice of
108
108
// results into an iterator using [slices.Values].
109
- //
110
- // [slices.Values]: https://pkg.go.dev/slices#Values
111
109
type 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
113
111
// function argument.
112
+ //
113
+ // To indicate a fatal processing error, push a [ListResult] that contains
114
+ // a [diag.ErrorDiagnostic].
114
115
Results iter.Seq [ListResult ]
115
116
}
116
117
118
+ // NoListResults is an iterator that pushes zero results.
119
+ var NoListResults = func (func (ListResult ) bool ) {}
120
+
117
121
// ListResult represents a listed managed resource instance.
118
122
type ListResult struct {
119
123
// Identity is the identity of the managed resource instance.
@@ -124,7 +128,7 @@ type ListResult struct {
124
128
// Resource is the provider's representation of the attributes of the
125
129
// listed managed resource instance.
126
130
//
127
- // If ListRequest.IncludeResource is true, a nil value will raise
131
+ // If [ ListRequest.IncludeResource] is true, a nil value will raise
128
132
// a warning diagnostic.
129
133
Resource * tfsdk.Resource
130
134
@@ -140,8 +144,8 @@ type ListResult struct {
140
144
141
145
// ValidateConfigRequest represents a request to validate the configuration of
142
146
// 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] .
145
149
type ValidateConfigRequest struct {
146
150
// Config is the configuration the user supplied for the resource.
147
151
//
@@ -151,10 +155,10 @@ type ValidateConfigRequest struct {
151
155
Config tfsdk.Config
152
156
}
153
157
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] .
158
162
type ValidateConfigResponse struct {
159
163
// Diagnostics report errors or warnings related to validating the list
160
164
// configuration. An empty slice indicates success, with no warnings
0 commit comments