datadog

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetDefaultRuleset returns the content of the default ruleset.
	GetDefaultRuleset(ctx context.Context) (*Ruleset, error)
	// GetRemoteConfig applies server-side changes to the local configuration.
	GetRemoteConfig(ctx context.Context, repoUrl string, localConfig []byte) ([]byte, error)
}

func NewDatadogClient

func NewDatadogClient(options ...DatadogClientOption) Client

NewDatadogClient creates a DatadogSource with the given options.

type DatadogClientOption

type DatadogClientOption func(source *datadogClient)

func WithApiKey

func WithApiKey(apiKey string) DatadogClientOption

WithApiKey lets you specify a Datadog API key. If unspecified, the API key will be fetched from the environment using WithApiKeyFromEnv.

func WithApiKeyFromEnv

func WithApiKeyFromEnv() DatadogClientOption

WithApiKeyFromEnv uses the API key specified in the DD_API_KEY or DATADOG_API_KEY environment variable. If neither variable exists, an empty API key will be used.

func WithAppKey

func WithAppKey(appKey string) DatadogClientOption

WithAppKey lets you specify a Datadog application key. If unspecified, the application key will be fetched from the environment using WithAppKeyFromEnv.

func WithAppKeyFromEnv

func WithAppKeyFromEnv() DatadogClientOption

WithAppKeyFromEnv uses the application key specified in the DD_APP_KEY or DATADOG_APP_KEY environment variable. If neither variable exists, an empty application key will be used.

func WithHostname

func WithHostname(hostname string) DatadogClientOption

WithHostname lets you specify the hostname to use for Datadog API requests. Used in the implementation and unit tests.

func WithHttpClient

func WithHttpClient(client *http.Client) DatadogClientOption

WithHttpClient lets you specify an http.Client instance to use. If unspecified, the http.DefaultClient will be used.

func WithSite

func WithSite(site string) DatadogClientOption

WithSite lets you specify a Datadog site to use. If unspecified, the Datadog site will be fetched from the environment using WithSiteFromEnv.

func WithSiteFromEnv

func WithSiteFromEnv() DatadogClientOption

WithSiteFromEnv uses the Datadog site specified in the DD_SITE or DATADOG_SITE environment variable. If neither variable exists, "datadoghq.com" will be used.

type Framework

type Framework struct {
	Framework   string `jsonapi:"attribute" json:"framework"`
	Version     string `jsonapi:"attribute" json:"version"`
	Requirement string `jsonapi:"attribute" json:"requirement"`
	Control     string `jsonapi:"attribute" json:"control"`
}

Framework defines a compliance framework

type Rule

type Rule struct {
	ID                string         `jsonapi:"primary,iac_rule" json:"id"`
	Name              string         `jsonapi:"attribute" json:"name"`
	LegacyId          *string        `jsonapi:"attribute" json:"legacy_id,omitempty"`
	ShortDescription  string         `jsonapi:"attribute" json:"short_description"`
	Description       string         `jsonapi:"attribute" json:"description"`
	DescriptionId     *string        `jsonapi:"attribute" json:"description_id,omitempty"`
	Platform          string         `jsonapi:"attribute" json:"platform"`
	Type              string         `jsonapi:"attribute" json:"type"`
	RegoQuery         []byte         `jsonapi:"attribute" json:"rego_query"`
	Severity          string         `jsonapi:"attribute" json:"severity"`
	Category          string         `jsonapi:"attribute" json:"category"`
	Provider          *string        `jsonapi:"attribute" json:"provider,omitempty"`
	Cwe               *string        `jsonapi:"attribute" json:"cwe,omitempty"`
	DocumentationUrl  *string        `jsonapi:"attribute" json:"documentation_url,omitempty"`
	ProviderUrl       *string        `jsonapi:"attribute" json:"provider_url,omitempty"`
	Aggregation       *int           `jsonapi:"attribute" json:"aggregation,omitempty"`
	Overrides         []RuleOverride `jsonapi:"attribute" json:"overrides,omitempty"`
	DefaultFrameworks []Framework    `jsonapi:"attribute" json:"default_frameworks,omitempty"`
	CustomFrameworks  []Framework    `jsonapi:"attribute" json:"custom_frameworks,omitempty"`
	IsTesting         bool           `jsonapi:"attribute" json:"is_testing"`
	IsPublished       bool           `jsonapi:"attribute" json:"is_published"`
}

Rule defines the structure of a rule that's stored in Datadog.

type RuleOverride

type RuleOverride struct {
	Key              string  `jsonapi:"primary,iac_rule_override" json:"key"`
	ID               *string `jsonapi:"attribute" json:"id,omitempty"`
	ShortDescription *string `jsonapi:"attribute" json:"short_description,omitempty"`
	Description      *string `jsonapi:"attribute" json:"description,omitempty"`
	DescriptionId    *string `jsonapi:"attribute" json:"description_id,omitempty"`
	Platform         *string `jsonapi:"attribute" json:"platform,omitempty"`
	Severity         *string `jsonapi:"attribute" json:"severity,omitempty"`
	Category         *string `jsonapi:"attribute" json:"category,omitempty"`
	Provider         *string `jsonapi:"attribute" json:"provider,omitempty"`
	Cwe              *string `jsonapi:"attribute" json:"cwe,omitempty"`
	DocumentationUrl *string `jsonapi:"attribute" json:"documentation_url,omitempty"`
	ProviderUrl      *string `jsonapi:"attribute" json:"provider_url,omitempty"`
}

RuleOverride contains a set of keyed changes for the rule configuration

type Ruleset

type Ruleset struct {
	ID               string  `jsonapi:"primary,iac_ruleset" json:"id"`
	Name             string  `jsonapi:"attribute" json:"name"`
	ShortDescription string  `jsonapi:"attribute" json:"short_description"`
	Description      string  `jsonapi:"attribute" json:"description"`
	Rules            []*Rule `jsonapi:"attribute" json:"rules"`
}

Ruleset defines a collection of rules.

Jump to

Keyboard shortcuts

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