base

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2023 License: MPL-2.0 Imports: 86 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandSuccess int = iota
	CommandApiError
	CommandCliError
	CommandUserError
)
View Source
const (
	EnvTokenName   = "BOUNDARY_TOKEN_NAME"
	EnvKeyringType = "BOUNDARY_KEYRING_TYPE"

	StoredTokenName = "HashiCorp Boundary Auth Token"
)
View Source
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"
)
View Source
const (
	EnvBoundaryCLINoColor = `BOUNDARY_CLI_NO_COLOR`
	EnvBoundaryCLIFormat  = `BOUNDARY_CLI_FORMAT`
)
View Source
const (
	NoneKeyring          = "none"
	AutoKeyring          = "auto"
	WincredKeyring       = "wincred"
	PassKeyring          = "pass"
	KeychainKeyring      = "keychain"
	SecretServiceKeyring = "secret-service"

	DefaultTokenName = "default"
	LoginCollection  = "login"
	PassPrefix       = "HashiCorp_Boundary"
)
View Source
const (
	// File name to use for storing workerAuth requests
	WorkerAuthReqFile = "auth_request_token"
)

Variables

View Source
var BuiltinListeners = map[string]ListenerFactory{
	"tcp":  tcpListenerFactory,
	"unix": unixListenerFactory,
}

BuiltinListeners is the list of built-in listener types.

View Source
var DevOnlyControllerFlags = func(*Command, *FlagSet) {}
View Source
var TermWidth uint = 80

Functions

func Format

func Format(ui cli.Ui) string

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 MaxAttributesLength(nonAttributesMap, attributesMap map[string]any, keySubstMap map[string]string) int

func NewListener

New creates a new listener of the given type with the given configuration. The type is looked up in the BuiltinListeners map.

func PluginInfoForOutput added in v0.7.0

func PluginInfoForOutput(plg *plugins.PluginInfo, maxLength int) string

func ProcessLogLevelAndFormat

func ProcessLogLevelAndFormat(flagLogLevel, flagLogFormat, configLogLevel, configLogFormat string) (hclog.Level, logging.LogFormat, error)

func ScopeInfoForOutput

func ScopeInfoForOutput(scp *scopes.ScopeInfo, maxLength int) string

func StartMemProfiler

func StartMemProfiler(_ context.Context)

func TokenIdFromToken added in v0.2.1

func TokenIdFromToken(token string) (string, error)

func WrapAtLength

func WrapAtLength(s string) string

WrapAtLength wraps the given text to maxLineLength.

func WrapAtLengthWithPadding

func WrapAtLengthWithPadding(s string, pad int) string

WrapAtLengthWithPadding wraps the given text at the maxLineLength, taking into account any provided left padding.

func WrapForHelpText

func WrapForHelpText(lines []string) string

func WrapMap

func WrapMap(prefixSpaces, maxLengthOverride int, input map[string]any) string

func WrapSlice

func WrapSlice(prefixSpaces int, input []string) string

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 BoundaryUI struct {
	cli.Ui
	Format string
}

type CombinationSliceVar added in v0.7.0

type CombinationSliceVar struct {
	Name           string
	Aliases        []string
	Usage          string
	Hidden         bool
	Target         *[]CombinedSliceFlagValue
	Completion     complete.Predictor
	KvSplit        bool
	KeyOnlyAllowed bool
	KeyDelimiter   *string
	ProtoCompatKey bool
}

CombinationSliceVar uses a wrapped value to allow storing values from different flags in one slice. This is useful if you need ordering to be maintained across flags. It does not currently support env vars.

If KvSplit is set true, each value will be split on the first = into Key and Value parts so that validation can happen at parsing time. If you don't want this kind of behavior, simply combine them, or set KvSplit to false.

If KeyOnlyAllowed is true then it is valid to parse an input with only a key segment and no value.

If KeyDelimiter is non-nil (along with KvSplit being true), the string will be used to split the key. Otherwise, the Keys will be a single-element slice containing the full value.

