storage

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BucketVulnerableReports string
	BucketReports           string
	BucketLogs              string
	Region                  string
	LinkBase                string
	Endpoint                string
	PathStyle               bool
}

Config represents the configuration options for S3Storage objects

type S3Storage

type S3Storage struct {
	Conf Config
	// contains filtered or unexported fields
}

S3Storage implements the Storage interface storing the results in S3.

func NewS3Storage

func NewS3Storage(c Config, l *logrus.Entry, s s3iface.S3API) *S3Storage

NewS3Storage creates a S3Storage for a specified bucket.

func (*S3Storage) GetLog

func (s *S3Storage) GetLog(date, scanID, checkID string) ([]byte, error)

GetLog downloads from S3 and returns the report that corresponds to the input params.

func (*S3Storage) GetReport

func (s *S3Storage) GetReport(date, scanID, checkID string) ([]byte, error)

GetReport downloads from S3 and returns the report that corresponds to the input params.

func (*S3Storage) SaveLogs

func (s *S3Storage) SaveLogs(scanID, checkID string, startedAt time.Time, logs []byte) (link string, err error)

SaveLogs stores the result in an S3 file.

func (*S3Storage) SaveReports

func (s *S3Storage) SaveReports(scanID, checkID string, startedAt time.Time, report []byte, vulnerable bool) (link string, err error)

SaveReports stores the result in an S3 file.

type Storage

type Storage interface {
	SaveReports(scanID, checkID string, startedAt time.Time, report []byte, vulnerable bool) (link string, err error)
	SaveLogs(scanID, checkID string, startedAt time.Time, logs []byte) (link string, err error)

	GetReport(date, scanID, checkID string) ([]byte, error)
	GetLog(date, scanID, checkID string) ([]byte, error)
}

Storage is an interface of a type that can save a result.

Jump to

Keyboard shortcuts

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