Skip to content

Commit b1b3dd0

Browse files
committed
chore: incorporate review feedback
1 parent e801b42 commit b1b3dd0

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

stack_deployment_runs.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type StackDeploymentRuns interface {
1515
// List returns a list of stack deployment runs for a given deployment group.
1616
List(ctx context.Context, deploymentGroupID string, options *StackDeploymentRunListOptions) (*StackDeploymentRunList, error)
1717
Read(ctx context.Context, stackDeploymentRunID string) (*StackDeploymentRun, error)
18+
ReadWithOptions(ctx context.Context, stackDeploymentRunID string, options *StackDeploymentRunReadOptions) (*StackDeploymentRun, error)
1819
ApproveAllPlans(ctx context.Context, deploymentRunID string) error
1920
Cancel(ctx context.Context, stackDeploymentRunID string) error
2021
}
@@ -43,21 +44,20 @@ const (
4344
SDRDeploymentGroup SDRIncludeOpt = "stack-deployment-group"
4445
)
4546

46-
type StackDeploymentRunReadOptions struct {
47-
// Optional: A list of relations to include.
48-
Include []SDRIncludeOpt `url:"include,omitempty"`
49-
}
50-
5147
// StackDeploymentRunList represents a list of stack deployment runs.
5248
type StackDeploymentRunList struct {
5349
*Pagination
5450
Items []*StackDeploymentRun
5551
}
5652

53+
type StackDeploymentRunReadOptions struct {
54+
// Optional: A list of relations to include.
55+
Include []SDRIncludeOpt `url:"include,omitempty"`
56+
}
57+
5758
// StackDeploymentRunListOptions represents the options for listing stack deployment runs.
5859
type StackDeploymentRunListOptions struct {
5960
ListOptions
60-
6161
// Optional: A list of relations to include.
6262
Include []SDRIncludeOpt `url:"include,omitempty"`
6363
}

stack_deployment_runs_integration_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,28 @@ func TestStackDeploymentRunsList(t *testing.T) {
7272
require.NoError(t, err)
7373
assert.NotNil(t, runList)
7474
})
75+
76+
t.Run("With include option", func(t *testing.T) {
77+
t.Parallel()
78+
79+
runList, err := client.StackDeploymentRuns.List(ctx, deploymentGroupID, &StackDeploymentRunListOptions{
80+
Include: []SDRIncludeOpt{"stack-deployment-group"},
81+
})
82+
assert.NoError(t, err)
83+
assert.NotNil(t, runList)
84+
for _, run := range runList.Items {
85+
assert.NotNil(t, run.StackDeploymentGroup.ID)
86+
}
87+
})
88+
89+
t.Run("With invalid include option", func(t *testing.T) {
90+
t.Parallel()
91+
92+
_, err := client.StackDeploymentRuns.List(ctx, deploymentGroupID, &StackDeploymentRunListOptions{
93+
Include: []SDRIncludeOpt{"invalid-option"},
94+
})
95+
assert.Error(t, err)
96+
})
7597
}
7698

7799
func TestStackDeploymentRunsRead(t *testing.T) {

0 commit comments

Comments
 (0)