1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-26 23:21:41 +01:00

feat: supports container actions for agents (#3164)

This commit is contained in:
Amir Raminfar
2024-07-29 12:16:38 -07:00
committed by GitHub
parent f09e294f38
commit 638889ed58
9 changed files with 410 additions and 120 deletions

View File

@@ -368,6 +368,25 @@ func (c *Client) Host() (docker.Host, error) {
}, nil
}
func (c *Client) ContainerAction(containerId string, action docker.ContainerAction) error {
var containerAction pb.ContainerAction
switch action {
case docker.Start:
containerAction = pb.ContainerAction_Start
case docker.Stop:
containerAction = pb.ContainerAction_Stop
case docker.Restart:
containerAction = pb.ContainerAction_Restart
}
_, err := c.client.ContainerAction(context.Background(), &pb.ContainerActionRequest{ContainerId: containerId, Action: containerAction})
return err
}
func (c *Client) Close() error {
return c.conn.Close()
}