Skip to content

Commit

Permalink
Merge pull request #295 from Scalingo/feat/294/new_endpoint_send_signal
Browse files Browse the repository at this point in the history
feat(send-signal): new function `ContainersSendSignal` to request the send-signal api's endpoint
  • Loading branch information
QuentinEscudierScalingo authored Dec 28, 2022
2 parents 5d72f54 + afacc50 commit 0ed6ec4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* feat(events): Add Detached field for EventRun [#292](https://github.com/Scalingo/go-scalingo/pull/292)
* chore(deps): bump github.com/golang-jwt/jwt/v4 from 4.4.2 to 4.4.3
* feat(send-signal): new function `ContainersSendSignal` to request the send-signal api's endpoint [#295](https://github.com/Scalingo/go-scalingo/pull/295)

## 6.0.1

Expand Down
15 changes: 15 additions & 0 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,18 @@ func (c *Client) ContainersStop(ctx context.Context, appName, containerID string

return nil
}

func (c *Client) ContainersSendSignal(ctx context.Context, app string, signal string, containerID string) error {
req := &httpclient.APIRequest{
Method: "POST",
Endpoint: "/apps/" + app + "/containers/" + containerID + "/kill",
Params: map[string]interface{}{"signal": signal},
Expected: httpclient.Statuses{204},
}
err := c.ScalingoAPI().DoRequest(ctx, req, nil)
if err != nil {
return errgo.Notef(err, "fail to execute the POST request to send signal to a container")
}

return nil
}

0 comments on commit 0ed6ec4

Please sign in to comment.