generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
cmd_status.go
36 lines (31 loc) 路 1.08 KB
/
cmd_status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"context"
"os"
"connectrpc.com/connect"
"github.com/golang/protobuf/jsonpb"
ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect"
)
type statusCmd struct {
All bool `help:"Show all controllers, deployments, and runners, even those that are not running."`
AllControllers bool `help:"Show all controllers, even those that are not running."`
AllRunners bool `help:"Show all runners, even those that are not running."`
AllIngressRoutes bool `help:"Show all ingress routes, even those that are not running."`
Schema bool `help:"Show schema."`
}
func (s *statusCmd) Run(ctx context.Context, client ftlv1connect.ControllerServiceClient) error {
status, err := client.Status(ctx, connect.NewRequest(&ftlv1.StatusRequest{}))
if err != nil {
return err
}
msg := status.Msg
if !s.Schema {
for _, deployment := range msg.Deployments {
deployment.Schema = nil
}
}
return (&jsonpb.Marshaler{
Indent: " ",
}).Marshal(os.Stdout, status.Msg)
}