-
Notifications
You must be signed in to change notification settings - Fork 4
/
client.go
101 lines (88 loc) · 2.58 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package goqradar
import (
"net/http"
)
const (
defaultVersion = "12.0"
)
//------------------------------------------------------------------------------
// Structure
//------------------------------------------------------------------------------
// Client is a client for QRadar REST API.
type Client struct {
client *http.Client
// BaseURL is the base URL for API requests.
BaseURL string
// Token is the security token.
Token string
// Version is the API version.
Version string
// Endpoints
Access Access
Analytics Analytics
Ariel Ariel
AssetModel AssetModel
Auth Auth
BackupAndRestore BackupAndRestore
BandwithManager BandwithManager
Config Config
DataClassification DataClassification
DisasterRecovery DisasterRecovery
DynamicSearch DynamicSearch
Forensics Forensics
GUIAppFramework GUIAppFramework
Health Health
HealthData HealthData
Help Help
Qni Qni
Qrm Qrm
Qvm Qvm
ReferenceData ReferenceData
Scanner Scanner
Services Services
SIEM SIEM
StagedConfig StagedConfig
System System
}
//------------------------------------------------------------------------------
// Factory
//------------------------------------------------------------------------------
// NewClient returns a new QRadar API client.
func NewClient(httpClient *http.Client, baseURL, token string) *Client {
if httpClient == nil {
httpClient = http.DefaultClient
}
// Create the client
c := &Client{
client: httpClient,
BaseURL: baseURL,
Token: token,
Version: defaultVersion,
}
// Add the endpoints
c.Access = &Endpoint{client: c}
c.Analytics = &Endpoint{client: c}
c.Ariel = &Endpoint{client: c}
c.Auth = &Endpoint{client: c}
c.AssetModel = &Endpoint{client: c}
c.BackupAndRestore = &Endpoint{client: c}
c.BandwithManager = &Endpoint{client: c}
c.Config = &Endpoint{client: c}
c.DataClassification = &Endpoint{client: c}
c.DisasterRecovery = &Endpoint{client: c}
c.DynamicSearch = &Endpoint{client: c}
c.Forensics = &Endpoint{client: c}
c.GUIAppFramework = &Endpoint{client: c}
c.HealthData = &Endpoint{client: c}
c.Help = &Endpoint{client: c}
c.Qni = &Endpoint{client: c}
c.Qrm = &Endpoint{client: c}
c.Qvm = &Endpoint{client: c}
c.ReferenceData = &Endpoint{client: c}
c.Scanner = &Endpoint{client: c}
c.Services = &Endpoint{client: c}
c.SIEM = &Endpoint{client: c}
c.StagedConfig = &Endpoint{client: c}
c.System = &Endpoint{client: c}
return c
}