forked from zorkian/go-datadog-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logs_index_lists.go
26 lines (22 loc) · 865 Bytes
/
logs_index_lists.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
package datadog
const logsIndexListPath = "/v1/logs/config/index-order"
// LogsIndexList represents the index list object from config API.
type LogsIndexList struct {
IndexNames []string `json:"index_names"`
}
// GetLogsIndexList gets the full list of available indexes by their names.
func (client *Client) GetLogsIndexList() (*LogsIndexList, error) {
var indexList LogsIndexList
if err := client.doJsonRequest("GET", logsIndexListPath, nil, &indexList); err != nil {
return nil, err
}
return &indexList, nil
}
// UpdateLogsIndexList updates the order of indexes.
func (client *Client) UpdateLogsIndexList(indexList *LogsIndexList) (*LogsIndexList, error) {
var updatedIndexList = &LogsIndexList{}
if err := client.doJsonRequest("PUT", logsIndexListPath, indexList, updatedIndexList); err != nil {
return nil, err
}
return updatedIndexList, nil
}