api

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidReportFormat = errors.New("Invalid Report Format")
)

Functions

This section is empty.

Types

type ReportNotificationDTO

type ReportNotificationDTO struct {
	Subject string `json:"subject"`
	Body    string `json:"body"`
	Format  string `json:"format"`
}

ReportNotificationDTO represents the response DTO for the Get Report's Notification endpoint.

type ReportsAPI

type ReportsAPI struct {
	ReportsService *ReportsService
	// contains filtered or unexported fields
}

ReportsAPI represents an API to interact with reports.

func NewReportsAPI

func NewReportsAPI(reportsService *ReportsService) *ReportsAPI

NewReportsAPI builds a new reports API.

func (*ReportsAPI) Start

func (a *ReportsAPI) Start(port int) error

Start starts ReportsAPI to listen on specified port.

type ReportsService

type ReportsService struct {
	// contains filtered or unexported fields
}

ReportsService represents the service layer for the reports API.

func NewReportsService

func NewReportsService(log *log.Logger, notifier notify.Notifier,
	repositories map[model.ReportType]storage.ReportsRepository) *ReportsService

NewReportsService builds a new Reports API Service.

func (*ReportsService) GetReport

func (s *ReportsService) GetReport(c echo.Context) error

GetReport returns the report for the specified type and id.

func (*ReportsService) GetReportNotification

func (s *ReportsService) GetReportNotification(c echo.Context) error

GetReportNotification returns the report's notification data for the specified type and id.

func (*ReportsService) HealthCheck

func (s *ReportsService) HealthCheck(c echo.Context) error

HealthCheck is the service handler for healthcheck queries.

func (*ReportsService) SendReport

func (s *ReportsService) SendReport(c echo.Context) error

SendReport sends the report notification for the specified report type and id.

type ScanReportDTO

type ScanReportDTO struct {
	ID            string `json:"id"`
	ReportURL     string `json:"report_url"`
	ReportJSONURL string `json:"report_json_url"`
	ScanID        string `json:"scan_id"`
	ProgramName   string `json:"program_name"`
	Status        string `json:"status"`
	Risk          int    `json:"risk"`
	EmailSubject  string `json:"email_subject"`
	EmailBody     string `json:"email_body"`
	DeliveredTo   string `json:"delivered_to"`
	// DeliveredTo is a comma separeted list
	// of all recipients to comply with previous
	// vulcan API data format.
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

ScanReportDTO represents the DTO to return for Scan Reports requests.

type SendReportReqDTO

type SendReportReqDTO struct {
	Recipients []string `json:"recipients"`
}

SendReportReqDTO represents the DTO for the Send Report endpoint payload.

Jump to

Keyboard shortcuts

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