server

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeGetFindingMTTRRequest

func DecodeGetFindingMTTRRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeGetFindingMTTRRequest returns a decoder for requests sent to the findings Get finding MTTR endpoint.

func DecodeGetFindingRequest

func DecodeGetFindingRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeGetFindingRequest returns a decoder for requests sent to the findings Get finding endpoint.

func DecodeListEventsByFindingRequest

func DecodeListEventsByFindingRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeListEventsByFindingRequest returns a decoder for requests sent to the findings List events by finding endpoint.

func DecodeListFindingsRequest

func DecodeListFindingsRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeListFindingsRequest returns a decoder for requests sent to the findings List findings endpoint.

func DecodePatchFindingRequest

func DecodePatchFindingRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodePatchFindingRequest returns a decoder for requests sent to the findings Patch finding endpoint.

func EncodeGetFindingMTTRResponse

func EncodeGetFindingMTTRResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeGetFindingMTTRResponse returns an encoder for responses returned by the findings Get finding MTTR endpoint.

func EncodeGetFindingResponse

func EncodeGetFindingResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeGetFindingResponse returns an encoder for responses returned by the findings Get finding endpoint.

func EncodeListEventsByFindingResponse

func EncodeListEventsByFindingResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeListEventsByFindingResponse returns an encoder for responses returned by the findings List events by finding endpoint.

func EncodeListFindingsResponse

func EncodeListFindingsResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeListFindingsResponse returns an encoder for responses returned by the findings List findings endpoint.

func EncodePatchFindingResponse

func EncodePatchFindingResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodePatchFindingResponse returns an encoder for responses returned by the findings Patch finding endpoint.

func GetFindingFindingsPath

func GetFindingFindingsPath(id string) string

GetFindingFindingsPath returns the URL path to the findings service Get finding HTTP endpoint.

func GetFindingMTTRFindingsPath

func GetFindingMTTRFindingsPath(id string) string

GetFindingMTTRFindingsPath returns the URL path to the findings service Get finding MTTR HTTP endpoint.

func ListEventsByFindingFindingsPath

func ListEventsByFindingFindingsPath(id string) string

ListEventsByFindingFindingsPath returns the URL path to the findings service List events by finding HTTP endpoint.

func ListFindingsFindingsPath

func ListFindingsFindingsPath() string

ListFindingsFindingsPath returns the URL path to the findings service List findings HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the findings endpoints.

func MountGetFindingHandler

func MountGetFindingHandler(mux goahttp.Muxer, h http.Handler)

MountGetFindingHandler configures the mux to serve the "findings" service "Get finding" endpoint.

func MountGetFindingMTTRHandler

func MountGetFindingMTTRHandler(mux goahttp.Muxer, h http.Handler)

MountGetFindingMTTRHandler configures the mux to serve the "findings" service "Get finding MTTR" endpoint.

func MountListEventsByFindingHandler

func MountListEventsByFindingHandler(mux goahttp.Muxer, h http.Handler)

MountListEventsByFindingHandler configures the mux to serve the "findings" service "List events by finding" endpoint.

func MountListFindingsHandler

func MountListFindingsHandler(mux goahttp.Muxer, h http.Handler)

MountListFindingsHandler configures the mux to serve the "findings" service "List findings" endpoint.

func MountPatchFindingHandler

func MountPatchFindingHandler(mux goahttp.Muxer, h http.Handler)

MountPatchFindingHandler configures the mux to serve the "findings" service "Patch finding" endpoint.

func NewGetFindingHandler

func NewGetFindingHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewGetFindingHandler creates a HTTP handler which loads the HTTP request and calls the "findings" service "Get finding" endpoint.

func NewGetFindingMTTRHandler

func NewGetFindingMTTRHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewGetFindingMTTRHandler creates a HTTP handler which loads the HTTP request and calls the "findings" service "Get finding MTTR" endpoint.

func NewGetFindingMTTRPayload

func NewGetFindingMTTRPayload(id string) *findings.GetFindingMTTRPayload

NewGetFindingMTTRPayload builds a findings service Get finding MTTR endpoint payload.

func NewGetFindingPayload

func NewGetFindingPayload(id string) *findings.GetFindingPayload

NewGetFindingPayload builds a findings service Get finding endpoint payload.

func NewListEventsByFindingHandler

func NewListEventsByFindingHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewListEventsByFindingHandler creates a HTTP handler which loads the HTTP request and calls the "findings" service "List events by finding" endpoint.

func NewListEventsByFindingPayload

func NewListEventsByFindingPayload(id string, page *int, size *int) *findings.ListEventsByFindingPayload

NewListEventsByFindingPayload builds a findings service List events by finding endpoint payload.

func NewListFindingsHandler

func NewListFindingsHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewListFindingsHandler creates a HTTP handler which loads the HTTP request and calls the "findings" service "List findings" endpoint.

func NewListFindingsPayload

func NewListFindingsPayload(team *string, teams *string, status *string, minScore *int, maxScore *int, atDate *string, minDate *string, maxDate *string, sortBy *string, page *int, size *int, identifier *string, identifiermatch *bool, identifiers *string, labels *string) *findings.ListFindingsPayload

NewListFindingsPayload builds a findings service List findings endpoint payload.

func NewPatchFindingHandler

func NewPatchFindingHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewPatchFindingHandler creates a HTTP handler which loads the HTTP request and calls the "findings" service "Patch finding" endpoint.

func NewPatchFindingPayload

func NewPatchFindingPayload(body *PatchFindingRequestBody, id string, authorization *string) *findings.PatchFindingPayload

NewPatchFindingPayload builds a findings service Patch finding endpoint payload.

func PatchFindingFindingsPath

func PatchFindingFindingsPath(id string) string

PatchFindingFindingsPath returns the URL path to the findings service Patch finding HTTP endpoint.

Types

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type EventResponse

type EventResponse struct {
	// Finding event ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Finding ID
	FindingID *string `form:"finding_id,omitempty" json:"finding_id,omitempty" xml:"finding_id,omitempty"`
	// Source ID
	SourceID *string `form:"source_id,omitempty" json:"source_id,omitempty" xml:"source_id,omitempty"`
	// Finding severity score
	Score *float32 `form:"score,omitempty" json:"score,omitempty" xml:"score,omitempty"`
	// Event time
	Time *string `form:"time,omitempty" json:"time,omitempty" xml:"time,omitempty"`
}

EventResponse is used to define fields on response body types.

type EventResponseCollection

type EventResponseCollection []*EventResponse

EventResponseCollection is the type of the "findings" service "List events by finding" endpoint HTTP response body.

func NewEventResponseCollection

func NewEventResponseCollection(res findingsviews.EventCollectionView) EventResponseCollection

NewEventResponseCollection builds the HTTP response body from the result of the "List events by finding" endpoint of the "findings" service.

type FindingResponse

type FindingResponse struct {
	// Finding ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Issue
	Issue *IssueResponse `form:"issue,omitempty" json:"issue,omitempty" xml:"issue,omitempty"`
	// Target
	Target *TargetResponse `form:"target,omitempty" json:"target,omitempty" xml:"target,omitempty"`
	// Source
	Source *SourcewithnotargetResponse `form:"source,omitempty" json:"source,omitempty" xml:"source,omitempty"`
	// Finding details
	Details *string `form:"details,omitempty" json:"details,omitempty" xml:"details,omitempty"`
	// Finding impact details
	ImpactDetails *string `form:"impact_details,omitempty" json:"impact_details,omitempty" xml:"impact_details,omitempty"`
	// Finding status. Can be 'OPEN' or 'FIXED'.
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
	// Finding severity score
	Score *float32 `form:"score,omitempty" json:"score,omitempty" xml:"score,omitempty"`
	// Other resources associated with the finding
	Resources []*ResourceGroupResponse `form:"resources,omitempty" json:"resources,omitempty" xml:"resources,omitempty"`
}

FindingResponse is used to define fields on response body types.

type FindingResponseCollection

type FindingResponseCollection []*FindingResponse

FindingResponseCollection is the type of the "findings" service "List findings" endpoint HTTP response body.

func NewFindingResponseCollection

func NewFindingResponseCollection(res findingsviews.FindingCollectionView) FindingResponseCollection

NewFindingResponseCollection builds the HTTP response body from the result of the "List findings" endpoint of the "findings" service.

type GetFindingMTTRResponseBody

type GetFindingMTTRResponseBody struct {
	Mttr *int `form:"mttr,omitempty" json:"mttr,omitempty" xml:"mttr,omitempty"`
}

GetFindingMTTRResponseBody is the type of the "findings" service "Get finding MTTR" endpoint HTTP response body.

