Skip to content

Commit 06cc08e

Browse files
authored
Update ListResource to include limit (#532)
* update ListResource to include limit * add limit to list definition and request
1 parent 55e8e16 commit 06cc08e

File tree

8 files changed

+48
-10
lines changed

8 files changed

+48
-10
lines changed

tfprotov5/internal/fromproto/list_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func ListResourceRequest(in *tfplugin5.ListResource_Request) *tfprotov5.ListReso
1717
TypeName: in.TypeName,
1818
Config: DynamicValue(in.Config),
1919
IncludeResource: in.IncludeResourceObject,
20+
Limit: in.Limit,
2021
}
2122
}
2223

tfprotov5/internal/tfplugin5/tfplugin5.pb.go

Lines changed: 16 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tfprotov5/internal/tfplugin5/tfplugin5.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,10 @@ message ListResource {
888888
// when include_resource_object is set to true, the provider should
889889
// include the full resource object for each result
890890
bool include_resource_object = 3;
891+
892+
// The maximum number of results that Terraform is expecting.
893+
// The stream will stop, once this limit is reached.
894+
int64 limit = 4;
891895
}
892896

893897
message Event {

tfprotov5/list_resource.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ type ListResourceRequest struct {
3737
// IncludeResource is a boolean indicating whether to populate the Resource
3838
// field in list results.
3939
IncludeResource bool // TODO: propose rename in protocol: IncludeResourceObject -> IncludeResource
40+
41+
// Limit specifies the maximum number of results that Terraform is expecting.
42+
Limit int64
4043
}
4144

4245
// ListResourceServerStream represents a streaming response to a

tfprotov6/internal/fromproto/list_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func ListResourceRequest(in *tfplugin6.ListResource_Request) *tfprotov6.ListReso
1717
TypeName: in.TypeName,
1818
Config: DynamicValue(in.Config),
1919
IncludeResource: in.IncludeResourceObject,
20+
Limit: in.Limit,
2021
}
2122
}
2223

tfprotov6/internal/tfplugin6/tfplugin6.pb.go

Lines changed: 16 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tfprotov6/internal/tfplugin6/tfplugin6.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,10 @@ message ListResource {
871871
// when include_resource_object is set to true, the provider should
872872
// include the full resource object for each result
873873
bool include_resource_object = 3;
874+
875+
// The maximum number of results that Terraform is expecting.
876+
// The stream will stop, once this limit is reached.
877+
int64 limit = 4;
874878
}
875879

876880
message Event {

tfprotov6/list_resource.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ type ListResourceRequest struct {
3737
// IncludeResource is a boolean indicating whether to populate the Resource
3838
// field in list results.
3939
IncludeResource bool // TODO: propose rename in protocol: IncludeResourceObject -> IncludeResource
40+
41+
// Limit specifies the maximum number of results that Terraform is expecting.
42+
Limit int64
4043
}
4144

4245
// ListResourceServerStream represents a streaming response to a

0 commit comments

Comments
 (0)