@@ -20,6 +20,9 @@ type StackDeploymentGroups interface {
20
20
21
21
// ApproveAllPlans approves all pending plans in a stack deployment group.
22
22
ApproveAllPlans (ctx context.Context , stackDeploymentGroupID string ) error
23
+
24
+ // Rerun re-runs all the stack deployment runs in a deployment group.
25
+ Rerun (ctx context.Context , stackDeploymentGroupID string , options * StackDeploymentGroupRerunOptions ) error
23
26
}
24
27
25
28
type DeploymentGroupStatus string
@@ -65,6 +68,12 @@ type StackDeploymentGroupListOptions struct {
65
68
GroupName string `url:"group_name,omitempty"`
66
69
}
67
70
71
+ // StackDeploymentGroupRerunOptions represents options for rerunning deployments in a stack deployment group.
72
+ type StackDeploymentGroupRerunOptions struct {
73
+ // Required query parameter: A list of deployment run IDs to rerun.
74
+ Deployments []string `url:"deployments"`
75
+ }
76
+
68
77
// List returns a list of Deployment Groups in a stack, optionally filtered by additional parameters.
69
78
func (s stackDeploymentGroups ) List (ctx context.Context , stackConfigID string , options * StackDeploymentGroupListOptions ) (* StackDeploymentGroupList , error ) {
70
79
if ! validStringID (& stackConfigID ) {
@@ -123,3 +132,21 @@ func (s stackDeploymentGroups) ApproveAllPlans(ctx context.Context, stackDeploym
123
132
124
133
return req .Do (ctx , nil )
125
134
}
135
+
136
+ // Rerun re-runs all the stack deployment runs in a deployment group.
137
+ func (s stackDeploymentGroups ) Rerun (ctx context.Context , stackDeploymentGroupID string , options * StackDeploymentGroupRerunOptions ) error {
138
+ if ! validStringID (& stackDeploymentGroupID ) {
139
+ return fmt .Errorf ("invalid stack deployment group ID: %s" , stackDeploymentGroupID )
140
+ }
141
+
142
+ if options == nil || len (options .Deployments ) == 0 {
143
+ return fmt .Errorf ("no deployments specified for rerun" )
144
+ }
145
+
146
+ req , err := s .client .NewRequest ("POST" , fmt .Sprintf ("stack-deployment-groups/%s/rerun" , url .PathEscape (stackDeploymentGroupID )), options )
147
+ if err != nil {
148
+ return err
149
+ }
150
+
151
+ return req .Do (ctx , nil )
152
+ }
0 commit comments