Skip to content

Commit 16a2973

Browse files
committed
Rename ListResource method to List
1 parent c4ccf44 commit 16a2973

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

list/list_resource.go

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ type ListResource interface {
3434
// ListResourceConfigSchema should return the schema for list blocks.
3535
ListResourceConfigSchema(context.Context, ListResourceSchemaRequest, *ListResourceSchemaResponse)
3636

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)
4040
}
4141

4242
// ListResourceWithConfigure is an interface type that extends ListResource to include a method
@@ -85,39 +85,37 @@ type ListResourceWithValidateConfig interface {
8585
ValidateListResourceConfig(context.Context, ValidateConfigRequest, *ValidateConfigResponse)
8686
}
8787

88-
// ListResourceRequest represents a request for the provider to list instances
88+
// ListRequest represents a request for the provider to list instances
8989
// of a managed resource type that satisfy a user-defined request. An instance
9090
// of this reqeuest struct is passed as an argument to the provider's
9191
// ListResource function implementation.
92-
type ListResourceRequest struct {
92+
type 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 ListResourceEvent struct.
98+
// Resource field in the ListResult struct.
9999
IncludeResource bool
100100
}
101101

102-
// ListResourceStream represents a streaming response to a ListResourceRequest.
102+
// ListResultsStream represents a streaming response to a ListRequest.
103103
// 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.
106106
//
107107
// 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].
109109
//
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
113113
// function argument.
114-
Results iter.Seq[ListResourceEvent]
114+
Results iter.Seq[ListResult]
115115
}
116116

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 {
121119
// Identity is the identity of the managed resource instance.
122120
//
123121
// A nil value will raise will raise a diagnostic.
@@ -126,7 +124,7 @@ type ListResourceEvent struct {
126124
// Resource is the provider's representation of the attributes of the
127125
// listed managed resource instance.
128126
//
129-
// If ListResourceRequest.IncludeResource is true, a nil value will raise
127+
// If ListRequest.IncludeResource is true, a nil value will raise
130128
// a warning diagnostic.
131129
Resource *tfsdk.Resource
132130

list/no_op_list_resource_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ type NoOpListResource struct{}
1414
func (*NoOpListResource) ListResourceConfigSchema(_ context.Context, _ list.ListResourceSchemaRequest, _ *list.ListResourceSchemaResponse) {
1515
}
1616

17-
func (*NoOpListResource) ListResource(_ context.Context, _ list.ListResourceRequest, _ *list.ListResourceStream) {
17+
func (*NoOpListResource) List(_ context.Context, _ list.ListRequest, _ *list.ListResultsStream) {
1818
}

0 commit comments

Comments
 (0)