import "github.com/brittonhayes/citadel/gen/vulnerabilities"
- Constants
- Variables
- func NewFindEndpoint(s Service) endpoint.Endpoint
- func NewListEndpoint(s Service) endpoint.Endpoint
- func NewSubmitEndpoint(s Service) endpoint.Endpoint
- type Client
- func NewClient(find, list, submit endpoint.Endpoint) *Client
- func (c *Client) Find(ctx context.Context, p *FindPayload) (res *Vulnerability, err error)
- func (c *Client) List(ctx context.Context, p *LimitPayload) (res []*Vulnerability, err error)
- func (c *Client) Submit(ctx context.Context, p *SubmitPayload) (err error)
- type Endpoints
- type FindPayload
- type LimitPayload
- type NoMatch
- type Service
- type SubmitPayload
- type Vulnerability
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.
const ServiceName = "vulnerabilities"
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.
var MethodNames = [3]string{"find", "list", "submit"}
func NewFindEndpoint(s Service) endpoint.Endpoint
NewFindEndpoint returns an endpoint function that calls the method "find" of service "vulnerabilities".
func NewListEndpoint(s Service) endpoint.Endpoint
NewListEndpoint returns an endpoint function that calls the method "list" of service "vulnerabilities".
func NewSubmitEndpoint(s Service) endpoint.Endpoint
NewSubmitEndpoint returns an endpoint function that calls the method "submit" of service "vulnerabilities".
Client is the "vulnerabilities" service client.
type Client struct {
FindEndpoint endpoint.Endpoint
ListEndpoint endpoint.Endpoint
SubmitEndpoint endpoint.Endpoint
}
func NewClient(find, list, submit endpoint.Endpoint) *Client
NewClient initializes a "vulnerabilities" service client given the endpoints.
func (c *Client) Find(ctx context.Context, p *FindPayload) (res *Vulnerability, err error)
Find calls the "find" endpoint of the "vulnerabilities" service. Find may return the following errors: - "no_match" (type NoMatch) - error: internal error
func (c *Client) List(ctx context.Context, p *LimitPayload) (res []*Vulnerability, err error)
List calls the "list" endpoint of the "vulnerabilities" service.
func (c *Client) Submit(ctx context.Context, p *SubmitPayload) (err error)
Submit calls the "submit" endpoint of the "vulnerabilities" service. Submit may return the following errors: - "no_match" (type NoMatch) - error: internal error
Endpoints wraps the "vulnerabilities" service endpoints.
type Endpoints struct {
Find endpoint.Endpoint
List endpoint.Endpoint
Submit endpoint.Endpoint
}
func NewEndpoints(s Service) *Endpoints
NewEndpoints wraps the methods of the "vulnerabilities" service with endpoints.
func (e *Endpoints) Use(m func(endpoint.Endpoint) endpoint.Endpoint)
Use applies the given middleware to all the "vulnerabilities" service endpoints.
FindPayload is the payload type of the vulnerabilities service find method.
type FindPayload struct {
// Unique ID of the vulnerability
ID uint64
}
LimitPayload is the payload type of the vulnerabilities service list method.
type LimitPayload struct {
// Limit the number of results
Limit *int32
}
No vulnerability matched given criteria
type NoMatch string
func (e NoMatch) Error() string
Error returns an error description.
func (e NoMatch) ErrorName() string
ErrorName returns "no_match".
The vulnerability service handles the creation and querying of security vulnerabilities.
type Service interface {
// Find implements find.
Find(context.Context, *FindPayload) (res *Vulnerability, err error)
// List all of the vulnerabilities
List(context.Context, *LimitPayload) (res []*Vulnerability, err error)
// Submit implements submit.
Submit(context.Context, *SubmitPayload) (err error)
}
SubmitPayload is the payload type of the vulnerabilities service submit method.
type SubmitPayload struct {
// Title of the vulnerability
Title *string
// Description of the vulnerability
Description *string
// If the vulnerability is exploitable
Exploitable *bool
// Severity score of the vulnerability
CvssScore *float32
// If the vulnerability is patchable
IsPatchable *bool
// If the vulnerability is upgradeable
IsUpgradeable *bool
}
Vulnerability is the result type of the vulnerabilities service find method.
type Vulnerability struct {
// Unique ID of the vulnerability
ID uint64
// Title of the vulnerability
Title *string
// Description of the vulnerability
Description *string
// If the vulnerability is exploitable
Exploitable *bool
// Severity score of the vulnerability
CvssScore *float32
// If the vulnerability is patchable
IsPatchable *bool
// If the vulnerability is upgradeable
IsUpgradeable *bool
}
Generated by gomarkdoc