Documentation ¶
Overview ¶
Package xiqrestclient interfaces with the REST API of ExtremeCloud IQ.
Index ¶
- func SanitizeEndpoint(endpoint *string)
- func SetRequestHeaders(client *RESTClient, req *http.Request, payload *[]byte)
- type RESTClient
- func (c *RESTClient) GetRequest(endpoint string) (*http.Request, error)
- func (c *RESTClient) PerformRequest(req *http.Request) (*http.Response, error)
- func (c *RESTClient) SetAuth(accessToken string, clientID string, clientSecret string, redirectURI string)
- func (c *RESTClient) SetTimeout(seconds uint) error
- func (c *RESTClient) SetUserAgent(ua string)
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 ¶
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.