Documentation ¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func NewCreateScanRequest(server string, body CreateScanJSONRequestBody) (*http.Request, error)
- func NewCreateScanRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewHealthzRequest(server string) (*http.Request, error)
- func NewListScansRequest(server string, params *ListScansParams) (*http.Request, error)
- func NewRetrieveScanRequest(server string, id string) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type ChiServerOptions
- type Client
- func (c *Client) CreateScan(ctx context.Context, body CreateScanJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) CreateScanWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) Healthz(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListScans(ctx context.Context, params *ListScansParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) RetrieveScan(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) CreateScanWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*CreateScanResponse, error)
- func (c *ClientWithResponses) CreateScanWithResponse(ctx context.Context, body CreateScanJSONRequestBody, ...) (*CreateScanResponse, error)
- func (c *ClientWithResponses) HealthzWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthzResponse, error)
- func (c *ClientWithResponses) ListScansWithResponse(ctx context.Context, params *ListScansParams, reqEditors ...RequestEditorFn) (*ListScansResponse, error)
- func (c *ClientWithResponses) RetrieveScanWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RetrieveScanResponse, error)
- type ClientWithResponsesInterface
- type CreateScanJSONRequestBody
- type CreateScanResponse
- type Error
- type Healthz
- type HealthzResponse
- type HttpRequestDoer
- type InvalidParamFormatError
- type ListScansParams
- type ListScansResponse
- type MiddlewareFunc
- type NewScan
- type NewScanType
- type PageParam
- type PageSizeParam
- type PageSortParam
- type RequestEditorFn
- type RequiredHeaderError
- type RequiredParamError
- type RetrieveScanResponse
- type Scan
- type ScanBody
- type ScanData
- type ScanHostsArray
- type ScanStatus
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateScan(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) Healthz(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListScans(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) RetrieveScan(w http.ResponseWriter, r *http.Request)
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshallingParamError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func NewCreateScanRequest ¶
func NewCreateScanRequest(server string, body CreateScanJSONRequestBody) (*http.Request, error)
NewCreateScanRequest calls the generic CreateScan builder with application/json body
func NewCreateScanRequestWithBody ¶
func NewCreateScanRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateScanRequestWithBody generates requests for CreateScan with any type of body
func NewHealthzRequest ¶
NewHealthzRequest generates requests for Healthz
func NewListScansRequest ¶
func NewListScansRequest(server string, params *ListScansParams) (*http.Request, error)
NewListScansRequest generates requests for ListScans
func NewRetrieveScanRequest ¶
NewRetrieveScanRequest generates requests for RetrieveScan
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) CreateScan ¶
func (c *Client) CreateScan(ctx context.Context, body CreateScanJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) CreateScanWithBody ¶
func (*Client) ListScans ¶
func (c *Client) ListScans(ctx context.Context, params *ListScansParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) RetrieveScan ¶
type ClientInterface ¶
type ClientInterface interface { // Healthz request Healthz(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // ListScans request ListScans(ctx context.Context, params *ListScansParams, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateScan request with any body CreateScanWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateScan(ctx context.Context, body CreateScanJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // RetrieveScan request RetrieveScan(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) CreateScanWithBodyWithResponse ¶
func (c *ClientWithResponses) CreateScanWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateScanResponse, error)
CreateScanWithBodyWithResponse request with arbitrary body returning *CreateScanResponse
func (*ClientWithResponses) CreateScanWithResponse ¶
func (c *ClientWithResponses) CreateScanWithResponse(ctx context.Context, body CreateScanJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateScanResponse, error)
func (*ClientWithResponses) HealthzWithResponse ¶
func (c *ClientWithResponses) HealthzWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthzResponse, error)
HealthzWithResponse request returning *HealthzResponse
func (*ClientWithResponses) ListScansWithResponse ¶
func (c *ClientWithResponses) ListScansWithResponse(ctx context.Context, params *ListScansParams, reqEditors ...RequestEditorFn) (*ListScansResponse, error)
ListScansWithResponse request returning *ListScansResponse
func (*ClientWithResponses) RetrieveScanWithResponse ¶
func (c *ClientWithResponses) RetrieveScanWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RetrieveScanResponse, error)
RetrieveScanWithResponse request returning *RetrieveScanResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // Healthz request HealthzWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthzResponse, error) // ListScans request ListScansWithResponse(ctx context.Context, params *ListScansParams, reqEditors ...RequestEditorFn) (*ListScansResponse, error) // CreateScan request with any body CreateScanWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateScanResponse, error) CreateScanWithResponse(ctx context.Context, body CreateScanJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateScanResponse, error) // RetrieveScan request RetrieveScanWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RetrieveScanResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CreateScanJSONRequestBody ¶
type CreateScanJSONRequestBody = NewScan
CreateScanJSONRequestBody defines body for CreateScan for application/json ContentType.
type CreateScanResponse ¶
type CreateScanResponse struct { Body []byte HTTPResponse *http.Response JSON201 *NewScan JSONDefault *Error }
func ParseCreateScanResponse ¶
func ParseCreateScanResponse(rsp *http.Response) (*CreateScanResponse, error)
ParseCreateScanResponse parses an HTTP response from a CreateScanWithResponse call
func (CreateScanResponse) Status ¶
func (r CreateScanResponse) Status() string
Status returns HTTPResponse.Status
func (CreateScanResponse) StatusCode ¶
func (r CreateScanResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Error ¶
type Error struct { Body *map[string]interface{} `json:"body,omitempty"` // Code Error code Code int32 `json:"code"` // Status Error message Status string `json:"status"` }
Error defines model for Error.
type HealthzResponse ¶
func ParseHealthzResponse ¶
func ParseHealthzResponse(rsp *http.Response) (*HealthzResponse, error)
ParseHealthzResponse parses an HTTP response from a HealthzWithResponse call
func (HealthzResponse) Status ¶
func (r HealthzResponse) Status() string
Status returns HTTPResponse.Status
func (HealthzResponse) StatusCode ¶
func (r HealthzResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ListScansParams ¶
type ListScansParams struct { // Page page number for pagination Page *PageParam `form:"page,omitempty" json:"page,omitempty"` // PageSize page size for pagination. default is 20 PageSize *PageSizeParam `form:"page_size,omitempty" json:"page_size,omitempty"` // Sort sort results by 'asc' or 'desc'. default is 'asc' Sort *PageSortParam `form:"sort,omitempty" json:"sort,omitempty"` }
ListScansParams defines parameters for ListScans.
type ListScansResponse ¶
func ParseListScansResponse ¶
func ParseListScansResponse(rsp *http.Response) (*ListScansResponse, error)
ParseListScansResponse parses an HTTP response from a ListScansWithResponse call
func (ListScansResponse) Status ¶
func (r ListScansResponse) Status() string
Status returns HTTPResponse.Status
func (ListScansResponse) StatusCode ¶
func (r ListScansResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type NewScan ¶
type NewScan struct { // Description user entered description for easier identification Description string `json:"description"` Hosts []string `json:"hosts"` // Ports ports to scan. must be supplied in an array Ports []string `json:"ports"` // Timeout time in seconds Timeout *int `json:"timeout,omitempty"` // Type type of scan. must be one of the allowed types Type NewScanType `json:"type"` }
NewScan Request body for creating a new scan.
type NewScanType ¶
type NewScanType string
NewScanType type of scan. must be one of the allowed types
const ( PortScan NewScanType = "port_scan" ServiceDiscovery NewScanType = "service_discovery" ServiceDiscoveryDefaultScripts NewScanType = "service_discovery_default_scripts" )
Defines values for NewScanType.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type RetrieveScanResponse ¶
type RetrieveScanResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Scan JSONDefault *Error }
func ParseRetrieveScanResponse ¶
func ParseRetrieveScanResponse(rsp *http.Response) (*RetrieveScanResponse, error)
ParseRetrieveScanResponse parses an HTTP response from a RetrieveScanWithResponse call
func (RetrieveScanResponse) Status ¶
func (r RetrieveScanResponse) Status() string
Status returns HTTPResponse.Status
func (RetrieveScanResponse) StatusCode ¶
func (r RetrieveScanResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Scan ¶
type Scan struct { // Data The entire response object for a single scan. Data ScanData `json:"data"` Description string `json:"description"` HostsArray []string `json:"hosts_array"` Id string `json:"id"` Ports []string `json:"ports"` ScanType string `json:"scan_type"` Status ScanStatus `json:"status"` Summary string `json:"summary"` // Timeout time in seconds Timeout *int `json:"timeout,omitempty"` }
Scan Successful scans contain information about the scan, and each host.
Failed scans will be have empty values in the Scan response.
The `data` object is the result of the Scan. `host` information is provided as an array of `hosts`.
Each `hosts` object contains all the information about the host, and is where the majority of your time should be spent when digesting the response data.
Empty fields are not omitted but will return their empty values. This is done to prevent errors due missing indexes during parsing.
type ScanData ¶
type ScanData struct { // Args nmap command equivalent Args *string `json:"args,omitempty"` Hosts *[]ScanHostsArray `json:"hosts,omitempty"` Runstats *struct { Finished *struct { Elapsed *float32 `json:"elapsed,omitempty"` ErrorMsg *string `json:"error_msg,omitempty"` Exit *string `json:"exit,omitempty"` Summary *string `json:"summary,omitempty"` Time *int64 `json:"time,omitempty"` TimeStr *string `json:"time_str,omitempty"` } `json:"finished,omitempty"` Hosts *struct { Down *int `json:"down,omitempty"` Total *int `json:"total,omitempty"` Up *int `json:"up,omitempty"` } `json:"hosts,omitempty"` } `json:"runstats,omitempty"` ScanInfo *struct { NumServices *int32 `json:"num_services,omitempty"` Protocol *string `json:"protocol,omitempty"` ScanFlags *string `json:"scan_flags,omitempty"` Services *string `json:"services,omitempty"` Type *string `json:"type,omitempty"` } `json:"scan_info,omitempty"` Scanner *string `json:"scanner,omitempty"` Start *float32 `json:"start,omitempty"` // StartStr scan start time StartStr *string `json:"start_str,omitempty"` Verbose *struct { Level *int `json:"level,omitempty"` } `json:"verbose,omitempty"` // Version nmap version on server Version *string `json:"version,omitempty"` }
ScanData The entire response object for a single scan.
type ScanHostsArray ¶
type ScanHostsArray struct { Addresses *[]struct { Addr *string `json:"addr,omitempty"` AddrType *string `json:"addr_type,omitempty"` Vendor *string `json:"vendor,omitempty"` } `json:"addresses,omitempty"` Comment *string `json:"comment,omitempty"` Distance *struct { Value *int32 `json:"value,omitempty"` } `json:"distance,omitempty"` EndTime *int64 `json:"end_time,omitempty"` ExtraPorts *[]struct { Count *int32 `json:"count,omitempty"` Reasons *[]struct { Count *int32 `json:"count,omitempty"` Reason *string `json:"reason,omitempty"` } `json:"reasons,omitempty"` State *string `json:"state,omitempty"` } `json:"extra_ports,omitempty"` HostScripts *string `json:"host_scripts,omitempty"` Hostnames *[]struct { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` } `json:"hostnames,omitempty"` IpIdSequence *struct { Class *string `json:"class,omitempty"` Values *string `json:"values,omitempty"` } `json:"ip_id_sequence,omitempty"` Os *struct { OsFingerprints *string `json:"os_fingerprints,omitempty"` OsMatches *string `json:"os_matches,omitempty"` PortsUsed *string `json:"ports_used,omitempty"` } `json:"os,omitempty"` Ports *[]struct { Id *int32 `json:"id,omitempty"` Owner *struct { Name *string `json:"name,omitempty"` } `json:"owner,omitempty"` Protocol *string `json:"protocol,omitempty"` Scripts *[]struct { Id *string `json:"id,omitempty"` Output *string `json:"output,omitempty"` Tables *[]struct { Elements *[]struct { Key *string `json:"key,omitempty"` Value *string `json:"value,omitempty"` } `json:"elements,omitempty"` } `json:"tables,omitempty"` } `json:"scripts,omitempty"` Service *struct { Confidence *int32 `json:"confidence,omitempty"` Cpes *[]string `json:"cpes,omitempty"` DeviceType *string `json:"device_type,omitempty"` ExtraInfo *string `json:"extra_info,omitempty"` HighVersion *string `json:"high_version,omitempty"` Hostname *string `json:"hostname,omitempty"` LowVersion *string `json:"low_version,omitempty"` Method *string `json:"method,omitempty"` Name *string `json:"name,omitempty"` OsType *string `json:"os_type,omitempty"` Product *string `json:"product,omitempty"` Proto *string `json:"proto,omitempty"` RpcNum *string `json:"rpc_num,omitempty"` ServiceFp *string `json:"service_fp,omitempty"` Tunnel *string `json:"tunnel,omitempty"` Version *string `json:"version,omitempty"` } `json:"service,omitempty"` State *struct { Reason *string `json:"reason,omitempty"` ReasonIp *string `json:"reason_ip,omitempty"` ReasonTtl *int32 `json:"reason_ttl,omitempty"` State *string `json:"state,omitempty"` } `json:"state,omitempty"` } `json:"ports,omitempty"` StartTime *int64 `json:"start_time,omitempty"` Status *struct { Reason *string `json:"reason,omitempty"` ReasonTtl *int32 `json:"reason_ttl,omitempty"` State *string `json:"state,omitempty"` } `json:"status,omitempty"` TcpSequence *struct { Difficulty *string `json:"difficulty,omitempty"` Index *int32 `json:"index,omitempty"` Values *string `json:"values,omitempty"` } `json:"tcp_sequence,omitempty"` TcpTsSequence *struct { Class *string `json:"class,omitempty"` Values *string `json:"values,omitempty"` } `json:"tcp_ts_sequence,omitempty"` TimedOut *bool `json:"timed_out,omitempty"` Times *struct { Rttv *string `json:"rttv,omitempty"` Srtt *string `json:"srtt,omitempty"` To *string `json:"to,omitempty"` } `json:"times,omitempty"` Trace *struct { Hops *string `json:"hops,omitempty"` Port *int32 `json:"port,omitempty"` Proto *string `json:"proto,omitempty"` } `json:"trace,omitempty"` Uptime *struct { LastBoot *string `json:"last_boot,omitempty"` Seconds *int32 `json:"seconds,omitempty"` } `json:"uptime,omitempty"` }
ScanHostsArray The detailed response from a single host during the scan event. Each host will have their own object within the hosts array.
type ScanStatus ¶
type ScanStatus string
ScanStatus defines model for Scan.Status.
const ( Complete ScanStatus = "complete" Failed ScanStatus = "failed" InProgress ScanStatus = "in_progress" Scheduled ScanStatus = "scheduled" )
Defines values for ScanStatus.
type ServerInterface ¶
type ServerInterface interface { // Healthcheck // (GET /healthz) Healthz(w http.ResponseWriter, r *http.Request) // List Scans // (GET /scans) ListScans(w http.ResponseWriter, r *http.Request, params ListScansParams) // Create Scan // (POST /scans) CreateScan(w http.ResponseWriter, r *http.Request) // Retrieve Scan // (GET /scans/{id}) RetrieveScan(w http.ResponseWriter, r *http.Request, id string) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateScan ¶
func (siw *ServerInterfaceWrapper) CreateScan(w http.ResponseWriter, r *http.Request)
CreateScan operation middleware
func (*ServerInterfaceWrapper) Healthz ¶
func (siw *ServerInterfaceWrapper) Healthz(w http.ResponseWriter, r *http.Request)
Healthz operation middleware
func (*ServerInterfaceWrapper) ListScans ¶
func (siw *ServerInterfaceWrapper) ListScans(w http.ResponseWriter, r *http.Request)
ListScans operation middleware
func (*ServerInterfaceWrapper) RetrieveScan ¶
func (siw *ServerInterfaceWrapper) RetrieveScan(w http.ResponseWriter, r *http.Request)
RetrieveScan operation middleware
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshallingParamError ¶
func (*UnmarshallingParamError) Error ¶
func (e *UnmarshallingParamError) Error() string
func (*UnmarshallingParamError) Unwrap ¶
func (e *UnmarshallingParamError) Unwrap() error