@@ -41,6 +41,7 @@ type Client struct {
41
41
sessionKey string
42
42
auth [2 ]string
43
43
host string
44
+ path string
44
45
httpClient * http.Client
45
46
userAgent string
46
47
urlEncoded bool
@@ -77,7 +78,7 @@ func getEnv(key, defaultValue string) string {
77
78
}
78
79
79
80
func (c * Client ) BuildSplunkURL (queryValues url.Values , urlPathParts ... string ) url.URL {
80
- buildPath := ""
81
+ buildPath := c . path
81
82
for _ , pathPart := range urlPathParts {
82
83
pathPart = strings .ReplaceAll (pathPart , " " , "+" ) // url parameters cannot have spaces
83
84
buildPath = path .Join (buildPath , pathPart )
@@ -277,13 +278,14 @@ func NewDefaultSplunkdClient() (*Client, error) {
277
278
}
278
279
279
280
// NewSplunkdClient creates a Client with custom values passed in
280
- func NewSplunkdClient (sessionKey string , auth [2 ]string , host string , httpClient * http.Client ) (* Client , error ) {
281
+ func NewSplunkdClient (sessionKey string , auth [2 ]string , host string , path string , httpClient * http.Client ) (* Client , error ) {
281
282
c , err := NewDefaultSplunkdClient ()
282
283
if err != nil {
283
284
return nil , err
284
285
}
285
286
c .auth = auth
286
287
c .host = host
288
+ c .path = path
287
289
c .sessionKey = sessionKey
288
290
if httpClient != nil {
289
291
c .httpClient = httpClient
@@ -292,13 +294,14 @@ func NewSplunkdClient(sessionKey string, auth [2]string, host string, httpClient
292
294
}
293
295
294
296
// NewSplunkdClient creates a Client with custom values passed in
295
- func NewSplunkdClientWithAuthToken (authToken string , auth [2 ]string , host string , httpClient * http.Client ) (* Client , error ) {
297
+ func NewSplunkdClientWithAuthToken (authToken string , auth [2 ]string , host string , path string , httpClient * http.Client ) (* Client , error ) {
296
298
c , err := NewDefaultSplunkdClient ()
297
299
if err != nil {
298
300
return nil , err
299
301
}
300
302
c .auth = auth
301
303
c .host = host
304
+ c .path = path
302
305
c .authToken = authToken
303
306
if httpClient != nil {
304
307
c .httpClient = httpClient
0 commit comments