If ProtoCompat is true, the key will be validated against proto3 syntax requirements for identifiers. If the string is split via KeyDelimiter, each segment will be evaluated independently.

type CombinedSliceFlagValue added in v0.7.0

type CombinedSliceFlagValue struct {
	Name  string
	Keys  []string
	Value *wrapperspb.StringValue
}

CombinedSliceValue holds the raw value (as a string) and the name of the flag that added it.

type Command

type Command struct {
	Context       context.Context
	ContextCancel context.CancelFunc
	UI            cli.Ui
	ShutdownCh    chan struct{}

	FlagToken          string
	FlagTokenName      string
	FlagKeyringType    string
	FlagRecoveryConfig string

	FlagScopeId           string
	FlagScopeName         string
	FlagPluginId          string
	FlagPluginName        string
	FlagId                string
	FlagName              string
	FlagDescription       string
	FlagAuthMethodId      string
	FlagHostCatalogId     string
	FlagCredentialStoreId string
	FlagVersion           int
	FlagRecursive         bool
	FlagFilter            string
	FlagTags              map[string][]string

	// Attribute values
	FlagAttributes string
	FlagAttrs      []CombinedSliceFlagValue

	// Secret values
	FlagSecrets string
	FlagScrts   []CombinedSliceFlagValue

	// Object values
	FlagObject string
	FlagKv     []CombinedSliceFlagValue

	// This will be intialized, if needed, in Config() when instantiating a
	// recovery wrapper, if requested. It's then called as a deferred function
	// on the Run method of the various generated commands.
	WrapperCleanupFunc func() error
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(ui cli.Ui) *Command

New returns a new instance of a base.Command type

func NewServerCommand added in v0.11.0

func NewServerCommand(ui cli.Ui) *Command

New returns a new instance of a base.Command type that does not intercept the shutdown channel

func (*Command) Client

func (c *Command) Client(opt ...Option) (*api.Client, error)

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 (c *Command) DiscoverKeyringTokenInfo() (string, string, error)

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

func (c *Command) PrintApiError(in *api.Error, contextStr string, opt ...Option)

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

func (c *Command) PrintCliError(err error)

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(resp *api.Response, 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(resp *api.Response) 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 ComposedOfEventArgs struct {
	Format       string
	Observations string
	Audit        string
	SysEvents    string
	Allow        []string
	Deny         []string
}

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 EnabledPlugin added in v0.7.1

type EnabledPlugin uint
const (
	EnabledPluginUnknown EnabledPlugin = iota
	EnabledPluginHostLoopback
	EnabledPluginHostAws
	EnabledPluginHostAzure
)

func (EnabledPlugin) String added in v0.7.1

func (e EnabledPlugin) String() string

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 NewFlagSet

func NewFlagSet(name string) *FlagSet

NewFlagSet creates a new flag set.

func (*FlagSet) BoolVar

func (f *FlagSet) BoolVar(i *BoolVar)

func (*FlagSet) CombinationSliceVar added in v0.7.0

func (f *FlagSet) CombinationSliceVar(i *CombinationSliceVar)

func (*FlagSet) DurationVar

func (f *FlagSet) DurationVar(i *DurationVar)

func (*FlagSet) Float64Var

func (f *FlagSet) Float64Var(i *Float64Var)

func (*FlagSet) Int64Var

func (f *FlagSet) Int64Var(i *Int64Var)

func (*FlagSet) IntVar

func (f *FlagSet) IntVar(i *IntVar)

func (*FlagSet) Name

func (f *FlagSet) Name() string

Name returns the name of this flag set.

func (*FlagSet) StringMapVar

func (f *FlagSet) StringMapVar(i *StringMapVar)

func (*FlagSet) StringSliceMapVar added in v0.10.4

func (f *FlagSet) StringSliceMapVar(i *StringSliceMapVar)

func (*FlagSet) StringSliceVar

func (f *FlagSet) StringSliceVar(i *StringSliceVar)

func (*FlagSet) StringVar

func (f *FlagSet) StringVar(i *StringVar)

func (*FlagSet) Uint64Var

func (f *FlagSet) Uint64Var(i *Uint64Var)

func (*FlagSet) UintVar

func (f *FlagSet) UintVar(i *UintVar)

func (*FlagSet) Var

func (f *FlagSet) Var(value flag.Value, name, usage string)

Var is a lower-level API for adding something to the flags. It should be used with caution, since it bypasses all validation. Consider VarFlag instead.

func (*FlagSet) VarFlag

func (f *FlagSet) VarFlag(i *VarFlag)

func (*FlagSet) Visit

func (f *FlagSet) Visit(fn func(*flag.Flag))

func (*FlagSet) VisitAll

func (f *FlagSet) VisitAll(fn func(*flag.Flag))

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 NewFlagSets

func NewFlagSets(ui cli.Ui) *FlagSets

NewFlagSets creates a new flag sets.

func (*FlagSets) Args

func (f *FlagSets) Args() []string

Args returns the remaining args after parsing.

func (*FlagSets) Completions

func (f *FlagSets) Completions() complete.Flags

Completions returns the completions for this flag set.

func (*FlagSets) Help

func (fs *FlagSets) Help() string

Help builds custom help for this command, grouping by flag set.

func (*FlagSets) NewFlagSet

func (f *FlagSets) NewFlagSet(name string) *FlagSet

NewFlagSet creates a new flag set from the given flag sets.

func (*FlagSets) Parse

func (f *FlagSets) Parse(args []string) error

Parse parses the given flags, returning any errors.

func (*FlagSets) Parsed

func (f *FlagSets) Parsed() bool

Parsed reports whether the command-line flags have been parsed.

func (*FlagSets) Visit

func (f *FlagSets) Visit(fn func(*flag.Flag))

Visit visits the flags in lexicographical order, calling fn for each. It visits only those flags that have been set.

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 ...any)

func (*GRPCLogFaker) Fatalf

func (g *GRPCLogFaker) Fatalf(format string, args ...any)

func (*GRPCLogFaker) Fatalln

func (g *GRPCLogFaker) Fatalln(args ...any)

func (*GRPCLogFaker) Print

func (g *GRPCLogFaker) Print(args ...any)

func (*GRPCLogFaker) Printf

func (g *GRPCLogFaker) Printf(format string, args ...any)

func (*GRPCLogFaker) Println

func (g *GRPCLogFaker) Println(args ...any)

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 any) ([]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

func WithAttributeFieldPrefix(p string) Option

WithAttributeFieldPrefix tells the command what prefix to attach to attribute fields when they are returned as errors.

func WithContainerImage added in v0.2.1

func WithContainerImage(name string) Option

WithContainerImage tells the command which container image to start a dev database with

func WithDatabaseTemplate added in v0.6.1

func WithDatabaseTemplate(template string) Option

WithDatabaseTemplate allows for using an existing database template for initializing the boundary database.

func WithEventAuditWrapper added in v0.7.0

func WithEventAuditWrapper(w wrapping.Wrapper) Option

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 WithEventGating added in v0.8.0

func WithEventGating(with bool) Option

WithEventGating starts the eventer in gated mode

func WithEventerConfig added in v0.5.0

func WithEventerConfig(config *event.EventerConfig) Option

WithEventer allows an optional eventer config

func WithHostPlugin added in v0.7.0

func WithHostPlugin(pluginId string, plg plugin.HostPluginServiceClient) Option

WithHostPlugin allows specifying a plugin ID and implementation to create at startup

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 WithSkipWorkerAuthKmsInstantiation added in v0.9.0

func WithSkipWorkerAuthKmsInstantiation(with bool) Option

WithSkipWorkerAuthKmsInstantiation causes KMS methods used for worker-auth to not be processed, useful for dev mode

func WithStatusCode added in v0.4.0

func WithStatusCode(statusCode int) Option

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

	ServerSideShutdownCh chan struct{}

	InfoKeys []string
	Info     map[string]string

	GatedWriter *gatedwriter.Writer
	Logger      hclog.Logger
	CombineLogs bool

	StderrLock *sync.Mutex
	Eventer    *event.Eventer

	RootKms              wrapping.Wrapper
	WorkerAuthKms        wrapping.Wrapper
	WorkerAuthStorageKms wrapping.Wrapper
	RecoveryKms          wrapping.Wrapper
	Kms                  *kms.Kms
	SecureRandomReader   io.Reader

	PrometheusRegisterer prometheus.Registerer

	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 // Target using address.
	DevSecondaryTargetId             string // Target using host sources.
	DevHostAddress                   string // Host address for target using host sources.
	DevTargetAddress                 string // Network address for target with address.
	DevTargetDefaultPort             int
	DevTargetSessionMaxSeconds       int
	DevTargetSessionConnectionLimit  int
	DevLoopbackHostPluginId          string

	// DevUsePkiForUpstream is a hint that we are in dev mode and have a worker
	// auth KMS but want to use PKI for upstream connections
	DevUsePkiForUpstream bool

	EnabledPlugins []EnabledPlugin
	HostPlugins    map[string]plgpb.HostPluginServiceClient

	DevOidcSetup oidcSetup

	DatabaseUrl                     string
	DatabaseMaxOpenConnections      int
	DatabaseMaxIdleConnections      *int
	DatabaseConnMaxIdleTimeDuration *time.Duration

	DevDatabaseCleanupFunc func() error

	Database *db.DB
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cmd *Command) *Server