func NewGetFindingMTTRResponseBody

func NewGetFindingMTTRResponseBody(res *findingsviews.MttrView) *GetFindingMTTRResponseBody

NewGetFindingMTTRResponseBody builds the HTTP response body from the result of the "Get finding MTTR" endpoint of the "findings" service.

type GetFindingResponseBody

type GetFindingResponseBody struct {
	// Finding ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Issue
	Issue *IssueResponseBody `form:"issue,omitempty" json:"issue,omitempty" xml:"issue,omitempty"`
	// Target
	Target *TargetResponseBody `form:"target,omitempty" json:"target,omitempty" xml:"target,omitempty"`
	// Source
	Source *SourcewithnotargetResponseBody `form:"source,omitempty" json:"source,omitempty" xml:"source,omitempty"`
	// Finding details
	Details *string `form:"details,omitempty" json:"details,omitempty" xml:"details,omitempty"`
	// Finding impact details
	ImpactDetails *string `form:"impact_details,omitempty" json:"impact_details,omitempty" xml:"impact_details,omitempty"`
	// Finding status. Can be 'OPEN' or 'FIXED'.
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
	// Finding severity score
	Score *float32 `form:"score,omitempty" json:"score,omitempty" xml:"score,omitempty"`
	// Other resources associated with the finding
	Resources []*ResourceGroupResponseBody `form:"resources,omitempty" json:"resources,omitempty" xml:"resources,omitempty"`
}

GetFindingResponseBody is the type of the "findings" service "Get finding" endpoint HTTP response body.

func NewGetFindingResponseBody

func NewGetFindingResponseBody(res *findingsviews.FindingView) *GetFindingResponseBody

NewGetFindingResponseBody builds the HTTP response body from the result of the "Get finding" endpoint of the "findings" service.

type IssueResponse

type IssueResponse struct {
	// Issue ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Issue summary
	Summary *string `form:"summary,omitempty" json:"summary,omitempty" xml:"summary,omitempty"`
	// Common Weakness Enumeration ID
	CweID *int `form:"cwe_id,omitempty" json:"cwe_id,omitempty" xml:"cwe_id,omitempty"`
	// Issue description
	Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
	// Recommendations to fix the issue
	Recommendations []string `form:"recommendations,omitempty" json:"recommendations,omitempty" xml:"recommendations,omitempty"`
	// Documentation reference for the issue
	ReferenceLinks []string `form:"reference_links,omitempty" json:"reference_links,omitempty" xml:"reference_links,omitempty"`
	// Labels associated with the issue
	Labels []string `form:"labels,omitempty" json:"labels,omitempty" xml:"labels,omitempty"`
}

IssueResponse is used to define fields on response body types.

type IssueResponseBody

type IssueResponseBody struct {
	// Issue ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Issue summary
	Summary *string `form:"summary,omitempty" json:"summary,omitempty" xml:"summary,omitempty"`
	// Common Weakness Enumeration ID
	CweID *int `form:"cwe_id,omitempty" json:"cwe_id,omitempty" xml:"cwe_id,omitempty"`
	// Issue description
	Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
	// Recommendations to fix the issue
	Recommendations []string `form:"recommendations,omitempty" json:"recommendations,omitempty" xml:"recommendations,omitempty"`
	// Documentation reference for the issue
	ReferenceLinks []string `form:"reference_links,omitempty" json:"reference_links,omitempty" xml:"reference_links,omitempty"`
	// Labels associated with the issue
	Labels []string `form:"labels,omitempty" json:"labels,omitempty" xml:"labels,omitempty"`
}

IssueResponseBody is used to define fields on response body types.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type PatchFindingRequestBody

type PatchFindingRequestBody struct {
	// Status
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}

PatchFindingRequestBody is the type of the "findings" service "Patch finding" endpoint HTTP request body.

type PatchFindingResponseBody

