A self-hosted orchestration system crafted for power users. composia.xyz
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354package cli
import ( "fmt"
controllerv1 "forgejo.alexma.top/alexma233/composia/gen/go/proto/composia/controller/v1")
func (application *app) runRusticInit(args []string) error { fs := newCommandFlagSet("rustic init") waitOptions := addWaitFlags(fs) if err := fs.Parse(args); err != nil { return err } if err := requireArgs(fs.Args(), 1, "composia rustic init [--wait] [--follow] [--timeout duration] <node>"); err != nil { return err } response, err := application.client.nodeCommands.InitNodeRustic(application.ctx, newRequest(&controllerv1.InitNodeRusticRequest{NodeId: fs.Arg(0)})) if err != nil { return err } return application.printTaskIDWithWait(response.Msg, response.Msg.GetTaskId(), waitOptions)}
func (application *app) runRusticMaintenance(action string, args []string) error { fs := newCommandFlagSet("rustic " + action) serviceName := fs.String("service", "", "service name") dataName := fs.String("data", "", "data entry name") yes := addYesFlag(fs) waitOptions := addWaitFlags(fs) usage := fmt.Sprintf("composia rustic %s [--yes] [--wait] [--follow] [--timeout duration] [--service name] [--data name] <node>", action) if err := fs.Parse(args); err != nil { return err } if err := requireArgs(fs.Args(), 1, usage); err != nil { return err } if err := application.confirmDestructive(fmt.Sprintf("This will run rustic %s on node %q.", action, fs.Arg(0)), yes); err != nil { return err } if action == "forget" { response, err := application.client.nodeCommands.ForgetNodeRustic(application.ctx, newRequest(&controllerv1.ForgetNodeRusticRequest{NodeId: fs.Arg(0), ServiceName: *serviceName, DataName: *dataName})) if err != nil { return err } return application.printTaskIDWithWait(response.Msg, response.Msg.GetTaskId(), waitOptions) } response, err := application.client.nodeCommands.PruneNodeRustic(application.ctx, newRequest(&controllerv1.PruneNodeRusticRequest{NodeId: fs.Arg(0), ServiceName: *serviceName, DataName: *dataName})) if err != nil { return err } return application.printTaskIDWithWait(response.Msg, response.Msg.GetTaskId(), waitOptions)}