api

package
v0.0.0-...-31037b8 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: MIT Imports: 9 Imported by: 3

Documentation

Index

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) Auth

func (c *Client) Auth() error

Auth establishes a SSO session with oVirt API

func (*Client) Close

func (c *Client) Close()

Close terminates the SSO session with the API

func (*Client) Get

func (c *Client) Get(path string) ([]byte, error)

Get retrieves XML data from the API and returns it

func (*Client) GetAndParse

func (c *Client) GetAndParse(path string, v interface{}) error

GetAndParse retrieves XML data from the API and unmarshals it

func (*Client) SendAndParse

func (c *Client) SendAndParse(path, method string, res interface{}, body io.Reader) error

SendAndParse sends a request to the API and unmarshalls the response

func (*Client) SendRequest

func (c *Client) SendRequest(path, method string, body io.Reader) ([]byte, error)

SendRequest sends a request to the API

type ClientOption

type ClientOption func(*Client)

ClientOption applies options to Client

func WithDebug

func WithDebug() ClientOption

WithDebug enables debug mode

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

Jump to

Keyboard shortcuts

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