infosight

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Status  *Status      `json:"status,omitempty"`
	Request *RequestInfo `json:"request,omitempty"`

	Data []interface{} `json:"data,omitempty"`
}

APIResponse returned on success

type BearerAuthTransport

type BearerAuthTransport struct {
	// contains filtered or unexported fields
}

BearerAuthTransport wraps a RoundTripper. It capitalized bearer token authorization headers.

func (*BearerAuthTransport) RoundTrip

func (t *BearerAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip satisfies the RoundTripper interface. It replaces authorization headers of scheme `BearerToken` by changing it to `Bearer` (as per OAuth 2.0 spec).

type Client

type Client struct {
	Server string

	Wellness *Wellness
	// contains filtered or unexported fields
}

Client wraps the api for you

func NewClient

func NewClient(baseURL string, opts ...ClientOption) (*Client, error)

NewClient returns a new wazuh API client

func NewClientFromEnvironment

func NewClientFromEnvironment(opts ...ClientOption) (*Client, error)

NewClientFromEnvironment creates a new client from default environment variables

func (*Client) Debugf

func (c *Client) Debugf(format string, v ...interface{})

Debugf logs debug info

func (*Client) Errorf

func (c *Client) Errorf(format string, v ...interface{})

Errorf logs errors

func (*Client) Tracef

func (c *Client) Tracef(format string, v ...interface{})

Tracef logs trace info

func (*Client) Warnf

func (c *Client) Warnf(format string, v ...interface{})

Warnf logs warnings

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithContext

func WithContext(ctx context.Context) ClientOption

WithContext specifies the credentials for

func WithLogin

func WithLogin(user string, password string) ClientOption

WithLogin specifies the credentials for

func WithTrace

func WithTrace(trace bool) ClientOption

WithTrace write all requests to the log

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

WithUserAgent specify a user agent string to identify the client

type Fault

type Fault struct {
	FaultString string       `json:"faultstring,omitempty"`
	Detail      *FaultDetail `json:"detail,omitempty"`
}

Fault returned if something went wrong

type FaultDetail

type FaultDetail struct {
	ErrorCode string `json:"errorcode,omitempty"`
}

FaultDetail detailed fault information

type FaultResponse

type FaultResponse struct {
	Status     string
	StatusCode int
	Fault      *Fault `json:"fault,omitempty"`
}

FaultResponse is returned by InfoSight

func NewFaultResponse

func NewFaultResponse(r *http.Response) (*FaultResponse, error)

NewFaultResponse create a new NewFaultResponse from an http response

func (*FaultResponse) Error

func (e *FaultResponse) Error() string

type FilterInfo

type FilterInfo struct {
	Query map[string]string `json:"query,omitempty"`
}

FilterInfo filter details

type HTTPRequestDoer

type HTTPRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPRequestDoer performs HTTP requests.

The standard http.Client implements this interface.

type Order

type Order []string

type PagingInfo

type PagingInfo struct {
	Skip  int `json:"skip,omitempty"`
	Limit int `json:"limit,omitempty"`
}

PagingInfo request details

type RequestInfo

type RequestInfo struct {
	Paging *PagingInfo `json:"paging,omitempty"`
	Filter *FilterInfo `json:"filter,omitempty"`
	Sort   *Sorting    `json:"sort,omitempty"`
}

RequestInfo request details

type Sorting

type Sorting []Order

type Status

type Status struct {
	Message string `json:"message,omitempty"`
}

Status result status

type Wellness

type Wellness struct {
	*Client

	Version string
}

func NewWellness

func NewWellness(client *Client) *Wellness

func (*Wellness) GetIssues

func (w *Wellness) GetIssues() (interface{}, error)

func (*Wellness) GetObjectSet

func (w *Wellness) GetObjectSet(objectSet string) (interface{}, error)

GetObjectSet fetches a list of objects url.Values

Jump to

Keyboard shortcuts

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