api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout = 5

Variables

This section is empty.

Functions

func NewLoggingHTTPClient

func NewLoggingHTTPClient() *http.Client

Prepare custom client that using a logging transport.

Types

type AgentRealtimeInfo

type AgentRealtimeInfo struct {
	AccountID         string `json:"accountId"`
	AccountName       string `json:"accountName"`
	SiteID            string `json:"siteId"`
	SiteName          string `json:"siteName"`
	GroupID           string `json:"groupId"`
	GroupName         string `json:"groupName"`
	AgentComputerName string `json:"agentComputerName"`
	AgentDomain       string `json:"AgentDomain"`
}

type Client

type Client struct {
	AuthConfig    *clientcredentials.Config
	HTTPClient    *http.Client
	ManagementURL string
	AuthToken     string
}

func NewClient

func NewClient(url, token string) (c *Client)

func (*Client) CheckViewer

func (c *Client) CheckViewer() (ok bool, err error)

func (*Client) Do

func (c *Client) Do(req *http.Request) (res *http.Response, err error)

func (*Client) GetJSONItems

func (c *Client) GetJSONItems(request *http.Request) (items []json.RawMessage, err error)

func (*Client) GetJSONResponse

func (c *Client) GetJSONResponse(req *http.Request) (data *ResponseBody, err error)

func (*Client) GetSites

func (c *Client) GetSites(values url.Values) (data []*Site, err error)

func (*Client) GetThreats

func (c *Client) GetThreats(values url.Values) (threats []*Threat, err error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, url string, body io.Reader) (req *http.Request, err error)

type JSONError

type JSONError struct {
	Code   int    `json:"code"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

type JSONErrorObject

type JSONErrorObject struct {
	Errors []JSONError `json:"errors"`
}

type LoggingRoundTripper

type LoggingRoundTripper struct {
	Base http.RoundTripper
}

func (LoggingRoundTripper) RoundTrip

func (r LoggingRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error)

type Pagination

type Pagination struct {
	NextCursor string `json:"nextCursor"`
	TotalItems int    `json:"totalItems"`
}

type ResponseBody

type ResponseBody struct {
	Data       json.RawMessage `json:"data"`
	Pagination *Pagination     `json:"pagination"`
	// Seems to be only used with errors.
	Name string `json:"name"`
	// Seems to be only used with errors.
	Message string           `json:"message"`
	Error   *JSONErrorObject `json:"error"`
	Errors  []JSONError      `json:"errors"`
}

type Site

type Site struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	SiteType string `json:"siteType"`
}

type SiteResult

type SiteResult struct {
	// Only license info
	AllSites json.RawMessage `json:"allSites"`
	Sites    []*Site
}

type SuccessMessage

type SuccessMessage struct {
	Success bool `json:"success"`
}

type Threat

type Threat struct {
	AgentRealtimeInfo AgentRealtimeInfo `json:"agentRealtimeInfo"`
	ThreatInfo        ThreatInfo        `json:"threatInfo"`
}

type ThreatInfo

type ThreatInfo struct {
	ThreatName                  string    `json:"threatName"`
	Classification              string    `json:"classification"`
	ClassificationSource        string    `json:"classificationSource"`
	CreatedAt                   time.Time `json:"createdAt"`
	Engines                     []string  `json:"engines"`
	AnalystVerdict              string    `json:"analystVerdict"`
	AnalystVerdictDescription   string    `json:"analystVerdictDescription"`
	IncidentStatus              string    `json:"incidentStatus"`
	IncidentStatusDescription   string    `json:"incidentStatusDescription"`
	MitigationStatus            string    `json:"mitigationStatus"`
	MitigationStatusDescription string    `json:"mitigationStatusDescription"`
}

type UserInfo

type UserInfo struct {
	ID       string            `json:"id"`
	IDType   string            `json:"idType"`
	APIHosts map[string]string `json:"apiHosts"`
}

Jump to

Keyboard shortcuts

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