Documentation
¶
Index ¶
- func BuildTLSConfig(cfg *config.Config) (*tls.Config, error)
- type APIError
- type AuthError
- type Client
- func (c *Client) Auth() *authManager
- func (c *Client) BaseURL() string
- func (c *Client) Delete(path string, params *QueryParams) (*Response, error)
- func (c *Client) Get(path string, params *QueryParams) (*Response, error)
- func (c *Client) HTTPClient() *http.Client
- func (c *Client) Post(path string, body interface{}) (*Response, error)
- func (c *Client) Put(path string, body interface{}) (*Response, error)
- type QueryParams
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthError ¶
type AuthError struct {
Message string
}
AuthError represents an authentication failure.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps an http.Client with Wazuh-specific auth and configuration.
func (*Client) Auth ¶
func (c *Client) Auth() *authManager
Auth returns the authentication manager for this client.
func (*Client) Delete ¶
func (c *Client) Delete(path string, params *QueryParams) (*Response, error)
Delete performs an authenticated DELETE request.
func (*Client) Get ¶
func (c *Client) Get(path string, params *QueryParams) (*Response, error)
Get performs an authenticated GET request and returns the parsed response.
func (*Client) HTTPClient ¶
HTTPClient returns the underlying http.Client (for testing).
type QueryParams ¶
type QueryParams struct {
Offset int
Limit int
Sort string
Search string
Query string // WQL
Select []string
Filters map[string]string
}
QueryParams contains common Wazuh API query parameters.
type Response ¶
type Response struct {
// Data holds the actual response payload.
Data json.RawMessage `json:"data"`
// Error is the Wazuh API error code (0 = success).
Error int `json:"error"`
// Message is set when Error != 0.
Message string `json:"message"`
// Pagination metadata (populated from data.total_affected_items etc.)
TotalAffectedItems int `json:"-"`
AffectedItems json.RawMessage `json:"-"`
FailedItems json.RawMessage `json:"-"`
// Raw HTTP status code
HTTPStatus int `json:"-"`
// RawBody is the full unparsed response (for --output raw)
RawBody []byte `json:"-"`
}
Response represents the parsed Wazuh API response envelope.
func (*Response) Items ¶
func (r *Response) Items() json.RawMessage
Items returns the affected_items array from the data envelope. Returns raw data if affected_items is not present.
Click to show internal directories.
Click to hide internal directories.