Documentation ¶
Overview ¶
Package gcssessionsHandler implements GCS storage for Teleport session recording persistence.
gcssessions package implements the Handler session recording storage for auth server. Originally contributed by https://github.com/joshdurbin
Index ¶
- type Config
- type Handler
- func (h *Handler) Close() error
- func (h *Handler) CompleteUpload(ctx context.Context, upload events.StreamUpload, parts []events.StreamPart) error
- func (h *Handler) CreateUpload(ctx context.Context, sessionID session.ID) (*events.StreamUpload, error)
- func (h *Handler) Download(ctx context.Context, sessionID session.ID, writerAt io.WriterAt) error
- func (h *Handler) GetUploadMetadata(s session.ID) events.UploadMetadata
- func (h *Handler) ListParts(ctx context.Context, upload events.StreamUpload) ([]events.StreamPart, error)
- func (h *Handler) ListUploads(ctx context.Context) ([]events.StreamUpload, error)
- func (h *Handler) ReserveUploadPart(ctx context.Context, upload events.StreamUpload, partNumber int64) error
- func (h *Handler) Upload(ctx context.Context, sessionID session.ID, reader io.Reader) (string, error)
- func (h *Handler) UploadPart(ctx context.Context, upload events.StreamUpload, partNumber int64, ...) (*events.StreamPart, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Bucket is GCS bucket name Bucket string // Path is an optional bucket path Path string // Path to the credentials file CredentialsPath string // The GCS project ID ProjectID string // KMS key name KMSKeyName string // Endpoint Endpoint string // OnComposerRun is used for fault injection in tests // runs (or doesn't run composer and returns error OnComposerRun func(ctx context.Context, composer *storage.Composer) (*storage.ObjectAttrs, error) // AfterObjectDelete is used for fault injection in tests // runs (or doesn't run object delete) and returns error AfterObjectDelete func(ctx context.Context, object *storage.ObjectHandle, error error) error }
Config is handler configuration
func (*Config) CheckAndSetDefaults ¶
CheckAndSetDefaults checks and sets default values
type Handler ¶
type Handler struct { // Config is handler configuration Config // Entry is a logging entry *log.Entry // contains filtered or unexported fields }
Handler handles upload and downloads to GCS object storage
func DefaultNewHandler ¶
DefaultNewHandler returns a new handler with default GCS client settings derived from the config
func NewHandler ¶
func NewHandler(ctx context.Context, cancelFunc context.CancelFunc, cfg Config, client *storage.Client) (*Handler, error)
NewHandler returns a new handler with specific context, cancelFunc, and client
func (*Handler) CompleteUpload ¶
func (h *Handler) CompleteUpload(ctx context.Context, upload events.StreamUpload, parts []events.StreamPart) error
CompleteUpload completes the upload
func (*Handler) CreateUpload ¶
func (h *Handler) CreateUpload(ctx context.Context, sessionID session.ID) (*events.StreamUpload, error)
CreateUpload creates a multipart upload
func (*Handler) Download ¶
Download downloads recorded session from GCS bucket and writes the results into writer return trace.NotFound error is object is not found
func (*Handler) GetUploadMetadata ¶
func (h *Handler) GetUploadMetadata(s session.ID) events.UploadMetadata
GetUploadMetadata gets the metadata for session upload
func (*Handler) ListParts ¶
func (h *Handler) ListParts(ctx context.Context, upload events.StreamUpload) ([]events.StreamPart, error)
ListParts lists upload parts
func (*Handler) ListUploads ¶
ListUploads lists uploads that have been initiated but not completed with earlier uploads returned first
func (*Handler) ReserveUploadPart ¶
func (h *Handler) ReserveUploadPart(ctx context.Context, upload events.StreamUpload, partNumber int64) error
ReserveUploadPart reserves an upload part.
func (*Handler) Upload ¶
func (h *Handler) Upload(ctx context.Context, sessionID session.ID, reader io.Reader) (string, error)
Upload uploads object to GCS bucket, reads the contents of the object from reader and returns the target GCS bucket path in case of successful upload.
func (*Handler) UploadPart ¶
func (h *Handler) UploadPart(ctx context.Context, upload events.StreamUpload, partNumber int64, partBody io.ReadSeeker) (*events.StreamPart, error)
UploadPart uploads part