NewServer creates a new Server.

func (*Server) AddEventerToContext added in v0.5.0

func (b *Server) AddEventerToContext(ctx context.Context) (context.Context, error)

AddEventerToContext will add the server eventer to the context provided

func (*Server) CreateDevDatabase

func (b *Server) CreateDevDatabase(ctx context.Context, opt ...Option) error

func (*Server) CreateDevOidcAuthMethod added in v0.3.0

func (b *Server) CreateDevOidcAuthMethod(ctx context.Context) error

func (*Server) CreateGlobalKmsKeys

func (b *Server) CreateGlobalKmsKeys(ctx context.Context) error

func (*Server) CreateInitialHostResources

func (b *Server) CreateInitialHostResources(ctx context.Context) (*static.HostCatalog, *static.HostSet, *static.Host, error)

func (*Server) CreateInitialLoginRole

func (b *Server) CreateInitialLoginRole(ctx context.Context) (*iam.Role, error)

func (*Server) CreateInitialPasswordAuthMethod added in v0.2.0

func (b *Server) CreateInitialPasswordAuthMethod(ctx context.Context) (*password.AuthMethod, *iam.User, error)

func (*Server) CreateInitialScopes

func (b *Server) CreateInitialScopes(ctx context.Context) (*iam.Scope, *iam.Scope, error)

