Files
threshold/internal/cmd/commands/ferry/ferry.go
T
Todd 95c507fad5 Add hidden ferry commands and auto adding tokens to ferry daemon (#4572)
* Add boundary ferry command (#4462)

* Add boundary ferry status (#4463)

* Add sending auth token automatically to ferry daemon (#4465)

* Hide ferry cmds, background error msgs, and dont retry background add-token requests (#4571)
2024-03-25 15:04:13 -07:00

64 lines
1.3 KiB
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package ferry
import (
"fmt"
"strings"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
var (
_ cli.Command = (*FerryCommand)(nil)
_ cli.CommandAutocomplete = (*FerryCommand)(nil)
)
type FerryCommand struct {
*base.Command
}
func (c *FerryCommand) Synopsis() string {
return "Manages the Boundary ferry daemon"
}
func (c *FerryCommand) Help() string {
helpText := `
Usage: boundary ferry [sub command] [options]
This command allows interacting with the Boundary ferry daemon.
Get the status of the daemon:
$ boundary ferry status
For a full list of examples, please see the documentation.
`
return strings.TrimSpace(helpText)
}
func (c *FerryCommand) Flags() *base.FlagSets {
return c.FlagSet(base.FlagSetNone)
}
func (c *FerryCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing
}
func (c *FerryCommand) AutocompleteFlags() complete.Flags {
return c.Flags().Completions()
}
func (c *FerryCommand) Run(args []string) int {
return cli.RunResultHelp
}
// ferryUrl constructs the full URL for a ferry request given a port and path.
func ferryUrl(port uint, path string) string {
return fmt.Sprintf("http://127.0.0.1:%d/%s", port, path)
}