Documentation ¶
Index ¶
- type Client
- func (c *Client) Auth() error
- func (c *Client) Close()
- func (c *Client) Get(path string) ([]byte, error)
- func (c *Client) GetAndParse(path string, v interface{}) error
- func (c *Client) SendAndParse(path, method string, res interface{}, body io.Reader) error
- func (c *Client) SendRequest(path, method string, body io.Reader) ([]byte, error)
- type ClientOption
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client encapsulates communication with the oVirt REST API
func NewClient ¶
func NewClient(url, username, password string, opts ...ClientOption) (*Client, error)
NewClient returns a new client
func (*Client) GetAndParse ¶
GetAndParse retrieves XML data from the API and unmarshals it
func (*Client) SendAndParse ¶
SendAndParse sends a request to the API and unmarshalls the response
type ClientOption ¶
type ClientOption func(*Client)
ClientOption applies options to Client
func WithInsecure ¶
func WithInsecure() ClientOption
WithInsecure disables TLS certificate validation
func WithLogger ¶
func WithLogger(l Logger) ClientOption
WithLogger sets the logger for the API client
type Logger ¶
type Logger interface { // Info logs message with info severity Infof(format string, args ...interface{}) // Debug logs message with debug severity Debugf(format string, args ...interface{}) // Error logs message with error severity Errorf(format string, args ...interface{}) }
Logger logs messages
Click to show internal directories.
Click to hide internal directories.