func (*Server) CreateInitialTargetWithAddress added in v0.12.0

func (b *Server) CreateInitialTargetWithAddress(ctx context.Context) (target.Target, error)

func (*Server) CreateInitialTargetWithHostSources added in v0.12.0

func (b *Server) CreateInitialTargetWithHostSources(ctx context.Context) (target.Target, error)

func (*Server) DestroyDevDatabase

func (b *Server) DestroyDevDatabase(ctx context.Context) error

func (*Server) OpenAndSetServerDatabase added in v0.10.4

func (b *Server) OpenAndSetServerDatabase(ctx context.Context, dialect string) error

OpenAndSetServerDatabase calls OpenDatabase and sets its result *db.DB to the Server's `Database` field.

func (*Server) OpenDatabase added in v0.10.4

func (b *Server) OpenDatabase(ctx context.Context, dialect, url string) (*db.DB, error)

OpenDatabase creates a database connection with the given URL and returns it to the caller. It supports various configuration options - The values must be set on the Server object beforehand.

func (*Server) PrintInfo

func (b *Server) PrintInfo(ui cli.Ui)

func (*Server) RegisterHostPlugin added in v0.7.0

func (b *Server) RegisterHostPlugin(ctx context.Context, name string, plg plgpb.HostPluginServiceClient, opt ...hostplugin.Option) (*hostplugin.Plugin, error)

