server

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeGetSourceMTTRRequest

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

DecodeGetSourceMTTRRequest returns a decoder for requests sent to the sources Get source MTTR endpoint.

func DecodeGetSourceRequest

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

DecodeGetSourceRequest returns a decoder for requests sent to the sources Get source endpoint.

func DecodeListFindingsBySourceRequest

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

DecodeListFindingsBySourceRequest returns a decoder for requests sent to the sources List findings by source endpoint.

func DecodeListSourcesRequest

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

DecodeListSourcesRequest returns a decoder for requests sent to the sources List sources endpoint.

func EncodeGetSourceMTTRResponse

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

EncodeGetSourceMTTRResponse returns an encoder for responses returned by the sources Get source MTTR endpoint.

func EncodeGetSourceResponse

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

EncodeGetSourceResponse returns an encoder for responses returned by the sources Get source endpoint.

func EncodeListFindingsBySourceResponse

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

EncodeListFindingsBySourceResponse returns an encoder for responses returned by the sources List findings by source endpoint.

func EncodeListSourcesResponse

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

EncodeListSourcesResponse returns an encoder for responses returned by the sources List sources endpoint.

func GetSourceMTTRSourcesPath

func GetSourceMTTRSourcesPath(id string) string

GetSourceMTTRSourcesPath returns the URL path to the sources service Get source MTTR HTTP endpoint.

func GetSourceSourcesPath

func GetSourceSourcesPath(id string) string

GetSourceSourcesPath returns the URL path to the sources service Get source HTTP endpoint.

func ListFindingsBySourceSourcesPath

func ListFindingsBySourceSourcesPath(id string) string

ListFindingsBySourceSourcesPath returns the URL path to the sources service List findings by source HTTP endpoint.

func ListSourcesSourcesPath

func ListSourcesSourcesPath() string

ListSourcesSourcesPath returns the URL path to the sources service List sources HTTP endpoint.

func Mount

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

Mount configures the mux to serve the sources endpoints.

func MountGetSourceHandler

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

MountGetSourceHandler configures the mux to serve the "sources" service "Get source" endpoint.

func MountGetSourceMTTRHandler

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

MountGetSourceMTTRHandler configures the mux to serve the "sources" service "Get source MTTR" endpoint.

func MountListFindingsBySourceHandler

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

MountListFindingsBySourceHandler configures the mux to serve the "sources" service "List findings by source" endpoint.

func MountListSourcesHandler

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

MountListSourcesHandler configures the mux to serve the "sources" service "List sources" endpoint.

func NewGetSourceHandler

func NewGetSourceHandler(
	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

NewGetSourceHandler creates a HTTP handler which loads the HTTP request and calls the "sources" service "Get source" endpoint.

func NewGetSourceMTTRHandler

func NewGetSourceMTTRHandler(
	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

NewGetSourceMTTRHandler creates a HTTP handler which loads the HTTP request and calls the "sources" service "Get source MTTR" endpoint.

func NewGetSourceMTTRPayload

func NewGetSourceMTTRPayload(id string) *sources.GetSourceMTTRPayload

NewGetSourceMTTRPayload builds a sources service Get source MTTR endpoint payload.

func NewGetSourcePayload

func NewGetSourcePayload(id string) *sources.GetSourcePayload

NewGetSourcePayload builds a sources service Get source endpoint payload.

func NewListFindingsBySourceHandler

func NewListFindingsBySourceHandler(
	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

NewListFindingsBySourceHandler creates a HTTP handler which loads the HTTP request and calls the "sources" service "List findings by source" endpoint.

func NewListFindingsBySourcePayload

func NewListFindingsBySourcePayload(id string, status *string, sortBy *string, page *int, size *int) *sources.ListFindingsBySourcePayload

NewListFindingsBySourcePayload builds a sources service List findings by source endpoint payload.

func NewListSourcesHandler

func NewListSourcesHandler(
	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

NewListSourcesHandler creates a HTTP handler which loads the HTTP request and calls the "sources" service "List sources" endpoint.

func NewListSourcesPayload

func NewListSourcesPayload(page *int, size *int) *sources.ListSourcesPayload

NewListSourcesPayload builds a sources service List sources endpoint payload.

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 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 "sources" service "List findings by source" endpoint HTTP response body.

func NewFindingResponseCollection

func NewFindingResponseCollection(res sourcesviews.FindingCollectionView) FindingResponseCollection

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

type GetSourceResponseBody

type GetSourceResponseBody struct {
	// Source ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Target ID
	TargetID *string `form:"target_id,omitempty" json:"target_id,omitempty" xml:"target_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"`
}

GetSourceResponseBody is the type of the "sources" service "Get source" endpoint HTTP response body.

func NewGetSourceResponseBody

func NewGetSourceResponseBody(res *sourcesviews.SourceView) *GetSourceResponseBody

NewGetSourceResponseBody builds the HTTP response body from the result of the "Get source" endpoint of the "sources" 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 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 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 Server

type Server struct {
	Mounts               []*MountPoint
	ListSources          http.Handler
	GetSource            http.Handler
	ListFindingsBySource http.Handler
	GetSourceMTTR        http.Handler
}

Server lists the sources service endpoint HTTP handlers.

func New

func New(
	e *sources.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 sources 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 SourceResponse

type SourceResponse struct {
	// Source ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Target ID
	TargetID *string `form:"target_id,omitempty" json:"target_id,omitempty" xml:"target_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"`
}

SourceResponse is used to define fields on response body types.

type SourceResponseCollection

type SourceResponseCollection []*SourceResponse

SourceResponseCollection is the type of the "sources" service "List sources" endpoint HTTP response body.

func NewSourceResponseCollection

func NewSourceResponseCollection(res sourcesviews.SourceCollectionView) SourceResponseCollection

NewSourceResponseCollection builds the HTTP response body from the result of the "List sources" endpoint of the "sources" service.

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 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.

Jump to

Keyboard shortcuts

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