Documentation ¶
Index ¶
- Constants
- Variables
- func Format(ui cli.Ui) string
- func MakeShutdownCh() chan struct{}
- func MakeSighupCh() chan struct{}
- func MaxAttributesLength(nonAttributesMap, attributesMap map[string]interface{}, ...) int
- func NewListener(l *configutil.Listener, logger hclog.Logger, ui cli.Ui) (*alpnmux.ALPNMux, map[string]string, reloadutil.ReloadFunc, error)
- func ProcessLogLevelAndFormat(flagLogLevel, flagLogFormat, configLogLevel, configLogFormat string) (hclog.Level, logging.LogFormat, error)
- func ScopeInfoForOutput(scp *scopes.ScopeInfo, maxLength int) string
- func StartMemProfiler(_ hclog.Logger)
- func TokenIdFromToken(token string) (string, error)
- func WrapAtLength(s string) string
- func WrapAtLengthWithPadding(s string, pad int) string
- func WrapForHelpText(lines []string) string
- func WrapMap(prefixSpaces, maxLengthOverride int, input map[string]interface{}) string
- func WrapSlice(prefixSpaces int, input []string) string
- type BoolVar
- type BoundaryUI
- type Command
- func (c *Command) Client(opt ...Option) (*api.Client, error)
- func (c *Command) DiscoverKeyringTokenInfo() (string, string, error)
- func (c *Command) FlagSet(bit FlagSetBit) *FlagSets
- func (c *Command) PrintApiError(in *api.Error, contextStr string)
- func (c *Command) PrintCliError(err error)
- func (c *Command) PrintJsonItem(result api.GenericResult) bool
- func (c *Command) PrintJsonItems(result api.GenericListResult) bool
- func (c *Command) ReadTokenFromKeyring(keyringType, tokenName string) *authtokens.AuthToken
- type DurationVar
- type FlagBool
- type FlagExample
- type FlagSet
- func (f *FlagSet) BoolVar(i *BoolVar)
- func (f *FlagSet) DurationVar(i *DurationVar)
- func (f *FlagSet) Float64Var(i *Float64Var)
- func (f *FlagSet) Int64Var(i *Int64Var)
- func (f *FlagSet) IntVar(i *IntVar)
- func (f *FlagSet) Name() string
- func (f *FlagSet) StringMapVar(i *StringMapVar)
- func (f *FlagSet) StringSliceVar(i *StringSliceVar)
- func (f *FlagSet) StringVar(i *StringVar)
- func (f *FlagSet) Uint64Var(i *Uint64Var)
- func (f *FlagSet) UintVar(i *UintVar)
- func (f *FlagSet) Var(value flag.Value, name, usage string)
- func (f *FlagSet) VarFlag(i *VarFlag)
- func (f *FlagSet) Visit(fn func(*flag.Flag))
- func (f *FlagSet) VisitAll(fn func(*flag.Flag))
- type FlagSetBit
- type FlagSets
- type FlagVisibility
- type Float64Var
- type GRPCLogFaker
- func (g *GRPCLogFaker) Fatal(args ...interface{})
- func (g *GRPCLogFaker) Fatalf(format string, args ...interface{})
- func (g *GRPCLogFaker) Fatalln(args ...interface{})
- func (g *GRPCLogFaker) Print(args ...interface{})
- func (g *GRPCLogFaker) Printf(format string, args ...interface{})
- func (g *GRPCLogFaker) Println(args ...interface{})
- type Int64Var
- type IntVar
- type JsonFormatter
- type ListenerFactory
- type Option
- func WithContainerImage(name string) Option
- func WithNoTokenScope() Option
- func WithNoTokenValue() Option
- func WithSkipAuthMethodCreation() Option
- func WithSkipDatabaseDestruction() Option
- func WithSkipHostResourcesCreation() Option
- func WithSkipScopesCreation() Option
- func WithSkipTargetCreation() Option
- type Options
- type Server
- func (b *Server) ConnectToDatabase(dialect string) error
- func (b *Server) CreateDevDatabase(ctx context.Context, opt ...Option) error
- func (b *Server) CreateGlobalKmsKeys(ctx context.Context) error
- func (b *Server) CreateInitialHostResources(ctx context.Context) (*static.HostCatalog, *static.HostSet, *static.Host, error)
- func (b *Server) CreateInitialLoginRole(ctx context.Context) (*iam.Role, error)
- func (b *Server) CreateInitialPasswordAuthMethod(ctx context.Context) (*password.AuthMethod, *iam.User, error)
- func (b *Server) CreateInitialScopes(ctx context.Context) (*iam.Scope, *iam.Scope, error)
- func (b *Server) CreateInitialTarget(ctx context.Context) (target.Target, error)
- func (b *Server) DestroyDevDatabase() error
- func (b *Server) PrintInfo(ui cli.Ui)
- func (b *Server) ReleaseLogGate()
- func (b *Server) RemovePidFile(pidPath string) error
- func (b *Server) RunShutdownFuncs() error
- func (b *Server) SetupControllerPublicClusterAddress(conf *config.Config, flagValue string) error
- func (b *Server) SetupKMSes(ui cli.Ui, config *config.Config) error
- func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allowedPurposes []string) error
- func (b *Server) SetupLogging(flagLogLevel, flagLogFormat, configLogLevel, configLogFormat string) error
- func (b *Server) SetupMetrics(ui cli.Ui, telemetry *configutil.Telemetry) error
- func (b *Server) SetupWorkerPublicAddress(conf *config.Config, flagValue string) error
- func (b *Server) StorePidFile(pidPath string) error
- type ServerListener
- type StringMapVar
- type StringSliceVar
- type StringVar
- type TCPKeepAliveListener
- type Uint64Var
- type UintVar
- type VarFlag
- type WorkerAuthInfo
Constants ¶
const ( CommandSuccess int = iota CommandApiError CommandCliError CommandUserError )
const ( EnvTokenName = "BOUNDARY_TOKEN_NAME" EnvKeyringType = "BOUNDARY_KEYRING_TYPE" StoredTokenName = "HashiCorp Boundary Auth Token" )
const ( // FlagNameAddr is the flag used in the base command to read in the // address of the Boundary server. FlagNameAddr = "addr" // FlagnameCACert is the flag used in the base command to read in the CA // cert. FlagNameCACert = "ca-cert" // FlagnameCAPath is the flag used in the base command to read in the CA // cert path. FlagNameCAPath = "ca-path" // FlagNameClientCert is the flag used in the base command to read in the // client key FlagNameClientKey = "client-key" // FlagNameClientCert is the flag used in the base command to read in the // client cert FlagNameClientCert = "client-cert" // FlagNameTLSInsecure is the flag used in the base command to read in // the option to ignore TLS certificate verification. FlagNameTLSInsecure = "tls-insecure" // FlagTLSServerName is the flag used in the base command to read in // the TLS server name. FlagTLSServerName = "tls-server-name" )
const ( EnvBoundaryCLINoColor = `BOUNDARY_CLI_NO_COLOR` EnvBoundaryCLIFormat = `BOUNDARY_CLI_FORMAT` )
const ( NoneKeyring = "none" AutoKeyring = "auto" WincredKeyring = "wincred" PassKeyring = "pass" KeychainKeyring = "keychain" SecretServiceKeyring = "secret-service" DefaultTokenName = "default" LoginCollection = "login" PassPrefix = "HashiCorp_Boundary" )
Variables ¶
var BuiltinListeners = map[string]ListenerFactory{
"tcp": tcpListenerFactory,
"unix": unixListenerFactory,
}
BuiltinListeners is the list of built-in listener types.
var DevOnlyControllerFlags = func(*Command, *FlagSet) {}
var TermWidth uint = 80
Functions ¶
func MakeShutdownCh ¶
func MakeShutdownCh() chan struct{}
MakeShutdownCh returns a channel that can be used for shutdown notifications for commands. This channel will send a message for every SIGINT or SIGTERM received.
func MakeSighupCh ¶ added in v0.1.8
func MakeSighupCh() chan struct{}
MakeSighupCh returns a channel that can be used for SIGHUP reloading. This channel will send a message for every SIGHUP received.
func MaxAttributesLength ¶
func NewListener ¶
func NewListener(l *configutil.Listener, logger hclog.Logger, ui cli.Ui) (*alpnmux.ALPNMux, map[string]string, reloadutil.ReloadFunc, error)
New creates a new listener of the given type with the given configuration. The type is looked up in the BuiltinListeners map.
func StartMemProfiler ¶
func StartMemProfiler(_ hclog.Logger)
func TokenIdFromToken ¶ added in v0.2.1
func WrapAtLength ¶
WrapAtLength wraps the given text to maxLineLength.
func WrapAtLengthWithPadding ¶
WrapAtLengthWithPadding wraps the given text at the maxLineLength, taking into account any provided left padding.
func WrapForHelpText ¶
Types ¶
type BoolVar ¶
type BoolVar struct { Name string Aliases []string Usage string Default bool Hidden bool EnvVar string Target *bool Completion complete.Predictor }
-- BoolVar and boolValue
type BoundaryUI ¶
type Command ¶
type Command struct { Context context.Context UI cli.Ui ShutdownCh chan struct{} FlagToken string FlagTokenName string FlagKeyringType string FlagRecoveryConfig string FlagScopeId string FlagScopeName string FlagId string FlagName string FlagDescription string FlagAuthMethodId string FlagHostCatalogId string FlagVersion int FlagRecursive bool FlagFilter string // contains filtered or unexported fields }
func NewCommand ¶
New returns a new instance of a base.Command type
func (*Command) Client ¶
Client returns the HTTP API client. The client is cached on the command to save performance on future calls.
func (*Command) DiscoverKeyringTokenInfo ¶ added in v0.1.1
func (*Command) FlagSet ¶
func (c *Command) FlagSet(bit FlagSetBit) *FlagSets
FlagSet creates the flags for this command. The result is cached on the command to save performance on future calls.
func (*Command) PrintApiError ¶ added in v0.1.8
PrintApiError prints the given API error, optionally with context information, to the UI in the appropriate format
func (*Command) PrintCliError ¶ added in v0.1.8
PrintCliError prints the given CLI error to the UI in the appropriate format
func (*Command) PrintJsonItem ¶ added in v0.1.8
func (c *Command) PrintJsonItem(result api.GenericResult) bool
PrintJsonItem prints the given item to the UI in JSON format
func (*Command) PrintJsonItems ¶ added in v0.1.8
func (c *Command) PrintJsonItems(result api.GenericListResult) bool
PrintJsonItems prints the given items to the UI in JSON format
func (*Command) ReadTokenFromKeyring ¶
func (c *Command) ReadTokenFromKeyring(keyringType, tokenName string) *authtokens.AuthToken
type DurationVar ¶
type DurationVar struct { Name string Aliases []string Usage string Default time.Duration Hidden bool EnvVar string Target *time.Duration Completion complete.Predictor }
-- DurationVar and durationValue
type FlagBool ¶
type FlagBool interface {
IsBoolFlag() bool
}
FlagBool is an interface which boolean flags implement.
type FlagExample ¶
type FlagExample interface {
Example() string
}
FlagExample is an interface which declares an example value.
type FlagSet ¶
type FlagSet struct {
// contains filtered or unexported fields
}
FlagSet is a grouped wrapper around a real flag set and a grouped flag set.
func (*FlagSet) DurationVar ¶
func (f *FlagSet) DurationVar(i *DurationVar)
func (*FlagSet) Float64Var ¶
func (f *FlagSet) Float64Var(i *Float64Var)
func (*FlagSet) StringMapVar ¶
func (f *FlagSet) StringMapVar(i *StringMapVar)
func (*FlagSet) StringSliceVar ¶
func (f *FlagSet) StringSliceVar(i *StringSliceVar)
type FlagSetBit ¶
type FlagSetBit uint
const ( FlagSetNone FlagSetBit = 1 << iota FlagSetHTTP FlagSetClient FlagSetOutputFormat )
type FlagSets ¶
type FlagSets struct {
// contains filtered or unexported fields
}
FlagSets is a group of flag sets.
func (*FlagSets) Completions ¶
Completions returns the completions for this flag set.
func (*FlagSets) NewFlagSet ¶
NewFlagSet creates a new flag set from the given flag sets.
type FlagVisibility ¶
type FlagVisibility interface {
Hidden() bool
}
FlagVisibility is an interface which declares whether a flag should be hidden from help and completions. This is usually used for deprecations on "internal-only" flags.
type Float64Var ¶
type Float64Var struct { Name string Aliases []string Usage string Default float64 Hidden bool EnvVar string Target *float64 Completion complete.Predictor }
-- Float64Var and float64Value
type GRPCLogFaker ¶
type GRPCLogFaker struct { Logger hclog.Logger Log bool }
func (*GRPCLogFaker) Fatal ¶
func (g *GRPCLogFaker) Fatal(args ...interface{})
func (*GRPCLogFaker) Fatalf ¶
func (g *GRPCLogFaker) Fatalf(format string, args ...interface{})
func (*GRPCLogFaker) Fatalln ¶
func (g *GRPCLogFaker) Fatalln(args ...interface{})
func (*GRPCLogFaker) Print ¶
func (g *GRPCLogFaker) Print(args ...interface{})
func (*GRPCLogFaker) Printf ¶
func (g *GRPCLogFaker) Printf(format string, args ...interface{})
func (*GRPCLogFaker) Println ¶
func (g *GRPCLogFaker) Println(args ...interface{})
type Int64Var ¶
type Int64Var struct { Name string Aliases []string Usage string Default int64 Hidden bool EnvVar string Target *int64 Completion complete.Predictor }
-- Int64Var and int64Value
type IntVar ¶
type IntVar struct { Name string Aliases []string Usage string Default int Hidden bool EnvVar string Target *int Completion complete.Predictor }
-- IntVar and intValue
type JsonFormatter ¶
type JsonFormatter struct{}
An output formatter for json output of an object
func (JsonFormatter) Format ¶
func (j JsonFormatter) Format(data interface{}) ([]byte, error)
type ListenerFactory ¶
type ListenerFactory func(string, *configutil.Listener, hclog.Logger, cli.Ui) (string, net.Listener, error)
Factory is the factory function to create a listener.
type Option ¶
type Option func(*Options)
Option - how Options are passed as arguments.
func WithContainerImage ¶ added in v0.2.1
WithContainerImage tells the command which container image to start a dev database with
func WithNoTokenScope ¶
func WithNoTokenScope() Option
WithNoTokenScope tells the client not to set a scope for the client from a saved token's scope, as this can cause confusing behavior at authentication time.
func WithNoTokenValue ¶
func WithNoTokenValue() Option
WithNoTokenValue tells the client not to set a token for the client from a saved token's value, as this can cause confusing behavior at authentication time.
func WithSkipAuthMethodCreation ¶
func WithSkipAuthMethodCreation() Option
WithSkipAuthMethodCreation tells the command not to instantiate an auth method on first run.
func WithSkipDatabaseDestruction ¶
func WithSkipDatabaseDestruction() Option
WithSkipDatabaseDestruction tells the command not to destroy the database even on error.
func WithSkipHostResourcesCreation ¶
func WithSkipHostResourcesCreation() Option
WithSkipHostResourcesCreation tells the command not to instantiate a host catalog and related resources on first run.
func WithSkipScopesCreation ¶
func WithSkipScopesCreation() Option
WithSkipScopesCreation tells the command not to instantiate scopes on first run.
func WithSkipTargetCreation ¶
func WithSkipTargetCreation() Option
WithSkipTargetCreation tells the command not to instantiate a target on first run.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options - how Options are represented.
type Server ¶
type Server struct { *Command InfoKeys []string Info map[string]string GatedWriter *gatedwriter.Writer Logger hclog.Logger CombineLogs bool LogLevel hclog.Level RootKms wrapping.Wrapper WorkerAuthKms wrapping.Wrapper RecoveryKms wrapping.Wrapper Kms *kms.Kms SecureRandomReader io.Reader InmemSink *metrics.InmemSink PrometheusEnabled bool ReloadFuncsLock *sync.RWMutex ReloadFuncs map[string][]reloadutil.ReloadFunc ShutdownFuncs []func() error Listeners []*ServerListener DevPasswordAuthMethodId string DevOidcAuthMethodId string DevLoginName string DevPassword string DevUserId string DevUnprivilegedLoginName string DevUnprivilegedPassword string DevUnprivilegedUserId string DevOrgId string DevProjectId string DevHostCatalogId string DevHostSetId string DevHostId string DevTargetId string DevHostAddress string DevTargetDefaultPort int DevTargetSessionMaxSeconds int DevTargetSessionConnectionLimit int DatabaseUrl string DatabaseMaxOpenConnections int DevDatabaseCleanupFunc func() error Database *gorm.DB // contains filtered or unexported fields }
func (*Server) ConnectToDatabase ¶
func (*Server) CreateDevDatabase ¶
func (*Server) CreateGlobalKmsKeys ¶
func (*Server) CreateInitialHostResources ¶
func (*Server) CreateInitialLoginRole ¶
func (*Server) CreateInitialPasswordAuthMethod ¶ added in v0.2.0
func (*Server) CreateInitialScopes ¶
func (*Server) CreateInitialTarget ¶
func (*Server) DestroyDevDatabase ¶
func (*Server) ReleaseLogGate ¶
func (b *Server) ReleaseLogGate()
func (*Server) RemovePidFile ¶
func (*Server) RunShutdownFuncs ¶
func (*Server) SetupControllerPublicClusterAddress ¶ added in v0.1.2
func (*Server) SetupListeners ¶
func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allowedPurposes []string) error
func (*Server) SetupLogging ¶
func (*Server) SetupMetrics ¶
func (*Server) SetupWorkerPublicAddress ¶
func (*Server) StorePidFile ¶
type ServerListener ¶
type StringMapVar ¶
type StringMapVar struct { Name string Aliases []string Usage string Default map[string]string Hidden bool Target *map[string]string Completion complete.Predictor }
-- StringMapVar and stringMapValue
type StringSliceVar ¶
type StringSliceVar struct { Name string Aliases []string Usage string Default []string Hidden bool EnvVar string Target *[]string Completion complete.Predictor }
-- StringSliceVar and stringSliceValue
type StringVar ¶
type StringVar struct { Name string Aliases []string Usage string Default string Hidden bool EnvVar string Target *string Completion complete.Predictor }
-- StringVar and stringValue
type TCPKeepAliveListener ¶
type TCPKeepAliveListener struct {
*net.TCPListener
}
TCPKeepAliveListener sets TCP keep-alive timeouts on accepted connections. It's used by ListenAndServe and ListenAndServeTLS so dead TCP connections (e.g. closing laptop mid-download) eventually go away.
This is copied directly from the Go source code.
type Uint64Var ¶
type Uint64Var struct { Name string Aliases []string Usage string Default uint64 Hidden bool EnvVar string Target *uint64 Completion complete.Predictor }
-- Uint64Var and uint64Value
type UintVar ¶
type UintVar struct { Name string Aliases []string Usage string Default uint Hidden bool EnvVar string Target *uint Completion complete.Predictor }
-- UintVar && uintValue