-
Notifications
You must be signed in to change notification settings - Fork 12
/
client.go
29 lines (25 loc) · 722 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Package sumologic is a wrapper for the Sumo Logic API.
package sumologic
import (
"errors"
"net/url"
)
// Client communicates with the Sumo Logic API.
type Client struct {
AuthToken string
EndpointURL *url.URL
}
// ErrClientAuthenticationError is returned for authentication errors with the API.
var ErrClientAuthenticationError = errors.New("Authentication Error with Sumo Logic")
// NewClient returns a new sumologic.Client for accessing the Sumo Logic API.
func NewClient(authToken, defaultEndpointURL string) (*Client, error) {
s := &Client{
AuthToken: authToken,
}
endpointURL, err := url.Parse(defaultEndpointURL)
if err != nil {
return nil, err
}
s.EndpointURL = endpointURL
return s, nil
}