stats

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "stats"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [8]string{"Get size stats", "Get open issues stats", "Get fixed issues stats", "Get stats assets per severity", "Get issues stats", "Get stats MTTR", "Get stats exposure", "Get stats current exposure"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func NewGetFixedIssuesStatsEndpoint

func NewGetFixedIssuesStatsEndpoint(s Service) goa.Endpoint

NewGetFixedIssuesStatsEndpoint returns an endpoint function that calls the method "Get fixed issues stats" of service "stats".

func NewGetIssuesStatsEndpoint

func NewGetIssuesStatsEndpoint(s Service) goa.Endpoint

NewGetIssuesStatsEndpoint returns an endpoint function that calls the method "Get issues stats" of service "stats".

func NewGetOpenIssuesStatsEndpoint

func NewGetOpenIssuesStatsEndpoint(s Service) goa.Endpoint

NewGetOpenIssuesStatsEndpoint returns an endpoint function that calls the method "Get open issues stats" of service "stats".

func NewGetSizeStatsEndpoint

func NewGetSizeStatsEndpoint(s Service) goa.Endpoint

NewGetSizeStatsEndpoint returns an endpoint function that calls the method "Get size stats" of service "stats".

func NewGetStatsAssetsPerSeverityEndpoint

func NewGetStatsAssetsPerSeverityEndpoint(s Service) goa.Endpoint

NewGetStatsAssetsPerSeverityEndpoint returns an endpoint function that calls the method "Get stats assets per severity" of service "stats".

func NewGetStatsCurrentExposureEndpoint

func NewGetStatsCurrentExposureEndpoint(s Service) goa.Endpoint

NewGetStatsCurrentExposureEndpoint returns an endpoint function that calls the method "Get stats current exposure" of service "stats".

func NewGetStatsExposureEndpoint

func NewGetStatsExposureEndpoint(s Service) goa.Endpoint

NewGetStatsExposureEndpoint returns an endpoint function that calls the method "Get stats exposure" of service "stats".

func NewGetStatsMTTREndpoint

func NewGetStatsMTTREndpoint(s Service) goa.Endpoint

NewGetStatsMTTREndpoint returns an endpoint function that calls the method "Get stats MTTR" of service "stats".

func NewViewedCurrentExposure

func NewViewedCurrentExposure(res *CurrentExposure, view string) *statsviews.CurrentExposure

NewViewedCurrentExposure initializes viewed result type CurrentExposure from result type CurrentExposure using the given view.

func NewViewedExposure

func NewViewedExposure(res *Exposure, view string) *statsviews.Exposure

NewViewedExposure initializes viewed result type Exposure from result type Exposure using the given view.

func NewViewedIssueStatsCollection

func NewViewedIssueStatsCollection(res IssueStatsCollection, view string) statsviews.IssueStatsCollection

NewViewedIssueStatsCollection initializes viewed result type IssueStatsCollection from result type IssueStatsCollection using the given view.

func NewViewedSeverity

func NewViewedSeverity(res *Severity, view string) *statsviews.Severity

NewViewedSeverity initializes viewed result type Severity from result type Severity using the given view.

func NewViewedSeverityAndTotal

func NewViewedSeverityAndTotal(res *SeverityAndTotal, view string) *statsviews.SeverityAndTotal

NewViewedSeverityAndTotal initializes viewed result type SeverityAndTotal from result type SeverityAndTotal using the given view.

func NewViewedSize

func NewViewedSize(res *Size, view string) *statsviews.Size

NewViewedSize initializes viewed result type Size from result type Size using the given view.

Types

type Client

type Client struct {
	GetSizeStatsEndpoint              goa.Endpoint
	GetOpenIssuesStatsEndpoint        goa.Endpoint
	GetFixedIssuesStatsEndpoint       goa.Endpoint
	GetStatsAssetsPerSeverityEndpoint goa.Endpoint
	GetIssuesStatsEndpoint            goa.Endpoint
	GetStatsMTTREndpoint              goa.Endpoint
	GetStatsExposureEndpoint          goa.Endpoint
	GetStatsCurrentExposureEndpoint   goa.Endpoint
}

Client is the "stats" service client.

func NewClient

func NewClient(getSizeStats, getOpenIssuesStats, getFixedIssuesStats, getStatsAssetsPerSeverity, getIssuesStats, getStatsMTTR, getStatsExposure, getStatsCurrentExposure goa.Endpoint) *Client

NewClient initializes a "stats" service client given the endpoints.

func (*Client) GetFixedIssuesStats

func (c *Client) GetFixedIssuesStats(ctx context.Context, p *GetFixedIssuesStatsPayload) (res *Severity, err error)

GetFixedIssuesStats calls the "Get fixed issues stats" endpoint of the "stats" service.

func (*Client) GetIssuesStats

func (c *Client) GetIssuesStats(ctx context.Context, p *GetIssuesStatsPayload) (res IssueStatsCollection, err error)

GetIssuesStats calls the "Get issues stats" endpoint of the "stats" service.

func (*Client) GetOpenIssuesStats

func (c *Client) GetOpenIssuesStats(ctx context.Context, p *GetOpenIssuesStatsPayload) (res *Severity, err error)

GetOpenIssuesStats calls the "Get open issues stats" endpoint of the "stats" service.

func (*Client) GetSizeStats

func (c *Client) GetSizeStats(ctx context.Context) (res *Size, err error)

GetSizeStats calls the "Get size stats" endpoint of the "stats" service.

func (*Client) GetStatsAssetsPerSeverity

func (c *Client) GetStatsAssetsPerSeverity(ctx context.Context, p *GetStatsAssetsPerSeverityPayload) (res *SeverityAndTotal, err error)

GetStatsAssetsPerSeverity calls the "Get stats assets per severity" endpoint of the "stats" service.

func (*Client) GetStatsCurrentExposure

func (c *Client) GetStatsCurrentExposure(ctx context.Context, p *GetStatsCurrentExposurePayload) (res *CurrentExposure, err error)

GetStatsCurrentExposure calls the "Get stats current exposure" endpoint of the "stats" service.

func (*Client) GetStatsExposure

func (c *Client) GetStatsExposure(ctx context.Context, p *GetStatsExposurePayload) (res *Exposure, err error)

GetStatsExposure calls the "Get stats exposure" endpoint of the "stats" service.

func (*Client) GetStatsMTTR

func (c *Client) GetStatsMTTR(ctx context.Context, p *GetStatsMTTRPayload) (res *SeverityAndTotal, err error)

GetStatsMTTR calls the "Get stats MTTR" endpoint of the "stats" service.

type CurrentExposure

type CurrentExposure struct {
	// Percentile 10 of exposure
	Percentile10 *float32
	// Percentile 25 of exposure or first quartile
	Percentile25 *float32
	// Percentile 50 of exposure or median
	Percentile50 *float32
	// Percentile 75 of exposure or third quartile
	Percentile75 *float32
	// Percentile 90 of exposure
	Percentile90 *float32
	// Mean exposure
	Mean *float32
}

CurrentExposure is the result type of the stats service Get stats current exposure method.

func NewCurrentExposure

func NewCurrentExposure(vres *statsviews.CurrentExposure) *CurrentExposure

NewCurrentExposure initializes result type CurrentExposure from viewed result type CurrentExposure.

type Endpoints

type Endpoints struct {
	GetSizeStats              goa.Endpoint
	GetOpenIssuesStats        goa.Endpoint
	GetFixedIssuesStats       goa.Endpoint
	GetStatsAssetsPerSeverity goa.Endpoint
	GetIssuesStats            goa.Endpoint
	GetStatsMTTR              goa.Endpoint
	GetStatsExposure          goa.Endpoint
	GetStatsCurrentExposure   goa.Endpoint
}

Endpoints wraps the "stats" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "stats" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "stats" service endpoints.

type Exposure

type Exposure struct {
	// Percentile 10 of exposure
	Percentile10 *float32
	// Percentile 25 of exposure or first quartile
	Percentile25 *float32
	// Percentile 50 of exposure or median
	Percentile50 *float32
	// Percentile 75 of exposure or third quartile
	Percentile75 *float32
	// Percentile 90 of exposure
	Percentile90 *float32
	// Mean exposure
	Mean *float32
}

Exposure is the result type of the stats service Get stats exposure method.

func NewExposure

func NewExposure(vres *statsviews.Exposure) *Exposure

NewExposure initializes result type Exposure from viewed result type Exposure.

type GetFixedIssuesStatsPayload

type GetFixedIssuesStatsPayload struct {
	// Targets team filter
	Team *string
	// Comma separated list of target teams to filter by
	Teams *string
	// Minimum date filter (YYYY-MM-DD)
	MinDate *string
	// Maximum date filter (YYYY-MM-DD)
	MaxDate *string
	// Allows to get stats for fixed findings at a specific date (YYYY-MM-DD). This
	// filter has preference over minDate and maxDate.
	AtDate *string
	// A comma separated list of asset identifiers
	Identifiers *string
	// A comma separated list of associated labels
	Labels *string
}

GetFixedIssuesStatsPayload is the payload type of the stats service Get fixed issues stats method.

type GetIssuesStatsPayload

type GetIssuesStatsPayload struct {
	// Minimum date filter (YYYY-MM-DD)
	MinDate *string
	// Maximum date filter (YYYY-MM-DD)
	MaxDate *string
	// Minimum issues score filter
	MinScore *int
	// Maximum issues score filter
	MaxScore *int
}

GetIssuesStatsPayload is the payload type of the stats service Get issues stats method.

type GetOpenIssuesStatsPayload

type GetOpenIssuesStatsPayload struct {
	// Targets team filter
	Team *string
	// Comma separated list of target teams to filter by
	Teams *string
	// Minimum date filter (YYYY-MM-DD)
	MinDate *string
	// Maximum date filter (YYYY-MM-DD)
	MaxDate *string
	// Allows to get stats for open findings at a specific date (YYYY-MM-DD). This
	// filter has preference over minDate and maxDate.
	AtDate *string
	// A comma separated list of asset identifiers
	Identifiers *string
	// A comma separated list of associated labels
	Labels *string
}

GetOpenIssuesStatsPayload is the payload type of the stats service Get open issues stats method.

type GetStatsAssetsPerSeverityPayload

type GetStatsAssetsPerSeverityPayload struct {
	// Targets team filter
	Team *string
	// Comma separated list of target teams to filter by
	Teams *string
	// A comma separated list of asset identifiers
	Identifiers *string
	// A comma separated list of associated labels
	Labels *string
}

GetStatsAssetsPerSeverityPayload is the payload type of the stats service Get stats assets per severity method.

type GetStatsCurrentExposurePayload

type GetStatsCurrentExposurePayload struct {
	// Targets team filter
	Team *string
	// Comma separated list of target teams to filter by
	Teams *string
	// Minimum issues score filter
	MinScore *int
	// Maximum issues score filter
	MaxScore *int
	// A comma separated list of associated labels
	Labels *string
}

GetStatsCurrentExposurePayload is the payload type of the stats service Get stats current exposure method.

type GetStatsExposurePayload

type GetStatsExposurePayload struct {
	// Targets team filter
	Team *string
	// Comma separated list of target teams to filter by
	Teams *string
	// Allows to get stats at a specific date (YYYY-MM-DD)
	AtDate *string
	// Minimum issues score filter
	MinScore *int
	// Maximum issues score filter
	MaxScore *int
}

GetStatsExposurePayload is the payload type of the stats service Get stats exposure method.

type GetStatsMTTRPayload

type GetStatsMTTRPayload struct {
	// Targets team filter
	Team *string
	// Comma separated list of target teams to filter by
	Teams *string
	// Minimum date filter (YYYY-MM-DD)
	MinDate *string
	// Maximum date filter (YYYY-MM-DD)
	MaxDate *string
	// A comma separated list of associated labels
	Labels *string
}

GetStatsMTTRPayload is the payload type of the stats service Get stats MTTR method.

type IssueStats

type IssueStats struct {
	// Issue ID
	ID *string
	// Issue summary
	Summary *string
	// Common Weakness Enumeration ID
	CweID *int
	// Issue description
	Description *string
	// Recommendations to fix the issue
	Recommendations []string
	// Documentation reference for the issue
	ReferenceLinks []string
	// Number of OPEN findings for this issue
	Open *int
	// Number of FIXED findings for this issue
	Fixed *int
}

type IssueStatsCollection

type IssueStatsCollection []*IssueStats

IssueStatsCollection is the result type of the stats service Get issues stats method.

func NewIssueStatsCollection

func NewIssueStatsCollection(vres statsviews.IssueStatsCollection) IssueStatsCollection

NewIssueStatsCollection initializes result type IssueStatsCollection from viewed result type IssueStatsCollection.

type Service

type Service interface {
	// GetSizeStats implements Get size stats.
	GetSizeStats(context.Context) (res *Size, err error)
	// This method gets statistics for open findings by using different filters.
	// When querying for a specific time range, it returns every finding that has
	// been found in that time, regardless if that finding has also been fixed in
	// that span of time.
	GetOpenIssuesStats(context.Context, *GetOpenIssuesStatsPayload) (res *Severity, err error)
	// This method gets statistics for fixed findings by using different filters.
	// When querying for a specific time range, it returns every finding that has
	// been fixed in that time and it's fixed at the end of the time range
	// specified, so a finding that is fixed and then reopened in that range of
	// time will not be counted.
	GetFixedIssuesStats(context.Context, *GetFixedIssuesStatsPayload) (res *Severity, err error)
	// GetStatsAssetsPerSeverity implements Get stats assets per severity.
	GetStatsAssetsPerSeverity(context.Context, *GetStatsAssetsPerSeverityPayload) (res *SeverityAndTotal, err error)
	// GetIssuesStats implements Get issues stats.
	GetIssuesStats(context.Context, *GetIssuesStatsPayload) (res IssueStatsCollection, err error)
	// GetStatsMTTR implements Get stats MTTR.
	GetStatsMTTR(context.Context, *GetStatsMTTRPayload) (res *SeverityAndTotal, err error)
	// GetStatsExposure implements Get stats exposure.
	GetStatsExposure(context.Context, *GetStatsExposurePayload) (res *Exposure, err error)
	// GetStatsCurrentExposure implements Get stats current exposure.
	GetStatsCurrentExposure(context.Context, *GetStatsCurrentExposurePayload) (res *CurrentExposure, err error)
}

Stats endpoint.

type Severity

type Severity struct {
	// Number of critial issues
	Critical *int
	// Number of high issues
	High *int
	// Number of medium issues
	Medium *int
	// Number of low issues
	Low *int
	// Number of informational issues
	Informational *int
}

Severity is the result type of the stats service Get open issues stats method.

func NewSeverity

func NewSeverity(vres *statsviews.Severity) *Severity

NewSeverity initializes result type Severity from viewed result type Severity.

type SeverityAndTotal

type SeverityAndTotal struct {
	// Value for critical severity
	Critical *int
	// Value for high severity
	High *int
	// Value for medium severity
	Medium *int
	// Value for low severity
	Low *int
	// Value for informational severity
	Informational *int
	// Total number of issues
	Total *int
}

SeverityAndTotal is the result type of the stats service Get stats assets per severity method.

func NewSeverityAndTotal

func NewSeverityAndTotal(vres *statsviews.SeverityAndTotal) *SeverityAndTotal

NewSeverityAndTotal initializes result type SeverityAndTotal from viewed result type SeverityAndTotal.

type Size

type Size struct {
	// Number of sources
	Sources *int
	// Number of targets
	Targets *int
	// Number of issues
	Issues *int
	// Number of findings
	Findings *int
	// Number of finding events
	FindingEvents *int
}

Size is the result type of the stats service Get size stats method.

func NewSize

func NewSize(vres *statsviews.Size) *Size

NewSize initializes result type Size from viewed result type Size.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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