-
Notifications
You must be signed in to change notification settings - Fork 4
/
rule_group.go
57 lines (49 loc) · 1.54 KB
/
rule_group.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
package qradar
import (
"context"
"net/http"
)
// RuleGroupService handles methods related to Rule Groups of the QRadar API.
type RuleGroupService service
const (
ruleGroupAPIPrefix = "api/analytics/rule_groups"
)
// RuleGroup represents QRadar's Rule Group.
type RuleGroup struct {
Owner *string `json:"owner"`
ModifiedTime *int `json:"modified_time"`
Level *int `json:"level"`
Name *string `json:"name"`
Description *string `json:"description"`
ChildGroups []int `json:"child_groups"`
ID *int `json:"id"`
ChildItems []string `json:"child_items"`
Type *string `json:"type"`
ParentID *int `json:"parent_id"`
}
// Get returns Rule Groups of the current QRadar installation.
func (c *RuleGroupService) Get(ctx context.Context, fields, filter string, from, to int) ([]RuleGroup, error) {
req, err := c.client.requestHelp(http.MethodGet, ruleGroupAPIPrefix, fields, filter, from, to, nil, nil)
if err != nil {
return nil, err
}
var result []RuleGroup
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return result, nil
}
// GetByID returns Rule Group of the current QRadar installation by ID.
func (c *RuleGroupService) GetByID(ctx context.Context, fields string, id int) (*RuleGroup, error) {
req, err := c.client.requestHelp(http.MethodGet, ruleGroupAPIPrefix, fields, "", 0, 0, &id, nil)
if err != nil {
return nil, err
}
var result RuleGroup
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return &result, nil
}