server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 9 Imported by: 0

README

server

import "github.com/brittonhayes/citadel/gen/http/vulnerabilities/server"

Index

func DecodeFindRequest

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

DecodeFindRequest returns a decoder for requests sent to the vulnerabilities find endpoint.

func DecodeListRequest

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

DecodeListRequest returns a decoder for requests sent to the vulnerabilities list endpoint.

func DecodeSubmitRequest

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

DecodeSubmitRequest returns a decoder for requests sent to the vulnerabilities submit endpoint.

func EncodeFindError

func EncodeFindError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeFindError returns an encoder for errors returned by the find vulnerabilities endpoint.

func EncodeFindResponse

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

EncodeFindResponse returns an encoder for responses returned by the vulnerabilities find endpoint.

func EncodeListResponse

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

EncodeListResponse returns an encoder for responses returned by the vulnerabilities list endpoint.

func EncodeSubmitError

func EncodeSubmitError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeSubmitError returns an encoder for errors returned by the submit vulnerabilities endpoint.

func EncodeSubmitResponse

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

EncodeSubmitResponse returns an encoder for responses returned by the vulnerabilities submit endpoint.

func FindVulnerabilitiesPath

func FindVulnerabilitiesPath(id uint64) string

FindVulnerabilitiesPath returns the URL path to the vulnerabilities service find HTTP endpoint.

func ListVulnerabilitiesPath

func ListVulnerabilitiesPath() string

ListVulnerabilitiesPath returns the URL path to the vulnerabilities service list HTTP endpoint.

func Mount

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

Mount configures the mux to serve the vulnerabilities endpoints.

func MountFindHandler

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

MountFindHandler configures the mux to serve the "vulnerabilities" service "find" endpoint.

func MountListHandler

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

MountListHandler configures the mux to serve the "vulnerabilities" service "list" endpoint.

func MountSubmitHandler

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

MountSubmitHandler configures the mux to serve the "vulnerabilities" service "submit" endpoint.

func NewFindHandler

