mirror of
https://github.com/kopia/kopia.git
synced 2026-01-01 02:57:51 -05:00
27 lines
640 B
Go
27 lines
640 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kopia/kopia/internal/apiclient"
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
)
|
|
|
|
type commandServerShutdown struct {
|
|
sf serverClientFlags
|
|
|
|
out textOutput
|
|
}
|
|
|
|
func (c *commandServerShutdown) setup(svc appServices, parent commandParent) {
|
|
cmd := parent.Command("shutdown", "Gracefully shutdown the server")
|
|
c.sf.setup(svc, cmd)
|
|
c.out.setup(svc)
|
|
cmd.Action(svc.serverAction(&c.sf, c.run))
|
|
}
|
|
|
|
func (c *commandServerShutdown) run(ctx context.Context, cli *apiclient.KopiaAPIClient) error {
|
|
//nolint:wrapcheck
|
|
return cli.Post(ctx, "control/shutdown", &serverapi.Empty{}, &serverapi.Empty{})
|
|
}
|