xiqrestclient

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: Zlib Imports: 4 Imported by: 0

README

Go module xiqrestlient

xiqrestclient is a Go module that interfaces with the REST API of ExtremeCloud IQ (XIQ).

Work in progress, not ready for production!

Source

The original project is hosted at GitLab, with a copy over at GitHub for the folks over there.

Documentation

Overview

Package xiqrestclient interfaces with the REST API of ExtremeCloud IQ.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeEndpoint

func SanitizeEndpoint(endpoint *string)

SanitizeEndpoint prepares the provided API endpoint for concatenation.

func SetRequestHeaders

func SetRequestHeaders(client *RESTClient, req *http.Request, payload *[]byte)

SetRequestHeaders sets the usual headers required for requests to XIQ.

Types

type RESTClient

type RESTClient struct {
	HTTPHost        string
	HTTPPort        uint
	HTTPTimeout     uint
	XIQOwnerID      string
	XIQAccessToken  string
	XIQClientID     string
	XIQClientSecret string
	XIQRedirectURI  string
	UserAgent       string
	// contains filtered or unexported fields
}

RESTClient encapsulates the actual HTTP client that communicates with XIQ. Use New() to obtain an usable instance. All fields should be treated as read-only; functions are provided where changes shall be possible.

func New

func New(host string, ownerID string) RESTClient

New is used to create an usable instance of RESTClient. By default a new instance will use HTTPS to port 443 with strict certificate checking. The HTTP timeout is set to 5 seconds. Authentication must be set manually before trying to send a query to XIQ.

func (*RESTClient) GetRequest

func (c *RESTClient) GetRequest(endpoint string) (*http.Request, error)

GetRequest returns a prepared HTTP GET request instance.

func (*RESTClient) PerformRequest

func (c *RESTClient) PerformRequest(req *http.Request) (*http.Response, error)

PerformRequest sends a request to XIQ and returns the result.

func (*RESTClient) SetAuth

func (c *RESTClient) SetAuth(accessToken string, clientID string, clientSecret string, redirectURI string)

SetAuth sets the authentication credentials.

func (*RESTClient) SetTimeout

func (c *RESTClient) SetTimeout(seconds uint) error

SetTimeout sets the HTTP timeout in seconds for the RESTClient instance.

func (*RESTClient) SetUserAgent

func (c *RESTClient) SetUserAgent(ua string)

SetUserAgent sets the User-Agent HTTP header.

Jump to

Keyboard shortcuts

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