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