api

package
v0.52.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package api provides test helpers to interact with the Datadog API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitAppLogs

func WaitAppLogs(apiClient *Client, query string) (*datadog.LogAttributes, error)

WaitAppLogs waits for the app log corresponding to the query

func WaitAppSignal

func WaitAppSignal(apiClient *Client, query string) (*datadog.SecurityMonitoringSignalAttributes, error)

WaitAppSignal waits for the signal corresponding to the query

Types

type Attributes

type Attributes struct {
	Columns []Column `json:"columns"`
}

Attributes is a struct that represents the attributes of a data entry in a DDSQL table response

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents the datadog API context

func NewClient

func NewClient() *Client

NewClient initialise a client with the API and APP keys

func (*Client) CreateCWSAgentRule

func (c *Client) CreateCWSAgentRule(name string, msg string, secl string) (*datadog.CloudWorkloadSecurityAgentRuleResponse, error)

CreateCWSAgentRule creates a cws agent rule

func (*Client) CreateCwsSignalRule

func (c *Client) CreateCwsSignalRule(name string, msg string, agentRuleID string, tags []string) (*datadog.SecurityMonitoringRuleResponse, error)

CreateCwsSignalRule creates a cws signal rule

func (*Client) DeleteAgentRule

func (c *Client) DeleteAgentRule(ruleID string) error

DeleteAgentRule deletes an agent rule

func (*Client) DeleteSignalRule

func (c *Client) DeleteSignalRule(ruleID string) error

DeleteSignalRule deletes a signal rule

func (*Client) GetAppLog

func (c *Client) GetAppLog(query string) (*datadog.LogsListResponse, error)

GetAppLog returns the logs corresponding to the query

func (*Client) GetAppSignal

GetAppSignal returns the signal corresponding to the query

type Column

type Column struct {
	Name   string        `json:"name"`
	Type   string        `json:"type"`
	Values []interface{} `json:"values"`
}

Column is a struct that represents a column of a data entry in a DDSQL table response

type DDSQLClient

type DDSQLClient struct {
	// contains filtered or unexported fields
}

DDSQLClient is a struct that represents a DDSQL client

func NewDDSQLClient

func NewDDSQLClient(apiKey, appKey string) *DDSQLClient

NewDDSQLClient returns a new DDSQL client

func (*DDSQLClient) Do

func (c *DDSQLClient) Do(query string) (*DDSQLTableResponse, error)

Do executes a DDSQL query, returning a DDSQL table response

type DDSQLTableQueryParams

type DDSQLTableQueryParams struct {
	DefaultStart    int    `json:"default_start"`
	DefaultEnd      int    `json:"default_end"`
	DefaultInterval int    `json:"default_interval"`
	Query           string `json:"query"`
}

DDSQLTableQueryParams is a struct that represents a DDSQL table query

type DDSQLTableResponse

type DDSQLTableResponse struct {
	Data []DataEntry `json:"data"`
}

DDSQLTableResponse is a struct that represents a DDSQL table response

type DataEntry

type DataEntry struct {
	Type       string     `json:"type"`
	Attributes Attributes `json:"attributes"`
}

DataEntry is a struct that represents a data entry in a DDSQL table response

type JSONAPIPayload added in v0.52.1

type JSONAPIPayload[Attr any] struct {
	Data JSONAPIPayloadData[Attr] `json:"data"`
}

JSONAPIPayload is a struct that represents the body of a JSON API request

type JSONAPIPayloadData added in v0.52.1

type JSONAPIPayloadData[Attr any] struct {
	Type      string `json:"type"`
	Attribute Attr   `json:"attributes"`
}

JSONAPIPayloadData is a struct that represents the data field of a JSON API request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL