Documentation ¶
Index ¶
- func GrabUnusedPort() (int, error)
- func InitiateSessionConnection(cfg *config.Context, input InitiateSessionConnectionInput) (net.Conn, *yamux.Session, error)
- func ListenAndProxy(ctx context.Context, yamuxStreamConnection *yamux.Session, ...) error
- func Ports(isLocalMode bool) (serverPort, localPort int, err error)
- func PromptEntitlements(entitlements []*accessv1alpha1.Entitlement, targetHeader string, ...) (*accessv1alpha1.Entitlement, error)
- func WaitForSSMConnectionToProxyServer(ctx context.Context, opts WaitForSSMConnectionToProxyServerOpts) error
- type AWSConfig
- type ConnectionOpts
- type DebugWriter
- type DisplayOpts
- type EnsureAccessInput
- type EnsureAccessOutput
- type InitiateSessionConnectionInput
- type NotifyOnSubstringMatchWriter
- type SSMDebugLogger
- func (l *SSMDebugLogger) Close()
- func (l *SSMDebugLogger) Critical(v ...interface{}) error
- func (l *SSMDebugLogger) Criticalf(format string, params ...interface{}) error
- func (l *SSMDebugLogger) Debug(v ...interface{})
- func (l *SSMDebugLogger) Debugf(format string, params ...interface{})
- func (l *SSMDebugLogger) Error(v ...interface{}) error
- func (l *SSMDebugLogger) Errorf(format string, params ...interface{}) error
- func (l *SSMDebugLogger) Flush()
- func (l *SSMDebugLogger) Info(v ...interface{})
- func (l *SSMDebugLogger) Infof(format string, params ...interface{})
- func (l *SSMDebugLogger) Trace(v ...interface{})
- func (l *SSMDebugLogger) Tracef(format string, params ...interface{})
- func (l *SSMDebugLogger) Warn(v ...interface{}) error
- func (l *SSMDebugLogger) Warnf(format string, params ...interface{}) error
- func (l *SSMDebugLogger) WithContext(context ...string) (contextLogger log.T)
- type WaitForSSMConnectionToProxyServerOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GrabUnusedPort ¶
func InitiateSessionConnection ¶
func InitiateSessionConnection(cfg *config.Context, input InitiateSessionConnectionInput) (net.Conn, *yamux.Session, error)
InitiateSessionConnection starts a new tcp connection to through the SSM port forward and completes a handshake with the proxy server the result is a yamux session which is used to multiplex client connections
func ListenAndProxy ¶
func ListenAndProxy(ctx context.Context, yamuxStreamConnection *yamux.Session, clientConnectionPort int, requestURL string) error
ListenAndProxy will listen for new client connections and start a stream over the established proxy server session. if the proxy server terminates the session, like when a grant expires, this listener will detect it and terminate the CLI commmand with an error explaining what happened
func Ports ¶
Returns the proxy port to connect to and a local port to send client connections to in production, an SSM portforward process is running which is used to connect to the proxy server and over the top of this connection, a handshake process takes place and connection multiplexing is used to handle multiple database clients
func PromptEntitlements ¶ added in v0.36.1
func PromptEntitlements(entitlements []*accessv1alpha1.Entitlement, targetHeader string, roleHeader string, promptMessage string) (*accessv1alpha1.Entitlement, error)
func WaitForSSMConnectionToProxyServer ¶
func WaitForSSMConnectionToProxyServer(ctx context.Context, opts WaitForSSMConnectionToProxyServerOpts) error
WaitForSSMConnectionToProxyServer starts a session with SSM and waits for the connection to be ready
Types ¶
type ConnectionOpts ¶
type DebugWriter ¶
type DebugWriter struct{}
DebugWriter is an io.Writer that writes messages using clio.Debug.
type DisplayOpts ¶
type EnsureAccessInput ¶
type EnsureAccessInput[T any] struct { Target string Role string Duration time.Duration Reason string Confirm bool Wait bool PromptForEntitlement func(ctx context.Context, cfg *config.Context) (*accessv1alpha1.Entitlement, error) GetGrantOutput func(msg *accessv1alpha1.GetGrantOutputResponse) (T, error) }
type EnsureAccessOutput ¶
type EnsureAccessOutput[T any] struct { GrantOutput T Grant *accessv1alpha1.Grant }
func EnsureAccess ¶
func EnsureAccess[T any](ctx context.Context, cfg *config.Context, input EnsureAccessInput[T]) (*EnsureAccessOutput[T], error)
ensureAccess checks for an existing grant or creates a new one if it does not exist
type NotifyOnSubstringMatchWriter ¶
type NotifyOnSubstringMatchWriter struct { Phrase string Callback func() }
type SSMDebugLogger ¶
func (*SSMDebugLogger) Close ¶
func (l *SSMDebugLogger) Close()
func (*SSMDebugLogger) Critical ¶
func (l *SSMDebugLogger) Critical(v ...interface{}) error
func (*SSMDebugLogger) Criticalf ¶
func (l *SSMDebugLogger) Criticalf(format string, params ...interface{}) error
func (*SSMDebugLogger) Debug ¶
func (l *SSMDebugLogger) Debug(v ...interface{})
func (*SSMDebugLogger) Debugf ¶
func (l *SSMDebugLogger) Debugf(format string, params ...interface{})
func (*SSMDebugLogger) Error ¶
func (l *SSMDebugLogger) Error(v ...interface{}) error
func (*SSMDebugLogger) Errorf ¶
func (l *SSMDebugLogger) Errorf(format string, params ...interface{}) error
func (*SSMDebugLogger) Flush ¶
func (l *SSMDebugLogger) Flush()
func (*SSMDebugLogger) Info ¶
func (l *SSMDebugLogger) Info(v ...interface{})
func (*SSMDebugLogger) Infof ¶
func (l *SSMDebugLogger) Infof(format string, params ...interface{})
func (*SSMDebugLogger) Trace ¶
func (l *SSMDebugLogger) Trace(v ...interface{})
func (*SSMDebugLogger) Tracef ¶
func (l *SSMDebugLogger) Tracef(format string, params ...interface{})
func (*SSMDebugLogger) Warn ¶
func (l *SSMDebugLogger) Warn(v ...interface{}) error
func (*SSMDebugLogger) Warnf ¶
func (l *SSMDebugLogger) Warnf(format string, params ...interface{}) error
func (*SSMDebugLogger) WithContext ¶
func (l *SSMDebugLogger) WithContext(context ...string) (contextLogger log.T)
type WaitForSSMConnectionToProxyServerOpts ¶
type WaitForSSMConnectionToProxyServerOpts struct { AWSConfig AWSConfig DisplayOpts DisplayOpts ConnectionOpts ConnectionOpts GrantID string RequestID string }