-
Notifications
You must be signed in to change notification settings - Fork 4
/
building_block_with_data.go
85 lines (69 loc) · 2.58 KB
/
building_block_with_data.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
package qradar
import (
"context"
"net/http"
)
// BuildingBlockWithDataService handles methods related to BuildingBlock of the QRadar Undocumented API.
type BuildingBlockWithDataService service
const buildingBlockWithDataAPIPrefix = "api/analytics/building_blocks_with_data"
// BuildingBlockWithData represents QRadar's BuildingBlock.
type BuildingBlockWithData struct {
BuildingBlock
RuleXML *string `json:"rule_xml,omitempty"`
}
// Get returns BuildingBlockWithData of the current QRadar installation. Undocumented API.
func (c *BuildingBlockWithDataService) Get(ctx context.Context, fields, filter string, from, to int) ([]BuildingBlockWithData, error) {
req, err := c.client.requestHelp(http.MethodGet, buildingBlockWithDataAPIPrefix, fields, filter, from, to, nil, nil)
if err != nil {
return nil, err
}
req.Header.Set("Allow-Hidden", "true")
var result []BuildingBlockWithData
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return result, nil
}
// Create creates BuildingBlockWithData in the current QRadar installation. Undocumented API.
func (c *BuildingBlockWithDataService) Create(ctx context.Context, fields string, data interface{}) (*BuildingBlockWithData, error) {
req, err := c.client.requestHelp(http.MethodPost, ruleWithDataAPIPrefix, fields, "", 0, 0, nil, data)
if err != nil {
return nil, err
}
req.Header.Set("Allow-Hidden", "true")
var result BuildingBlockWithData
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return &result, nil
}
// GetByID returns BuildingBlockWithData of the current QRadar installation by ID. Undocumented API.
func (c *BuildingBlockWithDataService) GetByID(ctx context.Context, fields string, id int) (*BuildingBlockWithData, error) {
req, err := c.client.requestHelp(http.MethodGet, buildingBlockWithDataAPIPrefix, fields, "", 0, 0, &id, nil)
if err != nil {
return nil, err
}
req.Header.Set("Allow-Hidden", "true")
var result BuildingBlockWithData
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return &result, nil
}
// UpdateByID updates BuildingBlockWithData by ID. Undocumented API.
func (c *BuildingBlockWithDataService) UpdateByID(ctx context.Context, fields string, id int, data interface{}) (*BuildingBlockWithData, error) {
req, err := c.client.requestHelp(http.MethodPost, buildingBlockWithDataAPIPrefix, fields, "", 0, 0, &id, data)
if err != nil {
return nil, err
}
req.Header.Set("Allow-Hidden", "true")
var result BuildingBlockWithData
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return &result, nil
}