File: logs_pipeline_lists.go

package info (click to toggle)
golang-github-zorkian-go-datadog-api 2.30.0-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,616 kB
  • sloc: makefile: 28; sh: 13
file content (29 lines) | stat: -rw-r--r-- 1,031 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
27
28
29
package datadog

const (
	logsPipelineListPath = "/v1/logs/config/pipeline-order"
)

// LogsPipelineList struct represents the pipeline order from Logs Public Config API.
type LogsPipelineList struct {
	PipelineIds []string `json:"pipeline_ids"`
}

// GetLogsPipelineList get the full list of created pipelines.
func (client *Client) GetLogsPipelineList() (*LogsPipelineList, error) {
	var pipelineList LogsPipelineList
	if err := client.doJsonRequest("GET", logsPipelineListPath, nil, &pipelineList); err != nil {
		return nil, err
	}
	return &pipelineList, nil
}

// UpdateLogsPipelineList updates the pipeline list order, it returns error (422 Unprocessable Entity)
// if one tries to delete or add pipeline.
func (client *Client) UpdateLogsPipelineList(pipelineList *LogsPipelineList) (*LogsPipelineList, error) {
	var updatedPipelineList = &LogsPipelineList{}
	if err := client.doJsonRequest("PUT", logsPipelineListPath, pipelineList, updatedPipelineList); err != nil {
		return nil, err
	}
	return updatedPipelineList, nil
}