Skip to content

Commit a17a7e0

Browse files
Added stackdeploymentgroup list options for pagination
1 parent efd1958 commit a17a7e0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

stack_deployment_groups.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package tfe
33
import (
44
"context"
55
"fmt"
6+
"net/url"
67
)
78

89
type StackDeploymentGroups interface {
910
// List returns a list of Deployment Groups in a stack.
10-
List(ctx context.Context, stackConfigID string) (*StackDeploymentGroupList, error)
11+
List(ctx context.Context, stackConfigID string, options *StackDeploymentGroupListOptions) (*StackDeploymentGroupList, error)
1112
}
1213

1314
type DeploymentGroupStatus string
@@ -50,12 +51,20 @@ type StackDeploymentGroupList struct {
5051
Items []*StackDeploymentGroup
5152
}
5253

53-
func (s stackDeploymentGroups) List(ctx context.Context, stackConfigID string) (*StackDeploymentGroupList, error) {
54+
type StackDeploymentGroupListOptions struct {
55+
ListOptions
56+
}
57+
58+
func (s stackDeploymentGroups) List(ctx context.Context, stackConfigID string, options *StackDeploymentGroupListOptions) (*StackDeploymentGroupList, error) {
5459
if !validStringID(&stackConfigID) {
5560
return nil, fmt.Errorf("invalid stack configuration ID: %s", stackConfigID)
5661
}
5762

58-
req, err := s.client.NewRequest("GET", fmt.Sprintf("stack-configurations/%s/stack-deployment-groups", stackConfigID), nil)
63+
if options == nil {
64+
options = &StackDeploymentGroupListOptions{}
65+
}
66+
67+
req, err := s.client.NewRequest("GET", fmt.Sprintf("stack-configurations/%s/stack-deployment-groups", url.PathEscape(stackConfigID)), options)
5968
if err != nil {
6069
return nil, err
6170
}

0 commit comments

Comments
 (0)