type PatchFindingResponseBody struct {
	// Finding ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Issue
	Issue *IssueResponseBody `form:"issue,omitempty" json:"issue,omitempty" xml:"issue,omitempty"`
	// Target
	Target *TargetResponseBody `form:"target,omitempty" json:"target,omitempty" xml:"target,omitempty"`
	// Source
	Source *SourcewithnotargetResponseBody `form:"source,omitempty" json:"source,omitempty" xml:"source,omitempty"`
	// Finding details
	Details *string `form:"details,omitempty" json:"details,omitempty" xml:"details,omitempty"`
	// Finding impact details
	ImpactDetails *string `form:"impact_details,omitempty" json:"impact_details,omitempty" xml:"impact_details,omitempty"`
	// Finding status. Can be 'OPEN' or 'FIXED'.
	Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
	// Finding severity score
	Score *float32 `form:"score,omitempty" json:"score,omitempty" xml:"score,omitempty"`
	// Other resources associated with the finding
	Resources []*ResourceGroupResponseBody `form:"resources,omitempty" json:"resources,omitempty" xml:"resources,omitempty"`
}

PatchFindingResponseBody is the type of the "findings" service "Patch finding" endpoint HTTP response body.

func NewPatchFindingResponseBody

func NewPatchFindingResponseBody(res *findingsviews.FindingView) *PatchFindingResponseBody

NewPatchFindingResponseBody builds the HTTP response body from the result of the "Patch finding" endpoint of the "findings" service.

type ResourceGroupResponse

type ResourceGroupResponse struct {
	// Name of the resource group
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Column names of the resource group in the order that should be rendered
	Attributes []string `form:"attributes,omitempty" json:"attributes,omitempty" xml:"attributes,omitempty"`
	// List containing the resource rows as hashmap
	Resources []map[string]string `form:"resources,omitempty" json:"resources,omitempty" xml:"resources,omitempty"`
}

ResourceGroupResponse is used to define fields on response body types.

type ResourceGroupResponseBody

type ResourceGroupResponseBody struct {
	// Name of the resource group
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Column names of the resource group in the order that should be rendered
	Attributes []string `form:"attributes,omitempty" json:"attributes,omitempty" xml:"attributes,omitempty"`
	// List containing the resource rows as hashmap
	Resources []map[string]string `form:"resources,omitempty" json:"resources,omitempty" xml:"resources,omitempty"`
}

ResourceGroupResponseBody is used to define fields on response body types.

type Server

type Server struct {
	Mounts              []*MountPoint
	ListFindings        http.Handler
	GetFinding          http.Handler
	ListEventsByFinding http.Handler
	GetFindingMTTR      http.Handler
	PatchFinding        http.Handler
}

Server lists the findings service endpoint HTTP handlers.

func New

func New(
	e *findings.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the findings service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type SourcewithnotargetResponse

type SourcewithnotargetResponse struct {
	// Source ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Source name
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Source component
	Component *string `form:"component,omitempty" json:"component,omitempty" xml:"component,omitempty"`
	// Source instance
	Instance *string `form:"instance,omitempty" json:"instance,omitempty" xml:"instance,omitempty"`
	// Source options
	Options *string `form:"options,omitempty" json:"options,omitempty" xml:"options,omitempty"`
	// Time on which the source scanned the target
	Time *string `form:"time,omitempty" json:"time,omitempty" xml:"time,omitempty"`
}

SourcewithnotargetResponse is used to define fields on response body types.

type SourcewithnotargetResponseBody

type SourcewithnotargetResponseBody struct {
	// Source ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Source name
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Source component
	Component *string `form:"component,omitempty" json:"component,omitempty" xml:"component,omitempty"`
	// Source instance
	Instance *string `form:"instance,omitempty" json:"instance,omitempty" xml:"instance,omitempty"`
	// Source options
	Options *string `form:"options,omitempty" json:"options,omitempty" xml:"options,omitempty"`
	// Time on which the source scanned the target
	Time *string `form:"time,omitempty" json:"time,omitempty" xml:"time,omitempty"`
}

SourcewithnotargetResponseBody is used to define fields on response body types.

type TargetResponse

type TargetResponse struct {
	// Target ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Target identifier
	Identifier *string `form:"identifier,omitempty" json:"identifier,omitempty" xml:"identifier,omitempty"`
	// List of teams associated with target
	Teams []string `form:"teams,omitempty" json:"teams,omitempty" xml:"teams,omitempty"`
}

TargetResponse is used to define fields on response body types.

type TargetResponseBody

type TargetResponseBody struct {
	// Target ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Target identifier
	Identifier *string `form:"identifier,omitempty" json:"identifier,omitempty" xml:"identifier,omitempty"`
	// List of teams associated with target
	Teams []string `form:"teams,omitempty" json:"teams,omitempty" xml:"teams,omitempty"`
}

TargetResponseBody is used to define fields on response body types.

Jump to

Keyboard shortcuts

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