Documentation ¶
Index ¶
- Constants
- Variables
- type CvpClient
- func (c *CvpClient) Connect(username string, password string) error
- func (c *CvpClient) Delete(url string, params *url.Values, data interface{}) ([]byte, error)
- func (c *CvpClient) Get(url string, params *url.Values) ([]byte, error)
- func (c *CvpClient) GetPort() int
- func (c *CvpClient) GetSessionID() string
- func (c *CvpClient) Post(url string, params *url.Values, data interface{}) ([]byte, error)
- func (c *CvpClient) SetConnectTimeout(timeout int) error
- func (c *CvpClient) SetCvaas(enable bool, tenant string) error
- func (c *CvpClient) SetDebug(enable bool) error
- func (c *CvpClient) SetHosts(host ...string) error
- func (c *CvpClient) SetOption(options ...Option) error
- func (c *CvpClient) SetPort(port int) error
- func (c *CvpClient) SetProtocol(proto string) error
- func (c *CvpClient) SetTransport(transport http.RoundTripper) error
- type HostIterator
- type Option
Constants ¶
const UNDEFPORT = -1
UNDEFPORT undefined port
Variables ¶
var ( // DefaultTimeOut connection timeout default DefaultTimeOut = time.Duration(60 * time.Second) // DefaultProtocol uses https for default connection DefaultProtocol = "https" // DefaultHosts set to local host ip DefaultHosts = []string{"127.0.0.1"} // NumRetryRequests specifies the number for retries to attempt NumRetryRequests = 3 )
Functions ¶
This section is empty.
Types ¶
type CvpClient ¶
type CvpClient struct { cvpapi.ClientInterface Hosts []string HostPool *HostIterator Port int Protocol string Timeout time.Duration Transport http.RoundTripper Client *resty.Client SessID string API *cvpapi.CvpRestAPI Debug bool IsCvaas bool Tenant string // contains filtered or unexported fields }
CvpClient represents a CVP client api connection
func NewCvpClient ¶
NewCvpClient creates a new CVP RESTful Client
func (*CvpClient) Delete ¶ added in v2.4.0
Delete implemented as part of cvprac api client interface
func (*CvpClient) GetSessionID ¶
GetSessionID returns the current Session ID
func (*CvpClient) SetConnectTimeout ¶
SetConnectTimeout sets the connection timeout associated with this connection
func (*CvpClient) SetProtocol ¶
SetProtocol sets the protocol (i.e. http or https) associated with this connection
func (*CvpClient) SetTransport ¶ added in v2.1.2
func (c *CvpClient) SetTransport(transport http.RoundTripper) error
SetTransport sets the connection Transport associated with this connection
type HostIterator ¶
type HostIterator struct {
// contains filtered or unexported fields
}
HostIterator implements an itorator for a list of hostnames/ips
func NewHostIterator ¶
func NewHostIterator(hosts []string) (*HostIterator, error)
NewHostIterator inits an itorator for host list
func (*HostIterator) Cycle ¶
func (h *HostIterator) Cycle() string
Cycle returns the next host in the list. If we've exceeded the length of the list, then circle back to the first.
func (*HostIterator) Next ¶
func (h *HostIterator) Next() bool
Next returns true if there is another element to iterate. False if we reach the end of the list
func (*HostIterator) Value ¶
func (h *HostIterator) Value() string
Value returns the value for the current entry
type Option ¶
Option is a Client Option...function that sets a value and returns
func ConnectTimeout ¶
ConnectTimeout sets the connection timeout for this Client
func Transport ¶ added in v2.1.2
func Transport(transport http.RoundTripper) Option
Transport sets the connection Transport for this Client