func NewFindHandler(
    endpoint endpoint.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

NewFindHandler creates a HTTP handler which loads the HTTP request and calls the "vulnerabilities" service "find" endpoint.

func NewFindPayload

func NewFindPayload(id uint64) *vulnerabilities.FindPayload

NewFindPayload builds a vulnerabilities service find endpoint payload.

func NewListHandler

func NewListHandler(
    endpoint endpoint.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

NewListHandler creates a HTTP handler which loads the HTTP request and calls the "vulnerabilities" service "list" endpoint.

func NewListLimitPayload

func NewListLimitPayload(limit *int32) *vulnerabilities.LimitPayload

NewListLimitPayload builds a vulnerabilities service list endpoint payload.

func NewSubmitHandler

func NewSubmitHandler(
    endpoint endpoint.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

NewSubmitHandler creates a HTTP handler which loads the HTTP request and calls the "vulnerabilities" service "submit" endpoint.

func NewSubmitPayload

func NewSubmitPayload(body *SubmitRequestBody) *vulnerabilities.SubmitPayload

NewSubmitPayload builds a vulnerabilities service submit endpoint payload.

func SubmitVulnerabilitiesPath

func SubmitVulnerabilitiesPath() string

SubmitVulnerabilitiesPath returns the URL path to the vulnerabilities service submit HTTP endpoint.

type ErrorNamer

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

type ErrorNamer interface {
    ErrorName() string
}

type FindNoMatchResponseBody

FindNoMatchResponseBody is the type of the "vulnerabilities" service "find" endpoint HTTP response body for the "no_match" error.

type FindNoMatchResponseBody string
func NewFindNoMatchResponseBody
func NewFindNoMatchResponseBody(res vulnerabilities.NoMatch) FindNoMatchResponseBody

NewFindNoMatchResponseBody builds the HTTP response body from the result of the "find" endpoint of the "vulnerabilities" service.

type FindResponseBody

FindResponseBody is the type of the "vulnerabilities" service "find" endpoint HTTP response body.

type FindResponseBody struct {
    // Unique ID of the vulnerability
    ID  uint64 `form:"id" json:"id" xml:"id"`
    // Title of the vulnerability
    Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
    // Description of the vulnerability
    Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
    // If the vulnerability is exploitable
    Exploitable *bool `form:"exploitable,omitempty" json:"exploitable,omitempty" xml:"exploitable,omitempty"`
    // Severity score of the vulnerability
    CvssScore *float32 `form:"cvss_score,omitempty" json:"cvss_score,omitempty" xml:"cvss_score,omitempty"`
    // If the vulnerability is patchable
    IsPatchable *bool `form:"is_patchable,omitempty" json:"is_patchable,omitempty" xml:"is_patchable,omitempty"`
    // If the vulnerability is upgradeable
    IsUpgradeable *bool `form:"is_upgradeable,omitempty" json:"is_upgradeable,omitempty" xml:"is_upgradeable,omitempty"`
}
func NewFindResponseBody
func NewFindResponseBody(res *vulnerabilities.Vulnerability) *FindResponseBody

NewFindResponseBody builds the HTTP response body from the result of the "find" endpoint of the "vulnerabilities" service.

type ListResponseBody

ListResponseBody is the type of the "vulnerabilities" service "list" endpoint HTTP response body.

type ListResponseBody []*VulnerabilityResponse
func NewListResponseBody
func NewListResponseBody(res []*vulnerabilities.Vulnerability) ListResponseBody

NewListResponseBody builds the HTTP response body from the result of the "list" endpoint of the "vulnerabilities" service.

type MountPoint

MountPoint holds information about the mounted endpoints.

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
}

type Server

Server lists the vulnerabilities service endpoint HTTP handlers.

type Server struct {
    Mounts []*MountPoint
    Find   http.Handler
    List   http.Handler
    Submit http.Handler
}
func New
func New(
    e *vulnerabilities.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 vulnerabilities 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 SubmitNoMatchResponseBody

SubmitNoMatchResponseBody is the type of the "vulnerabilities" service "submit" endpoint HTTP response body for the "no_match" error.

type SubmitNoMatchResponseBody string
func NewSubmitNoMatchResponseBody
func NewSubmitNoMatchResponseBody(res vulnerabilities.NoMatch) SubmitNoMatchResponseBody

NewSubmitNoMatchResponseBody builds the HTTP response body from the result of the "submit" endpoint of the "vulnerabilities" service.

type SubmitRequestBody

SubmitRequestBody is the type of the "vulnerabilities" service "submit" endpoint HTTP request body.

type SubmitRequestBody struct {
    // Title of the vulnerability
    Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
    // Description of the vulnerability
    Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
    // If the vulnerability is exploitable
    Exploitable *bool `form:"exploitable,omitempty" json:"exploitable,omitempty" xml:"exploitable,omitempty"`
    // Severity score of the vulnerability
    CvssScore *float32 `form:"cvss_score,omitempty" json:"cvss_score,omitempty" xml:"cvss_score,omitempty"`
    // If the vulnerability is patchable
    IsPatchable *bool `form:"is_patchable,omitempty" json:"is_patchable,omitempty" xml:"is_patchable,omitempty"`
    // If the vulnerability is upgradeable
    IsUpgradeable *bool `form:"is_upgradeable,omitempty" json:"is_upgradeable,omitempty" xml:"is_upgradeable,omitempty"`
}

type VulnerabilityResponse

VulnerabilityResponse is used to define fields on response body types.

type VulnerabilityResponse struct {
    // Unique ID of the vulnerability
    ID  uint64 `form:"id" json:"id" xml:"id"`
    // Title of the vulnerability
    Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
    // Description of the vulnerability
    Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
    // If the vulnerability is exploitable
    Exploitable *bool `form:"exploitable,omitempty" json:"exploitable,omitempty" xml:"exploitable,omitempty"`
    // Severity score of the vulnerability
    CvssScore *float32 `form:"cvss_score,omitempty" json:"cvss_score,omitempty" xml:"cvss_score,omitempty"`
    // If the vulnerability is patchable
    IsPatchable *bool `form:"is_patchable,omitempty" json:"is_patchable,omitempty" xml:"is_patchable,omitempty"`
    // If the vulnerability is upgradeable
    IsUpgradeable *bool `form:"is_upgradeable,omitempty" json:"is_upgradeable,omitempty" xml:"is_upgradeable,omitempty"`
}

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFindRequest

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

DecodeFindRequest returns a decoder for requests sent to the vulnerabilities find endpoint.

func DecodeListRequest

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

DecodeListRequest returns a decoder for requests sent to the vulnerabilities list endpoint.

func DecodeSubmitRequest

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

DecodeSubmitRequest returns a decoder for requests sent to the vulnerabilities submit endpoint.

func EncodeFindError

func EncodeFindError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeFindError returns an encoder for errors returned by the find vulnerabilities endpoint.

func EncodeFindResponse

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

EncodeFindResponse returns an encoder for responses returned by the vulnerabilities find endpoint.

func EncodeListResponse

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

EncodeListResponse returns an encoder for responses returned by the vulnerabilities list endpoint.

func EncodeSubmitError

func EncodeSubmitError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeSubmitError returns an encoder for errors returned by the submit vulnerabilities endpoint.

func EncodeSubmitResponse

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

EncodeSubmitResponse returns an encoder for responses returned by the vulnerabilities submit endpoint.

func FindVulnerabilitiesPath

func FindVulnerabilitiesPath(id uint64) string

FindVulnerabilitiesPath returns the URL path to the vulnerabilities service find HTTP endpoint.

func ListVulnerabilitiesPath

func ListVulnerabilitiesPath() string

ListVulnerabilitiesPath returns the URL path to the vulnerabilities service list HTTP endpoint.

func Mount

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

Mount configures the mux to serve the vulnerabilities endpoints.

func MountFindHandler

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

MountFindHandler configures the mux to serve the "vulnerabilities" service "find" endpoint.

func MountListHandler

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

MountListHandler configures the mux to serve the "vulnerabilities" service "list" endpoint.

func MountSubmitHandler

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

MountSubmitHandler configures the mux to serve the "vulnerabilities" service "submit" endpoint.

func NewFindHandler

func NewFindHandler(
	endpoint endpoint.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

NewFindHandler creates a HTTP handler which loads the HTTP request and calls the "vulnerabilities" service "find" endpoint.

func NewFindPayload

func NewFindPayload(id uint64) *vulnerabilities.FindPayload

NewFindPayload builds a vulnerabilities service find endpoint payload.

func NewListHandler

func NewListHandler(
	endpoint endpoint.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

NewListHandler creates a HTTP handler which loads the HTTP request and calls the "vulnerabilities" service "list" endpoint.

func NewListLimitPayload

func NewListLimitPayload(limit *int32) *vulnerabilities.LimitPayload

NewListLimitPayload builds a vulnerabilities service list endpoint payload.

func NewSubmitHandler

func NewSubmitHandler(
	endpoint endpoint.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

NewSubmitHandler creates a HTTP handler which loads the HTTP request and calls the "vulnerabilities" service "submit" endpoint.

func NewSubmitPayload

func NewSubmitPayload(body *SubmitRequestBody) *vulnerabilities.SubmitPayload

NewSubmitPayload builds a vulnerabilities service submit endpoint payload.

func SubmitVulnerabilitiesPath

func SubmitVulnerabilitiesPath() string

SubmitVulnerabilitiesPath returns the URL path to the vulnerabilities service submit 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 FindNoMatchResponseBody

type FindNoMatchResponseBody string

FindNoMatchResponseBody is the type of the "vulnerabilities" service "find" endpoint HTTP response body for the "no_match" error.

func NewFindNoMatchResponseBody

func NewFindNoMatchResponseBody(res vulnerabilities.NoMatch) FindNoMatchResponseBody

NewFindNoMatchResponseBody builds the HTTP response body from the result of the "find" endpoint of the "vulnerabilities" service.

type FindResponseBody

type FindResponseBody struct {
	// Unique ID of the vulnerability
	ID uint64 `form:"id" json:"id" xml:"id"`
	// Title of the vulnerability
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// Description of the vulnerability
	Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
	// If the vulnerability is exploitable
	Exploitable *bool `form:"exploitable,omitempty" json:"exploitable,omitempty" xml:"exploitable,omitempty"`
	// Severity score of the vulnerability
	CvssScore *float32 `form:"cvss_score,omitempty" json:"cvss_score,omitempty" xml:"cvss_score,omitempty"`
	// If the vulnerability is patchable
	IsPatchable *bool `form:"is_patchable,omitempty" json:"is_patchable,omitempty" xml:"is_patchable,omitempty"`
	// If the vulnerability is upgradeable
	IsUpgradeable *bool `form:"is_upgradeable,omitempty" json:"is_upgradeable,omitempty" xml:"is_upgradeable,omitempty"`
}

FindResponseBody is the type of the "vulnerabilities" service "find" endpoint HTTP response body.

func NewFindResponseBody

func NewFindResponseBody(res *vulnerabilities.Vulnerability) *FindResponseBody

NewFindResponseBody builds the HTTP response body from the result of the "find" endpoint of the "vulnerabilities" service.

type ListResponseBody

type ListResponseBody []*VulnerabilityResponse

ListResponseBody is the type of the "vulnerabilities" service "list" endpoint HTTP response body.

func NewListResponseBody

func NewListResponseBody(res []*vulnerabilities.Vulnerability) ListResponseBody

NewListResponseBody builds the HTTP response body from the result of the "list" endpoint of the "vulnerabilities" service.

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 Server

type Server struct {
	Mounts []*MountPoint
	Find   http.Handler
	List   http.Handler
	Submit http.Handler
}

Server lists the vulnerabilities service endpoint HTTP handlers.

func New

func New(
	e *vulnerabilities.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 vulnerabilities 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 SubmitNoMatchResponseBody

type SubmitNoMatchResponseBody string

SubmitNoMatchResponseBody is the type of the "vulnerabilities" service "submit" endpoint HTTP response body for the "no_match" error.

func NewSubmitNoMatchResponseBody

func NewSubmitNoMatchResponseBody(res vulnerabilities.NoMatch) SubmitNoMatchResponseBody

NewSubmitNoMatchResponseBody builds the HTTP response body from the result of the "submit" endpoint of the "vulnerabilities" service.

type SubmitRequestBody

type SubmitRequestBody struct {
	// Title of the vulnerability
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// Description of the vulnerability
	Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
	// If the vulnerability is exploitable
	Exploitable *bool `form:"exploitable,omitempty" json:"exploitable,omitempty" xml:"exploitable,omitempty"`
	// Severity score of the vulnerability
	CvssScore *float32 `form:"cvss_score,omitempty" json:"cvss_score,omitempty" xml:"cvss_score,omitempty"`
	// If the vulnerability is patchable
	IsPatchable *bool `form:"is_patchable,omitempty" json:"is_patchable,omitempty" xml:"is_patchable,omitempty"`
	// If the vulnerability is upgradeable
	IsUpgradeable *bool `form:"is_upgradeable,omitempty" json:"is_upgradeable,omitempty" xml:"is_upgradeable,omitempty"`
}

SubmitRequestBody is the type of the "vulnerabilities" service "submit" endpoint HTTP request body.

type VulnerabilityResponse

type VulnerabilityResponse struct {
	// Unique ID of the vulnerability
	ID uint64 `form:"id" json:"id" xml:"id"`
	// Title of the vulnerability
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// Description of the vulnerability
	Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
	// If the vulnerability is exploitable
	Exploitable *bool `form:"exploitable,omitempty" json:"exploitable,omitempty" xml:"exploitable,omitempty"`
	// Severity score of the vulnerability
	CvssScore *float32 `form:"cvss_score,omitempty" json:"cvss_score,omitempty" xml:"cvss_score,omitempty"`
	// If the vulnerability is patchable
	IsPatchable *bool `form:"is_patchable,omitempty" json:"is_patchable,omitempty" xml:"is_patchable,omitempty"`
	// If the vulnerability is upgradeable
	IsUpgradeable *bool `form:"is_upgradeable,omitempty" json:"is_upgradeable,omitempty" xml:"is_upgradeable,omitempty"`
}

VulnerabilityResponse 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