Documentation
¶
Index ¶
- func EncodeScanId(v uint64) string
- func Logger(inner http.Handler, name string) http.Handler
- func ValidScanId(s string) bool
- type App
- func (a *App) AddRepository(w http.ResponseWriter, r *http.Request)
- func (a *App) AddScan(w http.ResponseWriter, r *http.Request)
- func (a *App) AddScanRequest(ri *models.RepositoryInfo, sr *models.ScanRecord)
- func (a *App) CleanUp()
- func (a *App) ClearStores()
- func (a *App) DeleteRepository(w http.ResponseWriter, r *http.Request)
- func (a *App) DeleteScan(w http.ResponseWriter, r *http.Request)
- func (a *App) GetRepository(w http.ResponseWriter, r *http.Request)
- func (a *App) GetScan(w http.ResponseWriter, r *http.Request)
- func (a *App) Initialize(noop bool)
- func (a *App) ListRepositories(w http.ResponseWriter, r *http.Request)
- func (a *App) ListScans(w http.ResponseWriter, r *http.Request)
- func (a *App) ModifyRepository(w http.ResponseWriter, r *http.Request)
- func (a *App) NewRouter() HttpRouter
- func (a *App) RemoveScanRequest(id string)
- func (a *App) Run()
- func (a *App) ScanRequestHandler(id string)
- type HttpRouter
- type PsqlDB
- type RepoStore
- type RepoStoreMemDB
- func (rs *RepoStoreMemDB) Delete(id int64) error
- func (rs *RepoStoreMemDB) Insert(ri *models.RepositoryInfo) (*models.RepositoryRecord, error)
- func (rs *RepoStoreMemDB) List(pp *models.PaginationParams) (*models.RepositoryList, error)
- func (rs *RepoStoreMemDB) NextId() int64
- func (rs *RepoStoreMemDB) Retrieve(id int64) (*models.RepositoryRecord, error)
- func (rs *RepoStoreMemDB) Update(rr *models.RepositoryRecord) error
- type RepoStorePsql
- func (rs *RepoStorePsql) Delete(id int64) error
- func (rs *RepoStorePsql) Insert(ri *models.RepositoryInfo) (*models.RepositoryRecord, error)
- func (rs *RepoStorePsql) List(pp *models.PaginationParams) (*models.RepositoryList, error)
- func (rs *RepoStorePsql) Retrieve(id int64) (*models.RepositoryRecord, error)
- func (rs *RepoStorePsql) Update(rr *models.RepositoryRecord) error
- type Route
- type Routes
- type ScanJob
- type ScanStore
- type ScanStoreMemDB
- func (ss *ScanStoreMemDB) Delete(id string) error
- func (ss *ScanStoreMemDB) DeleteFindings(scanId string) (int, error)
- func (ss *ScanStoreMemDB) Insert(si *models.ScanInfo) (*models.ScanRecord, error)
- func (ss *ScanStoreMemDB) InsertFindings(scanId string, findings []*models.FindingsInfo) error
- func (ss *ScanStoreMemDB) List(pp *models.PaginationParams) (*models.ScanList, error)
- func (ss *ScanStoreMemDB) ListFindings(scanId string) ([]*models.FindingsInfo, error)
- func (ss *ScanStoreMemDB) NextFindingsId() int
- func (ss *ScanStoreMemDB) NextId() string
- func (ss *ScanStoreMemDB) Retrieve(id string) (*models.ScanRecord, error)
- func (ss *ScanStoreMemDB) Update(sr *models.ScanRecord) error
- type ScanStorePsqlDB
- func (ss *ScanStorePsqlDB) Delete(id string) error
- func (ss *ScanStorePsqlDB) DeleteFindings(scanId string) (int, error)
- func (ss *ScanStorePsqlDB) Insert(si *models.ScanInfo) (*models.ScanRecord, error)
- func (ss *ScanStorePsqlDB) InsertFindings(scanId string, findings []*models.FindingsInfo) error
- func (ss *ScanStorePsqlDB) List(pp *models.PaginationParams) (*models.ScanList, error)
- func (ss *ScanStorePsqlDB) ListFindings(scanId string) ([]*models.FindingsInfo, error)
- func (ss *ScanStorePsqlDB) NextId() string
- func (ss *ScanStorePsqlDB) Retrieve(id string) (*models.ScanRecord, error)
- func (ss *ScanStorePsqlDB) Update(sr *models.ScanRecord) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeScanId ¶
Helper function to convert a numeric value into a base64 string value that can be used as an id
func ValidScanId ¶
Helper function to validate that the given string is a proper base64 string value
Types ¶
type App ¶
type App struct { Router HttpRouter DBType string DB *PsqlDB RepoStore RepoStore ScanStore ScanStore EngineController engine.Controller EngineScanner engine.Scanner ActiveJobs map[string]*ScanJob ActiveJobsLock sync.RWMutex }
func (*App) AddRepository ¶
func (a *App) AddRepository(w http.ResponseWriter, r *http.Request)
func (*App) AddScanRequest ¶
func (a *App) AddScanRequest(ri *models.RepositoryInfo, sr *models.ScanRecord)
func (*App) ClearStores ¶
func (a *App) ClearStores()
func (*App) DeleteRepository ¶
func (a *App) DeleteRepository(w http.ResponseWriter, r *http.Request)
func (*App) DeleteScan ¶
func (a *App) DeleteScan(w http.ResponseWriter, r *http.Request)
func (*App) GetRepository ¶
func (a *App) GetRepository(w http.ResponseWriter, r *http.Request)
func (*App) Initialize ¶
func (*App) ListRepositories ¶
func (a *App) ListRepositories(w http.ResponseWriter, r *http.Request)
func (*App) ModifyRepository ¶
func (a *App) ModifyRepository(w http.ResponseWriter, r *http.Request)
func (*App) NewRouter ¶
func (a *App) NewRouter() HttpRouter
func (*App) RemoveScanRequest ¶
func (*App) ScanRequestHandler ¶
type HttpRouter ¶
type HttpRouter interface {
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
type PsqlDB ¶
func GetPsqlDBInstance ¶
func GetPsqlDBInstance() *PsqlDB
func (*PsqlDB) Initialize ¶
func (db *PsqlDB) Initialize()
type RepoStore ¶
type RepoStore interface { Insert(ri *models.RepositoryInfo) (*models.RepositoryRecord, error) Retrieve(id int64) (*models.RepositoryRecord, error) Delete(id int64) error Update(rr *models.RepositoryRecord) error List(pp *models.PaginationParams) (*models.RepositoryList, error) }
func NewRepoStore ¶
Create and return a pointer to a new repository data store. Returns nil and an error on failure
func NewRepoStoreMemDB ¶
func NewRepoStorePsqlDB ¶
type RepoStoreMemDB ¶
type RepoStoreMemDB struct { DB *memdb.MemDB // contains filtered or unexported fields }
func (*RepoStoreMemDB) Delete ¶
func (rs *RepoStoreMemDB) Delete(id int64) error
Delete an existing repository record from the data store. Returns nil on success or an error on failure.
func (*RepoStoreMemDB) Insert ¶
func (rs *RepoStoreMemDB) Insert(ri *models.RepositoryInfo) (*models.RepositoryRecord, error)
Add a new repository record to the data store. Returns a pointer to the newly added repository record or nil and an error on failure.
func (*RepoStoreMemDB) List ¶
func (rs *RepoStoreMemDB) List(pp *models.PaginationParams) (*models.RepositoryList, error)
List returns a repository list based on the provided pagination parameters. It will return a maximum of page size repository records while skipping offset-1 records from the start of the data store.
func (*RepoStoreMemDB) NextId ¶
func (rs *RepoStoreMemDB) NextId() int64
Helper function to auto-generate the next unique id value that can be used for new repository records.
func (*RepoStoreMemDB) Retrieve ¶
func (rs *RepoStoreMemDB) Retrieve(id int64) (*models.RepositoryRecord, error)
Retrieve an existing repository record from the data store. Returns a pointer to a copy of the retrieved repository record or nil and an error on failure.
func (*RepoStoreMemDB) Update ¶
func (rs *RepoStoreMemDB) Update(rr *models.RepositoryRecord) error
Update an existing repository record in the data store. Returns nil on success or an error on failure.
type RepoStorePsql ¶
func (*RepoStorePsql) Delete ¶
func (rs *RepoStorePsql) Delete(id int64) error
Delete an existing repository record from the data store. Returns nil on success or an error on failure.
func (*RepoStorePsql) Insert ¶
func (rs *RepoStorePsql) Insert(ri *models.RepositoryInfo) (*models.RepositoryRecord, error)
Add a new repository record to the data store. Returns a pointer to the newly added repository record or nil and an error on failure.
func (*RepoStorePsql) List ¶
func (rs *RepoStorePsql) List(pp *models.PaginationParams) (*models.RepositoryList, error)
List returns a repository list based on the provided pagination parameters. It will return a maximum of page size repository records while skipping offset-1 records from the start of the data store.
func (*RepoStorePsql) Retrieve ¶
func (rs *RepoStorePsql) Retrieve(id int64) (*models.RepositoryRecord, error)
Retrieve an existing repository record from the data store. Returns a pointer to a copy of the retrieved repository record or nil and an error on failure.
func (*RepoStorePsql) Update ¶
func (rs *RepoStorePsql) Update(rr *models.RepositoryRecord) error
Update an existing repository record in the data store. Returns nil on success or an error on failure.
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
type ScanStore ¶
type ScanStore interface { Insert(si *models.ScanInfo) (*models.ScanRecord, error) Retrieve(id string) (*models.ScanRecord, error) Delete(id string) error Update(sr *models.ScanRecord) error List(pp *models.PaginationParams) (*models.ScanList, error) InsertFindings(scanId string, findings []*models.FindingsInfo) error ListFindings(scanId string) ([]*models.FindingsInfo, error) DeleteFindings(scanId string) (int, error) }
func NewScanStore ¶
Create and return a pointer to a new scan data store. Returns nil and an error on failure
func NewScanStoreMemDB ¶
func NewScanStorePsqlDB ¶
type ScanStoreMemDB ¶
type ScanStoreMemDB struct { DB *memdb.MemDB // contains filtered or unexported fields }
func (*ScanStoreMemDB) Delete ¶
func (ss *ScanStoreMemDB) Delete(id string) error
Delete an existing scan record from the data store. Returns nil on success or an error on failure.
func (*ScanStoreMemDB) DeleteFindings ¶
func (ss *ScanStoreMemDB) DeleteFindings(scanId string) (int, error)
DeleteFindings deletes all of the findings from the data store indexed by scanId. All operations related to findings are done in bulk. It returns the number of deleted records on success, or zero and an error on failure, at which point none of the findings will be deleted.
func (*ScanStoreMemDB) Insert ¶
func (ss *ScanStoreMemDB) Insert(si *models.ScanInfo) (*models.ScanRecord, error)
Add a new scan record to the data store. Returns a pointer to the newly added scan record or nil and an error on failure.
func (*ScanStoreMemDB) InsertFindings ¶
func (ss *ScanStoreMemDB) InsertFindings(scanId string, findings []*models.FindingsInfo) error
InsertFindings stores all of the contents of the findings list into the data store, indexed by scanId. All operations related to findings are done in bulk. It returns nil on success or an error on failure, at which point none of the findings will be stored.
func (*ScanStoreMemDB) List ¶
func (ss *ScanStoreMemDB) List(pp *models.PaginationParams) (*models.ScanList, error)
List returns a scan list based on the provided pagination parameters. It will return a maximum of page size repository records while skipping offset-1 records from the start of the data store.
func (*ScanStoreMemDB) ListFindings ¶
func (ss *ScanStoreMemDB) ListFindings(scanId string) ([]*models.FindingsInfo, error)
ListFindings retrieves all of the findings from the data store indexed by scanId. All operations related to findings are done in bulk. It returns a list of findings on success, or nil and an error on failure.
func (*ScanStoreMemDB) NextFindingsId ¶
func (ss *ScanStoreMemDB) NextFindingsId() int
Helper function to auto-generate the next unique id value that can be used for new findings records.
func (*ScanStoreMemDB) NextId ¶
func (ss *ScanStoreMemDB) NextId() string
Helper function to auto-generate the next unique id value that can be used for new scan records.
func (*ScanStoreMemDB) Retrieve ¶
func (ss *ScanStoreMemDB) Retrieve(id string) (*models.ScanRecord, error)
Retrieve an existing scan record from the data store. Returns a pointer to a copy of the retrieved scan record or nil and an error on failure.
func (*ScanStoreMemDB) Update ¶
func (ss *ScanStoreMemDB) Update(sr *models.ScanRecord) error
Update an existing scan record in the data store. Returns nil on success or an error on failure.
type ScanStorePsqlDB ¶
func (*ScanStorePsqlDB) Delete ¶
func (ss *ScanStorePsqlDB) Delete(id string) error
Delete an existing scan record from the data store. Returns nil on success or an error on failure.
func (*ScanStorePsqlDB) DeleteFindings ¶
func (ss *ScanStorePsqlDB) DeleteFindings(scanId string) (int, error)
DeleteFindings deletes all of the findings from the data store indexed by scanId. All operations related to findings are done in bulk. It returns the number of deleted records on success, or zero and an error on failure, at which point none of the findings will be deleted.
func (*ScanStorePsqlDB) Insert ¶
func (ss *ScanStorePsqlDB) Insert(si *models.ScanInfo) (*models.ScanRecord, error)
Add a new scan record to the data store. Returns a pointer to the newly added scan record or nil and an error on failure.
func (*ScanStorePsqlDB) InsertFindings ¶
func (ss *ScanStorePsqlDB) InsertFindings(scanId string, findings []*models.FindingsInfo) error
InsertFindings stores all of the contents of the findings list into the data store, indexed by scanId. All operations related to findings are done in bulk. It returns nil on success or an error on failure, at which point none of the findings will be stored.
func (*ScanStorePsqlDB) List ¶
func (ss *ScanStorePsqlDB) List(pp *models.PaginationParams) (*models.ScanList, error)
List returns a scan list based on the provided pagination parameters. It will return a maximum of page size repository records while skipping offset-1 records from the start of the data store.
func (*ScanStorePsqlDB) ListFindings ¶
func (ss *ScanStorePsqlDB) ListFindings(scanId string) ([]*models.FindingsInfo, error)
ListFindings retrieves all of the findings from the data store indexed by scanId. All operations related to findings are done in bulk. It returns a list of findings on success, or nil and an error on failure.
func (*ScanStorePsqlDB) NextId ¶
func (ss *ScanStorePsqlDB) NextId() string
Helper function to auto-generate the next unique id value that can be used for new scan records.
func (*ScanStorePsqlDB) Retrieve ¶
func (ss *ScanStorePsqlDB) Retrieve(id string) (*models.ScanRecord, error)
Retrieve an existing scan record from the data store. Returns a pointer to a copy of the retrieved scan record or nil and an error on failure.
func (*ScanStorePsqlDB) Update ¶
func (ss *ScanStorePsqlDB) Update(sr *models.ScanRecord) error
Update an existing scan record in the data store. Returns nil on success or an error on failure.