Skip to content

Commit b6a6276

Browse files
committed
properly add deployment query param in rerun
1 parent 8cde4d3 commit b6a6276

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

stack_deployment_groups.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"context"
88
"fmt"
99
"net/url"
10+
"strings"
1011
"time"
1112
)
1213

@@ -71,7 +72,7 @@ type StackDeploymentGroupListOptions struct {
7172
// StackDeploymentGroupRerunOptions represents options for rerunning deployments in a stack deployment group.
7273
type StackDeploymentGroupRerunOptions struct {
7374
// Required query parameter: A list of deployment run IDs to rerun.
74-
Deployments []string `url:"deployments"`
75+
Deployments []string
7576
}
7677

7778
// List returns a list of Deployment Groups in a stack, optionally filtered by additional parameters.
@@ -143,7 +144,19 @@ func (s stackDeploymentGroups) Rerun(ctx context.Context, stackDeploymentGroupID
143144
return fmt.Errorf("no deployments specified for rerun")
144145
}
145146

146-
req, err := s.client.NewRequest("POST", fmt.Sprintf("stack-deployment-groups/%s/rerun", url.PathEscape(stackDeploymentGroupID)), options)
147+
u := fmt.Sprintf("stack-deployment-groups/%s/rerun", url.PathEscape(stackDeploymentGroupID))
148+
149+
type DeploymentQueryParams struct {
150+
Deployments string `url:"deployments"`
151+
}
152+
153+
qp, err := decodeQueryParams(&DeploymentQueryParams{
154+
Deployments: strings.Join(options.Deployments, ","),
155+
})
156+
if err != nil {
157+
return err
158+
}
159+
req, err := s.client.NewRequestWithAdditionalQueryParams("POST", u, nil, qp)
147160
if err != nil {
148161
return err
149162
}

0 commit comments

Comments
 (0)