File: logs_index_lists.go

package info (click to toggle)
golang-github-zorkian-go-datadog-api 2.30.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,628 kB
  • sloc: makefile: 28; sh: 13
file content (26 lines) | stat: -rw-r--r-- 865 bytes parent folder | download | duplicates (3)
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
}