@@ -34,9 +34,9 @@ type ListResource interface {
34
34
// ListResourceConfigSchema should return the schema for list blocks.
35
35
ListResourceConfigSchema (context.Context , ListResourceSchemaRequest , * ListResourceSchemaResponse )
36
36
37
- // ListResource is called when the provider must list instances of a
38
- // managed resource type that satisfy a user-provided request.
39
- ListResource (context.Context , ListResourceRequest , * ListResourceStream )
37
+ // List is called when the provider must list instances of a managed
38
+ // resource type that satisfy a user-provided request.
39
+ List (context.Context , ListRequest , * ListResultsStream )
40
40
}
41
41
42
42
// ListResourceWithConfigure is an interface type that extends ListResource to include a method
@@ -85,39 +85,37 @@ type ListResourceWithValidateConfig interface {
85
85
ValidateListResourceConfig (context.Context , ValidateConfigRequest , * ValidateConfigResponse )
86
86
}
87
87
88
- // ListResourceRequest represents a request for the provider to list instances
88
+ // ListRequest represents a request for the provider to list instances
89
89
// of a managed resource type that satisfy a user-defined request. An instance
90
90
// of this reqeuest struct is passed as an argument to the provider's
91
91
// ListResource function implementation.
92
- type ListResourceRequest struct {
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 ListResourceEvent struct.
98
+ // Resource field in the ListResult struct.
99
99
IncludeResource bool
100
100
}
101
101
102
- // ListResourceStream represents a streaming response to a ListResourceRequest .
102
+ // ListResultsStream represents a streaming response to a ListRequest .
103
103
// An instance of this struct is supplied as an argument to the provider's
104
- // ListResource function implementation function. The provider should set an
105
- // iterator function on the response struct .
104
+ // ListResource function implementation function. The provider should set a Results
105
+ // iterator function that yields zero or more results of type ListResult .
106
106
//
107
107
// For convenience, a provider implementation may choose to convert a slice of
108
- // results into an iterator using [slices.All ].
108
+ // results into an iterator using [slices.Values ].
109
109
//
110
- // [slices.All ]: https://pkg.go.dev/iter/ slices#All
111
- type ListResourceStream struct {
112
- // Results is a function that emits ListResourceEvent values via its yield
110
+ // [slices.Values ]: https://pkg.go.dev/slices#Values
111
+ type ListResultsStream struct {
112
+ // Results is a function that emits ListResult values via its yield
113
113
// function argument.
114
- Results iter.Seq [ListResourceEvent ]
114
+ Results iter.Seq [ListResult ]
115
115
}
116
116
117
- // ListResourceEvent represents a listed managed resource instance. A
118
- // provider's ListResource function implementation will emit zero or more
119
- // events for a user-provided request.
120
- type ListResourceEvent struct {
117
+ // ListResult represents a listed managed resource instance.
118
+ type ListResult struct {
121
119
// Identity is the identity of the managed resource instance.
122
120
//
123
121
// A nil value will raise will raise a diagnostic.
@@ -126,7 +124,7 @@ type ListResourceEvent struct {
126
124
// Resource is the provider's representation of the attributes of the
127
125
// listed managed resource instance.
128
126
//
129
- // If ListResourceRequest .IncludeResource is true, a nil value will raise
127
+ // If ListRequest .IncludeResource is true, a nil value will raise
130
128
// a warning diagnostic.
131
129
Resource * tfsdk.Resource
132
130
0 commit comments