RegisterHostPlugin creates a host plugin in the database if not present. It also registers the plugin in the shared map of running plugins. Since all boundary provided host plugins must have a name, a name is required when calling RegisterHostPlugin and will be used even if WithName is provided.

func (*Server) ReleaseLogGate

func (b *Server) ReleaseLogGate() error

func (*Server) RemovePidFile

func (b *Server) RemovePidFile(pidPath string) error

func (*Server) RunShutdownFuncs

func (b *Server) RunShutdownFuncs() error

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) SetupKMSes

func (b *Server) SetupKMSes(ctx context.Context, ui cli.Ui, config *config.Config, opt ...Option) error

SetupKMSes takes in a parsed config, does some minor checking on purposes, and sends each off to configutil to instantiate a wrapper.

func (*Server) SetupListeners

func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allowedPurposes []string) error

func (*Server) SetupLogging

func (b *Server) SetupLogging(flagLogLevel, flagLogFormat, configLogLevel, configLogFormat string) error

SetupLogging sets up the command's logger. This is mostly historical at this point since we switched to eventing; however, logging is still used as a fallback when events are unable to be sent.

func (*Server) SetupWorkerPublicAddress

func (b *Server) SetupWorkerPublicAddress(conf *config.Config, flagValue string) error

func (*Server) StorePidFile

func (b *Server) StorePidFile(pidPath string) error

func (*Server) StoreWorkerAuthReq added in v0.9.0

func (b *Server) StoreWorkerAuthReq(authReq, workerAuthReqPath string) error

type ServerListener

type ServerListener struct {
	Config          *listenerutil.ListenerConfig
	HTTPServer      *http.Server
	GrpcServer      *grpc.Server
	ApiListener     net.Listener
	ClusterListener net.Listener
	ProxyListener   net.Listener
	OpsListener     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 StringSliceMapVar added in v0.10.4

type StringSliceMapVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    map[string][]string
	Hidden     bool
	Target     *map[string][]string
	NullCheck  func() bool
	Completion complete.Predictor
}

StringSliceMapVar maps a key string to a slice of string values. This is useful for cases such as modifying Worker tags, which can have multiple values associated per key. Setting NullCheck to return true enables the string input value "null" to be accepted without throwing an error. This is useful for add/set/remove patterns where we want to enable "set null".

type StringSliceVar

type StringSliceVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    []string
	Hidden     bool
	EnvVar     string
	Target     *[]string
	NullCheck  func() bool
	Completion complete.Predictor
}

StringSliceVar reads in parameters from the same flag into a string array. Setting NullCheck enables the following behavior: the function will be run whenever a "null" is seen in the input to determine whether or not it is allowed (and erroring if not); and even if allowed generally, the flag will ensure that "null" is the only value passed.

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.

func (TCPKeepAliveListener) Accept

func (ln TCPKeepAliveListener) Accept() (net.Conn, error)

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

type VarFlag

type VarFlag struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    string
	EnvVar     string
	Value      flag.Value
	Completion complete.Predictor
}

-- VarFlag

type WorkerAuthInfo

type WorkerAuthInfo struct {
	CertPEM         []byte `json:"cert"`
	KeyPEM          []byte `json:"key"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	ConnectionNonce string `json:"connection_nonce"`
	ProxyAddress    string `json:"proxy_address"`
}

Directories

Path Synopsis
internal
metric
Package metric provides functions to initialize a prometheus metric detailing build info
Package metric provides functions to initialize a prometheus metric detailing build info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL