Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetSessionCmd = &cobra.Command{ Use: "get-session [name]", Short: "Get information about a session", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { client := sessionv1connect.NewSessionServiceClient( http.DefaultClient, "http://localhost:8080", ) req := &connect.Request[sessionv1.GetSessionRequest]{ Msg: &sessionv1.GetSessionRequest{ Id: args[0], }, } resp, err := client.GetSession(context.Background(), req) if err != nil { return fmt.Errorf("could not get session: %w", err) } jsonData, err := json.MarshalIndent(resp.Msg.Session, "", " ") if err != nil { return fmt.Errorf("could not marshal session data to json: %w", err) } fmt.Println(string(jsonData)) return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.