state

package module
v0.40.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 15 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// ProductAPMSampling is the apm sampling product
	ProductAPMSampling = "APM_SAMPLING"
	// ProductCWSDD is the cloud workload security product managed by datadog employees
	ProductCWSDD = "CWS_DD"
	// ProductFeatures is a pseudo-product that lists whether or not a product should be enabled in a tracer
	ProductFeatures = "FEATURES"
	// ProductASMDD is the application security monitoring product managed by datadog employees
	ProductASMDD = "ASM_DD"
)

Variables

View Source
var (
	// ErrMalformedEmbeddedRoot occurs when the TUF root provided is invalid
	ErrMalformedEmbeddedRoot = errors.New("malformed embedded TUF root file provided")
)
View Source
var ErrNoConfigVersion = errors.New("version missing in custom file meta")

ErrNoConfigVersion occurs when a target file's custom meta is missing the config version

Functions

This section is empty.

Types

type APMSamplingConfig

type APMSamplingConfig struct {
	Config   apmsampling.APMSampling
	Metadata Metadata
}

APMSamplingConfig is a deserialized APM Sampling configuration file along with its associated remote config metadata.

type CachedFile

type CachedFile struct {
	Path   string
	Length uint64
	Hashes map[string][]byte
}

CachedFile describes a cached file stored by the agent client

Note: You may be wondering why this exists when `ConfigState` exists as well. The API for requesting updates does not mandate that a client cache config files. This implementation just happens to do so.

type ConfigASMDD

type ConfigASMDD struct {
	Config   []byte
	Metadata Metadata
}

ConfigASMDD is a deserialized ASM DD configuration file along with its associated remote config metadata

type ConfigCWSDD

type ConfigCWSDD struct {
	Config   []byte
	Metadata Metadata
}

ConfigCWSDD is a deserialized CWS DD configuration file along with its associated remote config metadata

type ConfigState

type ConfigState struct {
	Product string
	ID      string
	Version uint64
}

ConfigState describes an applied config by the agent client.

type FeaturesConfig

type FeaturesConfig struct {
	Config   FeaturesData
	Metadata Metadata
}

FeaturesConfig is a deserialized configuration file that indicates what features should be enabled within a tracer, along with its associated remote config metadata.

type FeaturesData

type FeaturesData struct {
	ASM struct {
		Enabled bool `json:"enabled"`
	} `json:"asm"`
}

FeaturesData describes the enabled state of features

type Metadata

type Metadata struct {
	Product   string
	ID        string
	Name      string
	Version   uint64
	RawLength uint64
	Hashes    map[string][]byte
}

Metadata stores remote config metadata for a given configuration

type Repository

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

Repository is a remote config client used in a downstream process to retrieve remote config updates from an Agent.

func NewRepository

func NewRepository(embeddedRoot []byte) (*Repository, error)

NewRepository creates a new remote config repository that will track both TUF metadata and raw config files for a client.

func (*Repository) APMConfigs

func (r *Repository) APMConfigs() map[string]APMSamplingConfig

APMConfigs returns the currently active APM configs

func (*Repository) ASMDDConfigs

func (r *Repository) ASMDDConfigs() map[string]ConfigASMDD

ASMDDConfigs returns the currently active ASMDD configs

func (*Repository) CWSDDConfigs

func (r *Repository) CWSDDConfigs() map[string]ConfigCWSDD

CWSDDConfigs returns the currently active CWSDD config files

func (*Repository) CurrentState

func (r *Repository) CurrentState() (RepositoryState, error)

CurrentState returns all of the information needed to make an update for new configurations.

func (*Repository) FeaturesConfigs

func (r *Repository) FeaturesConfigs() map[string]FeaturesConfig

FeaturesConfigs returns the currently active Features configs

func (*Repository) Update

func (r *Repository) Update(update Update) ([]string, error)

Update processes the ClientGetConfigsResponse from the Agent and updates the configuration state

type RepositoryState

type RepositoryState struct {
	Configs            []ConfigState
	CachedFiles        []CachedFile
	TargetsVersion     int64
	RootsVersion       int64
	OpaqueBackendState []byte
}

RepositoryState contains all of the information about the current config files stored by the client to be able to make an update request to an Agent

type Update

type Update struct {
	// TUFRoots contains, in order, updated roots that this repository needs to keep up with TUF validation
	TUFRoots [][]byte
	// TUFTargets is the latest TUF Targets file and is used to validate raw config files
	TUFTargets []byte
	// TargetFiles stores the raw config files by their full TUF path
	TargetFiles map[string][]byte
	// ClientcConfigs is a list of TUF path's corresponding to config files designated for this repository
	ClientConfigs []string
}

An Update contains all the data needed to update a client's remote config repository state

Directories

Path Synopsis
products

Jump to

Keyboard shortcuts

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