File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -226,13 +226,20 @@ func StateModifyWithResult[T resource.Resource](ctx context.Context, st state.St
226
226
return typeAssertOrZero [T ](got , err )
227
227
}
228
228
229
+ // ListedResource is an interface that represents a resource in a list.
230
+ //
231
+ // It is a subset of resource.Resource that only exposes required methods.
232
+ type ListedResource interface {
233
+ Metadata () * resource.Metadata
234
+ }
235
+
229
236
// List is a type safe wrapper around resource.List.
230
- type List [T resource. Resource ] struct {
237
+ type List [T ListedResource ] struct {
231
238
list resource.List
232
239
}
233
240
234
241
// NewList creates a new List.
235
- func NewList [T resource. Resource ](list resource.List ) List [T ] {
242
+ func NewList [T ListedResource ](list resource.List ) List [T ] {
236
243
return List [T ]{list }
237
244
}
238
245
@@ -354,15 +361,15 @@ func (l *List[T]) Pointers() iter.Seq[resource.Pointer] {
354
361
}
355
362
356
363
// ListIterator is a generic iterator over resource.Resource slice.
357
- type ListIterator [T resource. Resource ] struct {
364
+ type ListIterator [T ListedResource ] struct {
358
365
list List [T ]
359
366
pos int
360
367
}
361
368
362
369
// IteratorFromList returns a new iterator over the given list.
363
370
//
364
371
// Deprecated: use [List.All] instead.
365
- func IteratorFromList [T resource. Resource ](list List [T ]) ListIterator [T ] {
372
+ func IteratorFromList [T ListedResource ](list List [T ]) ListIterator [T ] {
366
373
return ListIterator [T ]{pos : 0 , list : list }
367
374
}
368
375
You can’t perform that action at this time.
0 commit comments