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 *listenerutil.ListenerConfig, 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(_ context.Context)
- 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, opt ...Option)
- func (c *Command) PrintCliError(err error)
- func (c *Command) PrintJson(input json.RawMessage, opt ...Option) bool
- func (c *Command) PrintJsonItem(result api.GenericResult, opt ...Option) bool
- func (c *Command) PrintJsonItems(result api.GenericListResult) bool
- func (c *Command) ReadTokenFromKeyring(keyringType, tokenName string) *authtokens.AuthToken
- type ComposedOfEventArgs
- type DurationVar
- type EventFlags
- 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 WithAttributeFieldPrefix(p string) Option
- func WithContainerImage(name string) Option
- func WithEventFlags(flags *EventFlags) Option
- func WithEventerConfig(config *event.EventerConfig) Option
- func WithNoTokenScope() Option
- func WithNoTokenValue() Option
- func WithSkipAuthMethodCreation() Option
- func WithSkipDatabaseDestruction() Option
- func WithSkipHostResourcesCreation() Option
- func WithSkipOidcAuthMethodCreation() Option
- func WithSkipScopesCreation() Option
- func WithSkipTargetCreation() Option
- func WithStatusCode(statusCode int) Option
- type Options
- type Server
- func (b *Server) AddEventerToContext(ctx context.Context) (context.Context, error)
- func (b *Server) ConnectToDatabase(dialect string) error
- func (b *Server) CreateDevDatabase(ctx context.Context, opt ...Option) error
- func (b *Server) CreateDevOidcAuthMethod(ctx context.Context) 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 (s *Server) SetStatusGracePeriodDuration(value time.Duration)
- func (b *Server) SetupControllerPublicClusterAddress(conf *config.Config, flagValue string) error
- func (b *Server) SetupEventing(logger hclog.Logger, serializationLock *sync.Mutex, serverName 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) 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 *listenerutil.ListenerConfig, 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 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
FlagCredentialStoreId 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. WithAttributeFieldPrefix is used, all other options are ignored.
func (*Command) PrintCliError ¶ added in v0.1.8
PrintCliError prints the given CLI error to the UI in the appropriate format
func (*Command) PrintJson ¶ added in v0.4.0
func (c *Command) PrintJson(input json.RawMessage, opt ...Option) bool
PrintJson prints the given raw JSON in our common format
func (*Command) PrintJsonItem ¶ added in v0.1.8
func (c *Command) PrintJsonItem(result api.GenericResult, opt ...Option) 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 ComposedOfEventArgs ¶ added in v0.5.0
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 EventFlags ¶ added in v0.5.0
type EventFlags struct {
Format event.SinkFormat
AuditEnabled *bool
ObservationsEnabled *bool
SysEventsEnabled *bool
AllowFilters []string
DenyFilters []string
}
EventFlags represent the cmd flags supported overriding the configured or default event configuration
func NewEventFlags ¶ added in v0.5.0
func NewEventFlags(defaultFormat event.SinkFormat, c ComposedOfEventArgs) (*EventFlags, error)
NewEventFlags will create a new EventFlags based on the ComposedOfEventArgs which should be populated with command flags which have already been "parsed"
func (*EventFlags) Validate ¶ added in v0.5.0
func (ef *EventFlags) Validate() error
Validate simply validates the flags
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, *listenerutil.ListenerConfig, 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 WithAttributeFieldPrefix ¶ added in v0.4.0
WithAttributeFieldPrefix tells the command what prefix to attach to attribute fields when they are returned as errors.
func WithContainerImage ¶ added in v0.2.1
WithContainerImage tells the command which container image to start a dev database with
func WithEventFlags ¶ added in v0.5.0
func WithEventFlags(flags *EventFlags) Option
WithEventer allows an optional event configuration flags which override whatever is in the EventerConfig
func WithEventerConfig ¶ added in v0.5.0
func WithEventerConfig(config *event.EventerConfig) Option
WithEventer allows an optional eventer config
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 any 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 WithSkipOidcAuthMethodCreation ¶ added in v0.3.0
func WithSkipOidcAuthMethodCreation() Option
WithSkipOidcAuthMethodCreation tells the command not to instantiate an OIDC auth method on first run, useful in some tests.
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.
func WithStatusCode ¶ added in v0.4.0
WithStatusCode allows passing status codes to functions
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
StderrLock *sync.Mutex
Eventer *event.Eventer
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
DevPasswordAccountId string
DevOidcAccountId string
DevUnprivilegedLoginName string
DevUnprivilegedPassword string
DevUnprivilegedUserId string
DevUnprivilegedPasswordAccountId string
DevUnprivilegedOidcAccountId string
DevOrgId string
DevProjectId string
DevHostCatalogId string
DevHostSetId string
DevHostId string
DevTargetId string
DevHostAddress string
DevTargetDefaultPort int
DevTargetSessionMaxSeconds int
DevTargetSessionConnectionLimit int
DevOidcSetup oidcSetup
DatabaseUrl string
DatabaseMaxOpenConnections int
DevDatabaseCleanupFunc func() error
Database *gorm.DB
// StatusGracePeriodDuration represents the period of time (as a
// duration) that the controller will wait before marking
// connections from a disconnected worker as invalid.
StatusGracePeriodDuration time.Duration
// contains filtered or unexported fields
}
func (*Server) AddEventerToContext ¶ added in v0.5.0
AddEventerToContext will add the server eventer to the context provided
func (*Server) ConnectToDatabase ¶
func (*Server) CreateDevDatabase ¶
func (*Server) CreateDevOidcAuthMethod ¶ added in v0.3.0
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) SetStatusGracePeriodDuration ¶ added in v0.5.0
SetStatusGracePeriodDuration sets the value for StatusGracePeriodDuration.
The grace period is the length of time we allow connections to run on a worker in the event of an error sending status updates. The period is defined the length of time since the last successful update.
The setting is derived from one of the following, in order:
- Via the supplied value if non-zero.
- BOUNDARY_STATUS_GRACE_PERIOD, if defined, can be set to an integer value to define the setting.
- If either of these is missing, the default is used. See the defaultStatusGracePeriod value for the default value.
The minimum setting for this value is the default setting. Values below this will be reset to the default.
func (*Server) SetupControllerPublicClusterAddress ¶ added in v0.1.2
func (*Server) SetupEventing ¶ added in v0.5.0
func (b *Server) SetupEventing(logger hclog.Logger, serializationLock *sync.Mutex, serverName string, opt ...Option) error
SetupEventing will setup the server's eventer and initialize the "system wide" eventer with a pointer to the same eventer
func (*Server) SetupListeners ¶
func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allowedPurposes []string) error
func (*Server) SetupLogging ¶
func (*Server) SetupWorkerPublicAddress ¶
func (*Server) StorePidFile ¶
type ServerListener ¶
type ServerListener struct {
Mux *alpnmux.ALPNMux
Config *listenerutil.ListenerConfig
HTTPServer *http.Server
GrpcServer *grpc.Server
ALPNListener net.Listener
}
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