-
Notifications
You must be signed in to change notification settings - Fork 4
/
low_level_category.go
50 lines (44 loc) · 1.56 KB
/
low_level_category.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
package qradar
import (
"context"
"net/http"
)
// LowLevelCategoryService handles methods related to Low Level Categories of the QRadar API.
type LowLevelCategoryService service
const (
lowLevelCategoryAPIPrefix = "api/data_classification/low_level_categories"
)
// LowLevelCategory represents QRadar's LowLevelCategory.
type LowLevelCategory struct {
ID *int `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Severity *int `json:"severity,omitempty"`
HighLevelCategoryID *int `json:"high_level_category_id,omitempty"`
}
// Get returns LowLevelCategories of the current QRadar installation.
func (c *LowLevelCategoryService) Get(ctx context.Context, fields, filter string, from, to int) ([]LowLevelCategory, error) {
req, err := c.client.requestHelp(http.MethodGet, lowLevelCategoryAPIPrefix, fields, filter, from, to, nil, nil)
if err != nil {
return nil, err
}
var result []LowLevelCategory
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return result, nil
}
// GetByID returns LowLevelCategory of the current QRadar installation by ID.
func (c *LowLevelCategoryService) GetByID(ctx context.Context, fields string, id int) (*LowLevelCategory, error) {
req, err := c.client.requestHelp(http.MethodGet, lowLevelCategoryAPIPrefix, fields, "", 0, 0, &id, nil)
if err != nil {
return nil, err
}
var result LowLevelCategory
_, err = c.client.Do(ctx, req, &result)
if err != nil {
return nil, err
}
return &result, nil
}