model

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 44 Imported by: 2

Documentation

Overview

Package model contains the data model for resources used in BindPlane

Index

Constants

View Source
const (
	// FieldConfigurationCurrent is the name of the index field used to store the current configuration name:version
	FieldConfigurationCurrent = "configuration-current"

	// FieldConfigurationPending is the name of the index field used to store the pending configuration name:version
	FieldConfigurationPending = "configuration-pending"

	// FieldConfigurationFuture is the name of the index field used to store the future configuration name:version
	FieldConfigurationFuture = "configuration-future"

	// FieldRolloutComplete is the name of the index field used to store the complete rollout configuration name:version
	FieldRolloutComplete = "rollout-complete"

	// FieldRolloutError is the name of the index field used to store the error rollout configuration name:version
	FieldRolloutError = "rollout-error"

	// FieldRolloutPending is the name of the index field used to store the pending rollout configuration name:version
	FieldRolloutPending = "rollout-pending"

	// FieldRolloutWaiting is the name of the index field used to store the waiting rollout configuration name:version
	FieldRolloutWaiting = "rollout-waiting"
)
View Source
const (
	// LabelBindPlaneAgentID is the label name for agent id
	LabelBindPlaneAgentID = "bindplane/agent-id"

	// LabelBindPlaneAgentName is the label name for agent name
	LabelBindPlaneAgentName = "bindplane/agent-name"

	// LabelBindPlaneAgentType is the label for the agent type
	LabelBindPlaneAgentType = "bindplane/agent-type"

	// LabelBindPlaneAgentVersion is the label name for agent version
	LabelBindPlaneAgentVersion = "bindplane/agent-version"

	// LabelBindPlaneAgentHost is the label name for agent host
	LabelBindPlaneAgentHost = "bindplane/agent-host"

	// LabelBindPlaneAgentOS is the label name for agent operating system
	LabelBindPlaneAgentOS = "bindplane/agent-os"

	// LabelBindPlaneAgentArch is the label name for agent cpu architecture
	LabelBindPlaneAgentArch = "bindplane/agent-arch"

	// LabelAgentContainerPlatform is the label name for specifying a container platform (k8s, openshift, etc...)
	LabelAgentContainerPlatform = "container-platform"
)
View Source
const (
	// MetadataName TODO(doc)
	MetadataName = "name"
	// MetadataID TODO(doc)
	MetadataID = "id"
)
View Source
const AgentFeaturesDefault = AgentSupportsUpgrade

AgentFeaturesDefault is the default bitmask of features supported by Agents

View Source
const ResourceDateFormat = "2006-01-02 15:04:05"

ResourceDateFormat is used when formatting dates for Resources.

View Source
const SensitiveParameterPlaceholder = "(sensitive)"

SensitiveParameterPlaceholder is the value returned for sensitive parameters

Variables

View Source
var DefaultRolloutOptions = map[RolloutSize]RolloutOptions{
	RolloutSmall: {
		StartAutomatically: false,
		RollbackOnFailure:  true,
		PhaseAgentCount: PhaseAgentCount{
			Initial:    1,
			Multiplier: 1,
			Maximum:    1,
		},
		MaxErrors: 0,
	},
	RolloutMedium: {
		StartAutomatically: false,
		RollbackOnFailure:  true,
		PhaseAgentCount: PhaseAgentCount{
			Initial:    1,
			Multiplier: 3,
			Maximum:    100,
		},
		MaxErrors: 0,
	},
	RolloutLarge: {
		StartAutomatically: false,
		RollbackOnFailure:  true,
		PhaseAgentCount: PhaseAgentCount{
			Initial:    3,
			Multiplier: 5,
			Maximum:    100,
		},
		MaxErrors: 0,
	},
}

DefaultRolloutOptions contains the default rollout options for a configuration. NOTE: These options are the same as the defaults in the UI in rollouts-rest-fns.ts

View Source
var ErrInvalidPlatform = errors.New("invalid platform name")

ErrInvalidPlatform is returned when a platform name is not valid

View Source
var ErrMissingSupportedPlatforms = errors.New("supportedPlatforms must be specified")

ErrMissingSupportedPlatforms is returned when the supportedPlatforms field is missing or empty

View Source
var SupportedPlatforms = &supportedPlatforms{
	platforms: []string{
		platformWindows,
		platformLinux,
		platformMacOS,
		platformK8sDaemonset,
		platformK8sDeployment,
		platformOpenshiftDaemonset,
		platformOpenshiftDeployment,
	},
}

SupportedPlatforms contains the list of supported platforms in the ResourceType Spec

Functions

func AsKind added in v1.16.0

func AsKind[T Resource](resource Resource) (T, error)

AsKind either casts the Resource to the expected type or parses an AnyResource to the expected type. It returns an error if the parsing fails or if the resource is not of the expected type.

func Clone added in v1.16.0

func Clone[T Resource](r T) (result T, err error)

Clone returns a copy of a resource by using json marshal/unmarshal.

func ContextWithoutSensitiveParameterMasking added in v1.19.0

func ContextWithoutSensitiveParameterMasking(ctx context.Context) context.Context

ContextWithoutSensitiveParameterMasking returns a context that will not mask sensitive parameters

func EvalProcessor added in v1.16.0

func EvalProcessor(ctx context.Context, processor *ResourceConfiguration, defaultName string, store ResourceStore, rc *renderContext, errorHandler TemplateErrorHandler) (string, otel.Partials)

EvalProcessor exposes evalProcessor for observathon

func GetOssOtelHeaders added in v1.19.3

func GetOssOtelHeaders() map[string]string

GetOssOtelHeaders are the Headers used to add headers to the otel configuration

func HasVersionKind added in v1.16.0

func HasVersionKind(kind Kind) bool

HasVersionKind returns true if the kind has a version. This is slightly different than IsVersionedKind for the Configuration resource. Configuration has a version, but is not auto-versioned so is not considered true for IsVersionedKind.

func IsVersionedKind added in v1.16.0

func IsVersionedKind(kind Kind) bool

IsVersionedKind returns true if the kind is versioned

func IsWithoutSensitiveParameterMasking added in v1.19.0

func IsWithoutSensitiveParameterMasking(ctx context.Context) bool

IsWithoutSensitiveParameterMasking returns true if the context has been set to not mask sensitive parameters

func JoinVersion added in v1.16.0

func JoinVersion(resourceKey string, version Version) string

JoinVersion joins a resource key and version into a resource key for the specified version.

func NameAndVersion added in v1.16.0

func NameAndVersion(name string, version Version) string

NameAndVersion returns a Resource name:version for the specified name and version

func NewResourceID added in v1.16.0

func NewResourceID() string

NewResourceID creates a new ULID with default entropy

func NewSecretKey added in v1.16.0

func NewSecretKey() string

NewSecretKey generates a new secret key

func ParameterValue added in v1.19.0

func ParameterValue(parameters []Parameter, name string) any

ParameterValue returns the value of the first Parameter with the specified name. If multiple Parameters exist with the specified name, only the first one will be returned.

func Parse added in v1.16.0

func Parse[T Resource](r []*AnyResource) ([]T, error)

Parse parses an AnyResource and ensures that it is the correct type

func ParseOne added in v1.16.0

func ParseOne[T Resource](r *AnyResource) (resource T, err error)

ParseOne parses an AnyResource and ensures that it is the correct type

func ParseResourceStatus added in v1.16.0

func ParseResourceStatus[T any](resource Resource) (*T, bool)

ParseResourceStatus returns the status for the given resource if the status is of the given type. Otherwise, it can parse it from a map[string]any.

func PreserveSensitiveParameters added in v1.19.0

func PreserveSensitiveParameters(ctx context.Context, resource HasResourceParameters, existing *AnyResource) error

PreserveSensitiveParameters will preserve sensitive parameters in the spec with the values from the existing spec.

func PrintableFieldValues

func PrintableFieldValues(p Printable) []string

PrintableFieldValues uses PrintableFieldTitles and PrintableFieldValue of the specified Printable to assemble the list of values to print

func PrintableFieldValuesForTitles

func PrintableFieldValuesForTitles(p Printable, titles []string) []string

PrintableFieldValuesForTitles uses PrintableFieldValue of the specified Printable to assemble the list of values to print for the specified titles

func Register added in v1.16.0

func Register[T Resource](apiVersion string, kind Kind, resourceKind ResourceKind[T])

Register registers a ResourceKind so that it can be created and managed by BindPlane

func RegisterDefault added in v1.16.0

func RegisterDefault[T Resource](apiVersion string, kind Kind, resourceKind ResourceKind[T])

RegisterDefault registers a ResourceKind as the default version if no version is specified

func RegisterKind added in v1.16.0

func RegisterKind(kind Kind)

RegisterKind registers a kind like KindAgent that doesn't implement Resource

func SetVersion added in v1.16.0

func SetVersion[R Resource](resource R, Version Version) R

SetVersion sets the Version on the Resource and returns it. It does not return a modified copy. It modifies the existing resource and returns it as a convenience.

func SnapshotProcessor added in v1.16.0

func SnapshotProcessor(position MeasurementPosition, resourceName string) otel.ComponentID

SnapshotProcessor returns the ComponentID of the snapshot processor for a given position and resource name

func SortAgentVersionsLatestFirst added in v1.0.0

func SortAgentVersionsLatestFirst(agentVersions []*AgentVersion)

SortAgentVersionsLatestFirst sorts agent versions by their semantic versions, newest first

func SortAgentsByName

func SortAgentsByName(agents []*Agent)

SortAgentsByName sorts the specified slice of Agents by name.

func TrimVersion added in v1.16.0

func TrimVersion(resourceKey string) string

TrimVersion removes a version from a resource key. It does nothing if there is no version.

func UniqueKeys added in v1.16.0

func UniqueKeys[S ~[]T, T HasUniqueKey](resources S) []string

UniqueKeys returns the list of unique keys for the specified resources

Types

type AdditionalInfo added in v1.22.0

type AdditionalInfo struct {
	Message       string              `json:"message" yaml:"message" mapstructure:"message"`
	Documentation []DocumentationLink `json:"documentation" yaml:"documentation"`
}

AdditionalInfo configures a mui alert that gets placed under a resource title description to make important info clearly visible.

type Agent

type Agent struct {
	ID              string `json:"id" yaml:"id" db:"id"`
	Name            string `json:"name" yaml:"name" db:"name"`
	Type            string `json:"type" yaml:"type" db:"type"`
	Architecture    string `json:"arch" yaml:"arch" db:"architecture"`
	HostName        string `json:"hostname" yaml:"hostname" db:"host_name"`
	Labels          Labels `json:"labels,omitempty" yaml:"labels" db:"labels"`
	Version         string `json:"version" yaml:"version" db:"version"`
	Home            string `json:"home" yaml:"home" db:"home_directory"`
	Platform        string `json:"platform" yaml:"platform" db:"platform"`
	OperatingSystem string `json:"operatingSystem" yaml:"operatingSystem" db:"operating_system"`
	MacAddress      string `json:"macAddress" yaml:"macAddress" db:"mac_address"`
	RemoteAddress   string `json:"remoteAddress,omitempty" yaml:"remoteAddress,omitempty" db:"remote_address"`

	// SecretKey is provided by the agent to authenticate
	SecretKey string `json:"-" yaml:"-"`

	// TLS from the agent's manager.yaml
	TLS *ManagerTLS `json:"tls,omitempty" yaml:"tls,omitempty"`

	// Upgrade stores information about an agent upgrade
	Upgrade *AgentUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty" db:"upgrade,omitempty"`

	// reported by Status messages
	Status       AgentStatus `json:"status" db:"status"`
	ErrorMessage string      `json:"errorMessage,omitempty" yaml:"errorMessage,omitempty" db:"error_message"`

	// tracked by BindPlane
	Configuration  any        `json:"configuration,omitempty" yaml:"configuration,omitempty" db:"configuration"`
	ConnectedAt    *time.Time `json:"connectedAt,omitempty" yaml:"connectedAt,omitempty" db:"connected_at"`
	DisconnectedAt *time.Time `json:"disconnectedAt,omitempty" yaml:"disconnectedAt,omitempty" db:"disconnected_at"`
	ReportedAt     *time.Time `json:"reported_at,omitempty" yaml:"reported_at,omitempty" db:"reported_at"`

	Protocol            string                `json:"protocol,omitempty" yaml:"protocol,omitempty" db:"management_protocol"`
	State               any                   `json:"state,omitempty" yaml:"state,omitempty" db:"management_state"`
	ConfigurationStatus ConfigurationVersions `json:"configurationStatus,omitempty" yaml:"configurationStatus,omitempty" db:",inline"`
}

Agent is a single observIQ OTel Collector instance

func (*Agent) Connect

func (a *Agent) Connect(newAgentVersion string)

Connect updates the ConnectedAt, ReportedAt, and DisconnectedAt fields of the agent and should be called when the agent connects.

func (*Agent) ConnectedDurationDisplayText

func (a *Agent) ConnectedDurationDisplayText() string

ConnectedDurationDisplayText returns the duration since the agent connected.

func (*Agent) Disconnect

func (a *Agent) Disconnect()

Disconnect updates the DisconnectedAt and Status fields of the agent and should be called when the agent disconnects. If the agent is already disconnected, this does nothing.

func (*Agent) DisconnectedDurationDisplayText

func (a *Agent) DisconnectedDurationDisplayText() string

DisconnectedDurationDisplayText returns the duration since the agent disconnected.

func (*Agent) DisconnectedSince

func (a *Agent) DisconnectedSince(since time.Time) bool

DisconnectedSince returns true if the agent has been disconnected since a given time.

func (*Agent) Features added in v1.1.0

func (a *Agent) Features() AgentFeatures

Features returns a bitmask of the features supported by this Agent

func (*Agent) GetLabels

func (a *Agent) GetLabels() Labels

GetLabels implements the Labeled interface for Agents

func (*Agent) HasFeatures added in v1.1.0

func (a *Agent) HasFeatures(feature AgentFeatures) bool

HasFeatures returns true if this Agent supports the specified feature or features.

func (*Agent) IndexFields

func (a *Agent) IndexFields(index modelSearch.Indexer)

IndexFields returns a map of field name to field value to be stored in the index

func (*Agent) IndexID

func (a *Agent) IndexID() string

IndexID returns an ID used to identify the resource that is indexed

func (*Agent) IndexLabels

func (a *Agent) IndexLabels(index modelSearch.Indexer)

IndexLabels returns a map of label name to label value to be stored in the index

func (*Agent) MatchesSelector

func (a *Agent) MatchesSelector(selector Selector) bool

MatchesSelector returns true if the given selector matches the agent's labels.

func (*Agent) PrintableFieldTitles

func (a *Agent) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Agent) PrintableFieldValue

func (a *Agent) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Agent) PrintableKindPlural

func (a *Agent) PrintableKindPlural() string

PrintableKindPlural returns the singular form of the Kind, e.g. "Agents"

func (*Agent) PrintableKindSingular

func (a *Agent) PrintableKindSingular() string

PrintableKindSingular returns the singular form of the Kind, e.g. "Agent"

func (*Agent) ReportedDurationDisplayText added in v1.23.0

func (a *Agent) ReportedDurationDisplayText() string

ReportedDurationDisplayText returns the duration since the agent last reported.

func (*Agent) ReportedSince added in v1.23.0

func (a *Agent) ReportedSince(since time.Time) bool

ReportedSince returns true if the agent has reported since a given time.

func (*Agent) SetCurrentConfiguration added in v1.16.0

func (a *Agent) SetCurrentConfiguration(configuration *Configuration)

SetCurrentConfiguration sets the Current configuration in the ConfigurationStatus on the agent based on the specified configuration. If Pending or Future are set to this value, they will be cleared.

SetCurrentConfiguration will be called when the configuration is confirmed to be currently running on the Agent.

func (*Agent) SetFutureConfiguration added in v1.16.0

func (a *Agent) SetFutureConfiguration(configuration *Configuration)

SetFutureConfiguration sets the Future configuration in the ConfigurationStatus on the agent based on the specified configuration. Typically this will set the Future configuration and clear Pending, but if Pending is already set to this Configuration, Future will be cleared. If Current is already set to this Configuration, Pending and Future will both be cleared. If configuration is nil, Current, Pending and Future will all be cleared.

SetFutureConfiguration will be called when the configuration of an Agent should change. The rollout manager will handle scheduling updates and move it to Pending.

func (*Agent) SetLabels added in v1.16.0

func (a *Agent) SetLabels(l Labels)

SetLabels implements the Labeled interface for Agents

func (*Agent) SetPendingConfiguration added in v1.16.0

func (a *Agent) SetPendingConfiguration(configuration *Configuration)

SetPendingConfiguration sets the Pending configuration in the ConfigurationStatus on the agent based on the specified configuration. If Future is already set to this value, it will be cleared. If Current is already set to this value, Pending will also be cleared. If configuration is nil, Current, Pending and Future will all be cleared.

SetPendingConfiguration will be called by the rollout manager when the Agent should receive a new configuration.

func (*Agent) StatusDisplayText

func (a *Agent) StatusDisplayText() string

StatusDisplayText returns the string representation of the agent's status.

func (*Agent) SupportsUpgrade added in v1.0.0

func (a *Agent) SupportsUpgrade() bool

SupportsUpgrade returns true if this agent supports upgrade

func (*Agent) UniqueKey

func (a *Agent) UniqueKey() string

UniqueKey returns the agent ID to uniquely identify an Agent

func (*Agent) UpgradeComplete added in v1.0.0

func (a *Agent) UpgradeComplete(version, errorMessage string)

UpgradeComplete completes an upgrade by setting the status back to either Connected or Error (depending on ErrorMessage) and either removing the AgentUpgrade field or setting the Error on it if the specified errorMessage is not empty.

func (*Agent) UpgradeStarted added in v1.0.0

func (a *Agent) UpgradeStarted(version string, allPackagesHash []byte)

UpgradeStarted is set when the upgrade instructions have actually been sent to the Agent.

func (*Agent) UpgradeTo added in v1.0.0

func (a *Agent) UpgradeTo(version string)

UpgradeTo begins an upgrade by setting the status to Upgrading and setting the Upgrade field to the specified version.

type AgentDownload added in v1.0.0

type AgentDownload struct {
	URL  string `yaml:"url" json:"url" mapstructure:"url"`
	Hash string `yaml:"hash" json:"hash" mapstructure:"hash"`
}

AgentDownload contains the url to download the agent release and a hash to verify the contents of the download.

func (*AgentDownload) HashBytes added in v1.0.0

func (d *AgentDownload) HashBytes() []byte

HashBytes returns the Hash of the download decoded as a byte array or nil if the hash is unspecified or invalid. This does not return an error because it is expected that errors will be detected in validation and an error in the hash can be treated as if there is no hash.

type AgentFeatures added in v1.1.0

type AgentFeatures uint32

AgentFeatures is a bitmask of features supported by the Agent, usually based on its version.

const (
	// AgentSupportsUpgrade will be set if this Agent can be upgraded remotely.
	AgentSupportsUpgrade AgentFeatures = 1 << iota

	// AgentSupportsSnapshots will be set if this Agent can send snapshots of recent telemetry signals.
	AgentSupportsSnapshots

	// AgentSupportsMeasurements will be set if this Agent supports the throughputmeasurement processor for measuring throughput.
	AgentSupportsMeasurements

	// AgentSupportsLogBasedMetrics will be set if this agent supports the logcount processor and route receiver for creating metrics from logs.
	AgentSupportsLogBasedMetrics
)

func (AgentFeatures) Has added in v1.1.0

func (agentFeatures AgentFeatures) Has(feature AgentFeatures) bool

Has returns true if the AgentFeatures bitmask has the specified features enabled. This is simply implemented as agentFeatures&feature != 0 but I prefer to avoid using bitmasks directly when possible.

type AgentInstaller added in v1.0.0

type AgentInstaller struct {
	URL string `yaml:"url" json:"url" mapstructure:"url"`
}

AgentInstaller contains the url of the install script

type AgentLabelsPayload

type AgentLabelsPayload struct {
	Labels map[string]string `json:"labels"`
}

AgentLabelsPayload is the REST API body for PATCH /v1/agents/{id}/labels

type AgentLabelsResponse

type AgentLabelsResponse struct {
	Errors []string `json:"errors"`
	Labels *Labels  `json:"labels"`
}

AgentLabelsResponse is the REST API response to GET /v1/agents/{id}/labels

type AgentResponse

type AgentResponse struct {
	Agent *Agent `json:"agent"`
}

AgentResponse is the REST API response to GET /v1/agent/:name

type AgentSelector

type AgentSelector struct {
	MatchLabels `json:"matchLabels" yaml:"matchLabels" mapstructure:"matchLabels"`
}

AgentSelector specifies a selector to use to match resources to agents

func (AgentSelector) Selector

func (s AgentSelector) Selector() Selector

Selector creates a Selector struct from an AgentSelector

type AgentStatus

type AgentStatus uint8

AgentStatus is the status of the Agent's connection to bindplane platform

const (
	// Disconnected is the state of an agent that was formerly Connected to the management platform but is no longer
	// connected. This could mean that the agent has stopped running, the network connection has been interrupted, or that
	// the server terminated the connection.
	Disconnected AgentStatus = 0

	// Connected is the normal state of a healthy agent that is Connected to the management platform.
	Connected AgentStatus = 1

	// Error occurs if there is an error running or Configuring the agent.
	Error AgentStatus = 2

	// ComponentFailed is deprecated.
	ComponentFailed AgentStatus = 4

	// Deleted is set on a deleted Agent before notifying observers of the change.
	Deleted AgentStatus = 5

	// Configuring is set on an Agent when it is sent a new configuration that has not been applied. After successful
	// Configuring, it will transition back to Connected. If there is an error Configuring, it will transition to Error.
	Configuring AgentStatus = 6

	// Upgrading is set on an Agent when it has been sent a new package that is being applied. After Upgrading, it will
	// transition back to Connected or Error unless it already has the Configuring status.
	Upgrading AgentStatus = 7
)

type AgentTypeName added in v1.0.0

type AgentTypeName string

AgentTypeName is the name of a type of agent

const (
	// AgentTypeNameObservIQOtelCollector is the name of the observIQ Distro for OpenTelemetry Collector
	AgentTypeNameObservIQOtelCollector AgentTypeName = "observiq-otel-collector"
)

type AgentUpgrade added in v1.0.0

type AgentUpgrade struct {
	// Status indicates the progress of the agent upgrade
	Status AgentUpgradeStatus `json:"status" yaml:"status"`

	// Version is used to indicate that an agent should be or is being upgraded. The agent status will be set to Upgrading
	// when the upgrade begins.
	Version string `json:"version,omitempty" yaml:"version,omitempty"`

	// AllPackagesHash is the hash of the packages sent to the agent to upgrade
	AllPackagesHash []byte `json:"allPackagesHash,omitempty" yaml:"allPackagesHash,omitempty"`

	// Error is set if there were errors upgrading the agent
	Error string `json:"error,omitempty" yaml:"error,omitempty"`
}

AgentUpgrade stores information on an Agent about the upgrade process.

func (*AgentUpgrade) Scan added in v1.17.0

func (s *AgentUpgrade) Scan(value interface{}) error

Scan is used to translate from a JSONB field in postgres to AgentUpgrade

func (AgentUpgrade) Value added in v1.17.0

func (s AgentUpgrade) Value() (driver.Value, error)

Value is used to translate to a JSONB field for postgres storage

type AgentUpgradeStatus added in v1.0.0

type AgentUpgradeStatus uint8

AgentUpgradeStatus is the status of the AgentUpgrade

const (
	// UpgradePending is set when the upgrade is initially started
	UpgradePending AgentUpgradeStatus = 0
	// UpgradeStarted is set when the upgrade has been sent to the agent
	UpgradeStarted AgentUpgradeStatus = 1
	// UpgradeFailed is set when the upgrade is complete but there was an error. If the upgrade is successful, the Agent
	// Upgrade field will be set to nil and there is no corresponding status.
	UpgradeFailed AgentUpgradeStatus = 2
)

type AgentVersion added in v1.0.0

type AgentVersion struct {
	// ResourceMeta TODO(doc)
	ResourceMeta `yaml:",inline" mapstructure:",squash"`
	// Spec TODO(doc)
	Spec                 AgentVersionSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
	StatusType[NoStatus] `yaml:",inline" mapstructure:",squash"`
}

AgentVersion is the resource for a version of an agent and includes links to install scripts and downloads links for the agent release.

func NewAgentVersion added in v1.0.0

func NewAgentVersion(spec AgentVersionSpec) *AgentVersion

NewAgentVersion constructs a new AgentVersion with the specific spec. The name will be created based on the type and version.

func (*AgentVersion) AgentType added in v1.0.0

func (v *AgentVersion) AgentType() string

AgentType returns the type of agent for this AgentVersion

func (*AgentVersion) AgentVersion added in v1.16.0

func (v *AgentVersion) AgentVersion() string

AgentVersion returns the version of the AgentVersion

func (*AgentVersion) Download added in v1.0.0

func (v *AgentVersion) Download(platform string) *AgentDownload

Download returns the agent download for the specified platform in the form os or os/arch.

func (*AgentVersion) GetKind added in v1.0.0

func (v *AgentVersion) GetKind() Kind

GetKind returns "AgentVersion"

func (*AgentVersion) GetSpec added in v1.16.0

func (v *AgentVersion) GetSpec() any

GetSpec returns the spec for this resource.

func (*AgentVersion) Installer added in v1.0.0

func (v *AgentVersion) Installer(platform string) *AgentInstaller

Installer returns the agent installer for the specified platform in the form os or os/arch.

func (*AgentVersion) PrintableFieldTitles added in v1.0.0

func (v *AgentVersion) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*AgentVersion) PrintableFieldValue added in v1.0.0

func (v *AgentVersion) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*AgentVersion) Public added in v1.0.0

func (v *AgentVersion) Public() bool

Public returns true if the version is not a draft or prerelease

func (*AgentVersion) SemanticVersion added in v1.0.0

func (v *AgentVersion) SemanticVersion() *semver.Version

SemanticVersion returns a parsed semantic version that can be used to compare to other versions

func (*AgentVersion) Validate added in v1.0.0

func (v *AgentVersion) Validate() (warnings string, errors error)

Validate ensures that each of the fields of an AgentVersion is valid. The name must equal "Type-Version"

type AgentVersionResponse added in v1.0.0

type AgentVersionResponse struct {
	AgentVersion *AgentVersion `json:"agentVersion"`
}

AgentVersionResponse is the REST API response to GET /v1/agent-versions/:name

type AgentVersionSpec added in v1.0.0

type AgentVersionSpec struct {
	Type            string `yaml:"type" json:"type" mapstructure:"type"`
	Version         string `yaml:"version" json:"version" mapstructure:"version"`
	ReleaseNotesURL string `yaml:"releaseNotesURL" json:"releaseNotesURL" mapstructure:"releaseNotesURL"`
	Draft           bool   `yaml:"draft" json:"draft" mapstructure:"draft"`
	Prerelease      bool   `yaml:"prerelease" json:"prerelease" mapstructure:"prerelease"`
	// Map of platform to installer script URL
	Installer map[string]AgentInstaller `yaml:"installer" json:"installer" mapstructure:"installer"`
	// Map of platform to download URL and hash
	Download map[string]AgentDownload `yaml:"download" json:"download" mapstructure:"download"`

	// ReleaseDate is an RFC3339 encoded date in a string
	ReleaseDate string `yaml:"releaseDate" json:"releaseDate" mapstructure:"releaseDate"`
}

AgentVersionSpec is the spec for an AgentVersion

type AgentVersionsResponse added in v1.0.0

type AgentVersionsResponse struct {
	AgentVersions []*AgentVersion `json:"agentVersions"`
}

AgentVersionsResponse is the REST API response to GET /v1/agent-versions

type AgentsResponse

type AgentsResponse struct {
	Agents []*Agent `json:"agents"`
}

AgentsResponse is the REST API response to GET /v1/agents endpoint.

type AnyResource

type AnyResource struct {
	ResourceMeta               `yaml:",inline" mapstructure:",squash"`
	Spec                       map[string]any `yaml:"spec" json:"spec" mapstructure:"spec"`
	StatusType[map[string]any] `yaml:",inline" mapstructure:",squash"`
}

AnyResource is a resource not yet fully parsed and is the common structure of all Resources. The Spec, which is different for each kind of resource, is represented as a map[string]interface{} and can be further parsed using mapstructure. Use ParseResource or ParseResources to obtain a fully parsed Resource.

func AsAny added in v1.16.0

func AsAny(r Resource) (*AnyResource, error)

AsAny converts an arbitrary Resource to an AnyResource. It is mainly used for testing.

func ResourcesFromFile

func ResourcesFromFile(filename string) ([]*AnyResource, error)

ResourcesFromFile creates an io.Reader from reading the given file and uses unmarshalResources to return a slice of *AnyResource read from the file.

func ResourcesFromReader

func ResourcesFromReader(reader io.Reader) ([]*AnyResource, error)

ResourcesFromReader creates a yaml decoder from an io.Reader and returns a slice of *AnyResource and an error. If the decoder is able to reach the end of the reader with no error, err will be nil.

func (*AnyResource) GetResourceMeta added in v1.16.0

func (r *AnyResource) GetResourceMeta() ResourceMeta

GetResourceMeta returns the ResourceMeta for this resource.

func (*AnyResource) GetSpec added in v1.16.0

func (r *AnyResource) GetSpec() any

GetSpec returns the spec for this resource.

func (*AnyResource) MaskSensitiveParameters added in v1.19.0

func (r *AnyResource) MaskSensitiveParameters(ctx context.Context)

MaskSensitiveParameters masks sensitive parameter values based on the ParameterDefinitions in the ResourceType

func (*AnyResource) PreserveSensitiveParameters added in v1.19.0

func (r *AnyResource) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error

PreserveSensitiveParameters will replace parameters with the SensitiveParameterPlaceholder value with the value of the parameter from the existing resource. This does nothing if existing is nil because there is no existing resource.

func (*AnyResource) Scan added in v1.16.0

func (r *AnyResource) Scan(value interface{}) error

Scan is used to translate from a JSONB field in postgres to AnyResource

func (AnyResource) Value added in v1.16.0

func (r AnyResource) Value() (driver.Value, error)

Value is used to translate to a JSONB field for postgres storage

type AnyResourceStatus

type AnyResourceStatus struct {
	Resource AnyResource  `json:"resource" mapstructure:"resource"`
	Status   UpdateStatus `json:"status" mapstructure:"status"`
	Reason   string       `json:"reason" mapstructure:"reason"`
}

AnyResourceStatus is used by the cli to parse response from the rest api.

func (*AnyResourceStatus) Message

func (s *AnyResourceStatus) Message() string

Message returns the summary of the ResourceStatus, e.g. "exporter updated"

type ApplyPayload

type ApplyPayload struct {
	Resources []*AnyResource `json:"resources"`
}

ApplyPayload is the REST API body for POST /v1/apply

type ApplyResponse

type ApplyResponse struct {
	Updates []ResourceStatus `json:"updates"`
}

ApplyResponse is the REST API response to POST /v1/apply. This is used on the server side to return updates consisting of generic ResourceStatuses.

type ApplyResponseClientSide

type ApplyResponseClientSide struct {
	Updates []*AnyResourceStatus `json:"updates"`
}

ApplyResponseClientSide is the REST API Response. This is used on the client side where updates consists of AnyResourceStatuses.

type AwsCloudWatchNamedFieldItem added in v1.5.0

type AwsCloudWatchNamedFieldItem struct {
	ID       string   `mapstructure:"id" yaml:"id,omitempty"`
	Names    []string `mapstructure:"names" yaml:"names,omitempty"`
	Prefixes []string `mapstructure:"prefixes" yaml:"prefixes,omitempty"`
}

AwsCloudWatchNamedFieldItem is the specified log group name which holds custom stream prefix and name filters

type BulkAgentLabelsPayload

type BulkAgentLabelsPayload struct {
	IDs       []string          `json:"ids"`
	Labels    map[string]string `json:"labels"`
	Overwrite bool              `json:"overwrite"`
}

BulkAgentLabelsPayload is the REST API body for PATCH /v1/agents/labels

type BulkAgentLabelsResponse

type BulkAgentLabelsResponse struct {
	Errors []string `json:"errors"`
}

BulkAgentLabelsResponse is the REST API response to PATCH /v1/agents/labels

type CloudWatchNamedFieldValue added in v1.5.0

type CloudWatchNamedFieldValue []AwsCloudWatchNamedFieldItem

CloudWatchNamedFieldValue is type for storing multiple instances of named log groups

type Configuration

type Configuration struct {
	// ResourceMeta contains the metadata for this resource
	ResourceMeta `yaml:",inline" mapstructure:",squash"`
	// Spec contains the spec for the Configuration
	Spec                            ConfigurationSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
	StatusType[ConfigurationStatus] `yaml:",inline" mapstructure:",squash"`
}

Configuration is the resource for the entire agent configuration

func NewConfiguration

func NewConfiguration(name string) *Configuration

NewConfiguration creates a new configuration with the specified name

func NewConfigurationWithSpec

func NewConfigurationWithSpec(name string, spec ConfigurationSpec) *Configuration

NewConfigurationWithSpec creates a new configuration with the specified name and spec

func NewRawConfiguration

func NewRawConfiguration(name string, raw string) *Configuration

NewRawConfiguration creates a new configuration with the specified name and raw configuration

func (*Configuration) AgentSelector

func (c *Configuration) AgentSelector() Selector

AgentSelector returns the Selector for this configuration that can be used to match this resource to agents.

func (*Configuration) Duplicate added in v1.0.0

func (c *Configuration) Duplicate(name string) *Configuration

Duplicate copies the value of the current configuration and returns a duplicate with the new name. It should be identical except for the Metadata.Name, Metadata.ID, and Spec.Selector fields.

func (*Configuration) GetKind

func (c *Configuration) GetKind() Kind

GetKind returns "Configuration"

func (*Configuration) GetSpec added in v1.16.0

func (c *Configuration) GetSpec() any

GetSpec returns the spec for this resource.

func (*Configuration) Graph added in v1.3.0

func (c *Configuration) Graph(ctx context.Context, store ResourceStore) (*graph.Graph, error)

Graph returns a graph representing the topology of a configuration

func (*Configuration) IndexFields

func (c *Configuration) IndexFields(index modelSearch.Indexer)

IndexFields returns a map of field name to field value to be stored in the index

func (*Configuration) IsForAgent

func (c *Configuration) IsForAgent(agent *Agent) bool

IsForAgent returns true if this configuration matches a given agent's labels.

func (*Configuration) MaskSensitiveParameters added in v1.19.0

func (c *Configuration) MaskSensitiveParameters(ctx context.Context)

MaskSensitiveParameters masks sensitive parameter values based on the ParameterDefinitions in the ResourceType

func (*Configuration) PreserveSensitiveParameters added in v1.19.0

func (c *Configuration) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error

PreserveSensitiveParameters will replace parameters with the SensitiveParameterPlaceholder value with the value of the parameter from the existing resource. This does nothing if existing is nil because there is no existing resource.

func (*Configuration) PrintableFieldTitles

func (c *Configuration) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Configuration) PrintableFieldValue

func (c *Configuration) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Configuration) PrintableVersionFieldTitles added in v1.16.0

func (c *Configuration) PrintableVersionFieldTitles() []string

PrintableVersionFieldTitles is used when printing the version history

func (*Configuration) Render

func (c *Configuration) Render(ctx context.Context, agent *Agent, bindPlaneURL string, bindPlaneInsecureSkipVerify bool, store ResourceStore, headers map[string]string) (string, error)

Render converts the Configuration model to a configuration yaml that can be sent to an agent. The specified Agent can be nil if this configuration is not being rendered for a specific agent.

func (*Configuration) Rollout added in v1.16.0

func (c *Configuration) Rollout() *Rollout

Rollout returns the rollout status for the configuration. It also ensures that the Name field of the Rollout is set to match the Configuration.

func (*Configuration) Type

func (c *Configuration) Type() ConfigurationType

Type returns the ConfigurationType. It is based on the presence of the Raw, Sources, and Destinations fields.

func (*Configuration) UpdateDependencies added in v1.16.0

func (c *Configuration) UpdateDependencies(ctx context.Context, store ResourceStore) error

UpdateDependencies updates the dependencies for this resource to use the latest version.

func (*Configuration) Usage added in v1.3.0

Usage returns a PipelineTypeUsage struct which contains information about the active and supported telemetry types on a configuration.

func (*Configuration) Validate

func (c *Configuration) Validate() (warnings string, errors error)

Validate validates most of the configuration, but if a store is available, ValidateWithStore should be used to validate the sources and destinations.

func (*Configuration) ValidateWithStore

func (c *Configuration) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the configuration is valid, returning an error if it is not. It uses the store to retrieve source types and destination types so that parameter values can be validated against the parameter definitions.

type ConfigurationResponse

type ConfigurationResponse struct {
	Configuration *Configuration `json:"configuration"`
	Raw           string         `json:"raw"`
}

ConfigurationResponse is the REST API response to GET /v1/configuration/:name

type ConfigurationSpec

type ConfigurationSpec struct {
	ContentType         string                  `json:"contentType" yaml:"contentType" mapstructure:"contentType"`
	MeasurementInterval string                  `json:"measurementInterval" yaml:"measurementInterval" mapstructure:"measurementInterval"`
	Raw                 string                  `json:"raw,omitempty" yaml:"raw,omitempty" mapstructure:"raw"`
	Sources             []ResourceConfiguration `json:"sources,omitempty" yaml:"sources,omitempty" mapstructure:"sources"`
	Destinations        []ResourceConfiguration `json:"destinations,omitempty" yaml:"destinations,omitempty" mapstructure:"destinations"`
	Selector            AgentSelector           `json:"selector" yaml:"selector" mapstructure:"selector"`
}

ConfigurationSpec is the spec for a configuration resource

type ConfigurationStatus added in v1.16.0

type ConfigurationStatus struct {
	// Rollout contains status for the rollout of this configuration
	Rollout Rollout `json:"rollout,omitempty" yaml:"rollout,omitempty" mapstructure:"rollout"`

	// CurrentVersion is the version of the configuration that has most recently completed a rollout
	CurrentVersion Version `json:"currentVersion,omitempty" yaml:"currentVersion,omitempty" mapstructure:"currentVersion"`

	// PendingVersion will be set to the version of a rollout that is in progress. It will be set to 0 when the rollout
	// completes.
	PendingVersion Version `json:"pendingVersion,omitempty" yaml:"pendingVersion,omitempty" mapstructure:"pendingVersion"`

	// Latest will be set to true on read if the configuration is the latest version
	Latest bool `json:"latest,omitempty" yaml:"latest,omitempty" mapstructure:"latest"`

	// Pending will be set to true on read if the configuration is the pending version
	Pending bool `json:"pending,omitempty" yaml:"pending,omitempty" mapstructure:"pending"`

	// Current will be set to true on read if the configuration is the current version
	Current bool `json:"current,omitempty" yaml:"current,omitempty" mapstructure:"current"`
}

ConfigurationStatus is the status for a configuration resource

type ConfigurationType

type ConfigurationType string

ConfigurationType indicates the kind of configuration. It is based on the presence of the Raw, Sources, and Destinations fields.

const (
	// ConfigurationTypeRaw configurations have a configuration in the Raw field that is passed directly to the agent.
	ConfigurationTypeRaw ConfigurationType = "raw"

	// ConfigurationTypeModular configurations have Sources and Destinations that are used to generate the configuration to pass to an agent.
	ConfigurationTypeModular ConfigurationType = "modular"
)

type ConfigurationVersions added in v1.16.0

type ConfigurationVersions struct {
	// Current is the configuration currently applied to the agent.
	Current string `json:"current,omitempty" yaml:"current,omitempty" db:"current_configuration"`

	// Pending is the configuration that is assigned to the agent but may not be applied. Once this configuration is
	// confirmed, Current will be set to this value and this will be cleared.
	Pending string `json:"pending,omitempty" yaml:"pending,omitempty" db:"pending_configuration"`

	// Future is the configuration that will be assigned to this agent when the rollout assigns the new configuration to
	// the agent. Once the rollout assigns the configuration, Pending will be set to this value and this will be cleared.
	Future string `json:"future,omitempty" yaml:"future,omitempty" db:"future_configuration"`
}

ConfigurationVersions tracks the current, pending, and future configurations for this agent. format: <configuration name>:<version>

func (*ConfigurationVersions) Clear added in v1.16.0

func (cv *ConfigurationVersions) Clear()

Clear clears the configuration versions, setting them all to ""

func (*ConfigurationVersions) ClearRollout added in v1.16.0

func (cv *ConfigurationVersions) ClearRollout()

ClearRollout clears the Pending and Future configuration versions.

func (*ConfigurationVersions) Set added in v1.16.0

func (cv *ConfigurationVersions) Set(current, pending, future string)

Set is a convenience method to set current, pending, and future configuration versions

type ConfigurationsResponse

type ConfigurationsResponse struct {
	Configurations []*Configuration `json:"configurations"`
}

ConfigurationsResponse is the REST API response to GET /v1/configurations

type DeleteAgentsPayload

type DeleteAgentsPayload struct {
	IDs []string `json:"ids"`
}

DeleteAgentsPayload is the REST API body to DELETE /v1/agents

type DeleteAgentsResponse

type DeleteAgentsResponse = AgentsResponse

DeleteAgentsResponse is the REST API response to DELETE /v1/agents

type DeletePayload

type DeletePayload struct {
	Resources []*AnyResource `json:"resources"`
}

DeletePayload is the REST API body for POST /v1/delete. Though resources with full Spec can be included its only necessary for the Kind and Metadata.Name fields to be present.

type DeleteResponse

type DeleteResponse struct {
	Errors  []string         `json:"errors"`
	Updates []ResourceStatus `json:"updates"`
}

DeleteResponse is the REST API response to POST /v1/delete

type DeleteResponseClientSide

type DeleteResponseClientSide struct {
	Errors  []string             `json:"errors"`
	Updates []*AnyResourceStatus `json:"updates"`
}

DeleteResponseClientSide is the REST API response to POST /v1/delete

type Destination

type Destination struct {
	// ResourceMeta is the metadata for the Destination
	ResourceMeta `yaml:",inline" mapstructure:",squash"`
	// Spec is the specification for the Destination containing the type and parameters
	Spec                      ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
	StatusType[VersionStatus] `yaml:",inline" mapstructure:",squash"`
}

Destination will generate an exporter and be at the end of a pipeline

func FindDestination

func FindDestination(ctx context.Context, destination *ResourceConfiguration, defaultName string, store ResourceStore) (*Destination, error)

FindDestination returns a Destination from the store if it exists. If it doesn't exist, it creates a new Destination with the specified defaultName.

func NewDestination

func NewDestination(name string, typeValue string, parameters []Parameter) *Destination

NewDestination creates a new Destination with the specified name, type, and parameters

func NewDestinationWithSpec

func NewDestinationWithSpec(name string, spec ParameterizedSpec) *Destination

NewDestinationWithSpec creates a new Destination with the specified spec

func (*Destination) ComponentID

func (d *Destination) ComponentID(name string) otel.ComponentID

ComponentID provides a unique component id for the specified component name

func (*Destination) GetKind

func (d *Destination) GetKind() Kind

GetKind returns "Destination"

func (*Destination) GetSpec added in v1.16.0

func (d *Destination) GetSpec() any

GetSpec returns the spec for this resource.

func (*Destination) MaskSensitiveParameters added in v1.19.0

func (d *Destination) MaskSensitiveParameters(ctx context.Context)

MaskSensitiveParameters masks sensitive parameter values based on the ParameterDefinitions in the ResourceType

func (*Destination) PreserveSensitiveParameters added in v1.19.0

func (d *Destination) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error

PreserveSensitiveParameters will replace parameters with the SensitiveParameterPlaceholder value with the value of the parameter from the existing resource. This does nothing if existing is nil because there is no existing resource.

func (*Destination) PrintableFieldTitles

func (d *Destination) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Destination) PrintableFieldValue

func (d *Destination) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Destination) ResourceParameters

func (d *Destination) ResourceParameters() []Parameter

ResourceParameters are the parameters passed to the ResourceType to generate the configuration

func (*Destination) ResourceTypeName

func (d *Destination) ResourceTypeName() string

ResourceTypeName is the name of the ResourceType that renders this resource type

func (*Destination) UpdateDependencies added in v1.16.0

func (d *Destination) UpdateDependencies(ctx context.Context, store ResourceStore) error

UpdateDependencies updates the dependencies for this resource to use the latest version.

func (*Destination) ValidateWithStore

func (d *Destination) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the destination is valid, returning an error if it is not. It uses the store to retrieve the destination type so that parameter values can be validated against the parameter definitions.

type DestinationResponse

type DestinationResponse struct {
	Destination *Destination `json:"destination"`
}

DestinationResponse is the REST API response to GET /v1/destinations/:name

type DestinationType

type DestinationType struct {
	ResourceType `yaml:",inline" mapstructure:",squash"`
}

DestinationType is a ResourceType used to define destinations

func NewDestinationType

func NewDestinationType(name string, parameters []ParameterDefinition) *DestinationType

NewDestinationType creates a new destination-type with the specified name,

func NewDestinationTypeWithSpec

func NewDestinationTypeWithSpec(name string, spec ResourceTypeSpec) *DestinationType

NewDestinationTypeWithSpec creates a new destination-type with the specified name and spec.

func (*DestinationType) GetKind

func (d *DestinationType) GetKind() Kind

GetKind returns "DestinationType"

type DestinationTypeResponse

type DestinationTypeResponse struct {
	DestinationType *DestinationType `json:"destinationType"`
}

DestinationTypeResponse is the REST API response to GET /v1/destinationType/:name

type DestinationTypesResponse

type DestinationTypesResponse struct {
	DestinationTypes []*DestinationType `json:"destinationTypes"`
}

DestinationTypesResponse is the REST API response to GET /v1/destinationTypes

type DestinationsResponse

type DestinationsResponse struct {
	Destinations []*Destination `json:"destinations"`
}

DestinationsResponse is the REST API response to GET /v1/destinations

type DocumentationLink struct {
	Text string `json:"text" yaml:"text"`
	URL  string `json:"url" yaml:"url"`
}

DocumentationLink contains the text and url for documentation of a ParameterDefinition

type ErrorResponse added in v1.0.0

type ErrorResponse struct {
	Errors []string `json:"errors"`
}

ErrorResponse is the expected response when receiving non 2xx status codes.

type HasAgentSelector

type HasAgentSelector interface {
	// AgentSelector returns the agent selector
	AgentSelector() Selector
	// IsForAgent returns true if the resource is for the given agent
	IsForAgent(agent *Agent) bool
}

HasAgentSelector is an interface for resources that have an agent selector

type HasResourceParameters added in v1.19.0

type HasResourceParameters interface {
	// Parameters returns the parameters for this resource
	ResourceParameters() []Parameter
}

HasResourceParameters returns true for any resource with parameters. This includes top-level resources like Sources, Processors, and Destinations and embedded resources within Configurations.

type HasSensitiveParameters added in v1.19.0

type HasSensitiveParameters interface {
	// MaskSensitiveParameters masks sensitive parameter values based on the ParameterDefinitions in the ResourceType
	MaskSensitiveParameters(ctx context.Context)

	// PreserveSensitiveParameters will replace parameters with the SensitiveParameterPlaceholder value with the value of
	// the parameter from the existing resource. This does nothing if existing is nil because there is no existing
	// resource.
	PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error
}

HasSensitiveParameters is an interface for resources that can have sensitive parameters

type HasUniqueKey

type HasUniqueKey interface {
	UniqueKey() string
}

HasUniqueKey is an interface that provides access to a unique key for an item. For Agents this is the ID and for Resources this is the Name.

type HistoryResponse added in v1.16.0

type HistoryResponse struct {
	Versions []*AnyResource `json:"versions"`
}

HistoryResponse is the REST API response to GET /v1/:kind/:name/history

type InstallCommandResponse

type InstallCommandResponse struct {
	Command string `json:"command"`
}

InstallCommandResponse is the REST API response to GET /v1/agent-versions/{version}/install-command

type Kind

type Kind string

Kind indicates the kind of resource, e.g. Configuration

const (
	KindProfile         Kind = "Profile"
	KindContext         Kind = "Context"
	KindConfiguration   Kind = "Configuration"
	KindAgent           Kind = "Agent"
	KindAgentVersion    Kind = "AgentVersion"
	KindSource          Kind = "Source"
	KindProcessor       Kind = "Processor"
	KindDestination     Kind = "Destination"
	KindSourceType      Kind = "SourceType"
	KindProcessorType   Kind = "ProcessorType"
	KindDestinationType Kind = "DestinationType"
	KindUnknown         Kind = "Unknown"
	KindRollout         Kind = "Rollout"
)

Kind values correspond to the kinds of resources currently supported by BindPlane

func ParseKind

func ParseKind(kind string) Kind

ParseKind parses a kind from a specified string parameter, validating that it matches an existing kind. It ignores the case of the string parameter and also allows plurals, e.g. configurations => KindConfiguration. KindUnknown is returned if that specified kind does not match any known Kinds.

type Labeled

type Labeled interface {
	// GetLabels returns the labels for the resource
	GetLabels() Labels
	// SetLabels sets the labels for the resource
	SetLabels(l Labels)
}

Labeled is used for filtering resources by labels

type Labels

type Labels struct {
	labels.Set `json:"-" yaml:",inline"`
}

Labels is a wrapper around Kubernetes labels.Set struct, which is just a type definition for map[string]string.

func LabelsFromMap

func LabelsFromMap(labels map[string]string) (Labels, error)

LabelsFromMap will create a set of labels from a map of name/value pairs. It will validate that the names and values conform to the requirements, matching those of kubernetes labels. See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/. Valid labels will be added to the Labels returned and any invalid labels will produce an error. This makes it possible for callers to ignore the errors and accept any valid values specified.

func LabelsFromMerge

func LabelsFromMerge(existing, new Labels) Labels

LabelsFromMerge merges new labels into existing labels. Any labels with blank values in the merged labels will be removed

func LabelsFromSelector

func LabelsFromSelector(selector string) (Labels, error)

LabelsFromSelector will create a set of labels from a selector string.

func LabelsFromValidatedMap

func LabelsFromValidatedMap(labels map[string]string) Labels

LabelsFromValidatedMap returns a set of labels from map that is assumed to already be validated.

func MakeLabels

func MakeLabels() Labels

MakeLabels returns a new, empty Labels object

func (*Labels) AsMap

func (l *Labels) AsMap() map[string]string

AsMap returns the labels as a map of name/value pairs

func (Labels) BindPlane

func (l Labels) BindPlane() Labels

BindPlane returns the BindPlane labels, i.e. labels starting with "bindplane/"

func (Labels) Conflicts

func (l Labels) Conflicts(o Labels) bool

Conflicts returns true if the specified set of labels has a label with the same name as this set of labels but with a different value.

func (Labels) Custom

func (l Labels) Custom() Labels

Custom returns the custom labels, i.e. labels not starting with "bindplane/"

func (*Labels) MarshalJSON

func (l *Labels) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Labels as jsoniter. An empty Labels will be marshalled as `{}`

func (*Labels) Scan added in v1.16.0

func (l *Labels) Scan(value interface{}) error

Scan is used to translate from a JSONB field in postgres to ResourceType

func (*Labels) UnmarshalJSON

func (l *Labels) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals JSON bytes into the Label's internal Set

func (Labels) Value added in v1.16.0

func (l Labels) Value() (driver.Value, error)

Value is used to translate to a JSONB field for postgres storage

type ManagerTLS added in v1.13.0

type ManagerTLS struct {
	InsecureSkipVerify bool    `json:"insecure_skip_verify,omitempty" yaml:"insecure_skip_verify,omitempty"`
	CAFile             *string `json:"ca_file,omitempty" yaml:"ca_file,omitempty"`
	CertFile           *string `json:"cert_file,omitempty" yaml:"cert_file,omitempty"`
	KeyFile            *string `json:"key_file,omitempty" yaml:"key_file,omitempty"`
}

ManagerTLS are the TLS settings for the agent when connecting to BPOP

type MatchLabels

type MatchLabels map[string]string

MatchLabels represents the labels used to match Pipelines with Agents.

type MeasurementPosition added in v1.3.0

type MeasurementPosition string

MeasurementPosition is a position within the graph of the measurements processor

const (
	// MeasurementPositionSourceBeforeProcessors is the initial throughput of the source
	MeasurementPositionSourceBeforeProcessors MeasurementPosition = "s0"

	// MeasurementPositionSourceAfterProcessors is the throughput after source processors
	MeasurementPositionSourceAfterProcessors MeasurementPosition = "s1"

	// MeasurementPositionDestinationBeforeProcessors is the throughput to the destination (from all sources) before
	// destination processors
	MeasurementPositionDestinationBeforeProcessors MeasurementPosition = "d0"

	// MeasurementPositionDestinationAfterProcessors is the throughput to the destination (from all sources) after
	// destination processors
	MeasurementPositionDestinationAfterProcessors MeasurementPosition = "d1"
)

type Metadata

type Metadata struct {
	ID          string `yaml:"id,omitempty" json:"id" mapstructure:"id"`
	Name        string `yaml:"name,omitempty" json:"name" mapstructure:"name"`
	DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty" mapstructure:"displayName"`
	Description string `yaml:"description,omitempty" json:"description,omitempty" mapstructure:"description"`
	Icon        string `yaml:"icon,omitempty" json:"icon,omitempty" mapstructure:"icon"`
	Labels      Labels `yaml:"labels,omitempty" json:"labels" mapstructure:"labels"`

	// Hash is a hex formatted sha256 Hash of the json-encoded spec that is used to determine if the spec has changed.
	Hash string `yaml:"hash,omitempty" json:"hash,omitempty" mapstructure:"hash"`

	// Version is a 1-based integer that is incremented each time the spec is changed.
	Version      Version    `yaml:"version,omitempty" json:"version,omitempty" mapstructure:"version"`
	DateModified *time.Time `yaml:"dateModified,omitempty" json:"dateModified,omitempty" mapstructure:"dateModified"`

	// Deprecated indicates that this resource is deprecated and should not be used. Deprecated resources should contain
	// additional information about why the resource is deprecated and what should be used instead.
	Deprecated bool `yaml:"deprecated,omitempty" json:"deprecated,omitempty" mapstructure:"deprecated"`

	AdditionalInfo *AdditionalInfo `yaml:"additionalInfo,omitempty" json:"additionalInfo,omitempty" mapstructure:"additionalInfo"`
}

Metadata is the metadata about a resource

type MetricCategory added in v1.1.0

type MetricCategory struct {
	Label string `json:"label" yaml:"label"`
	// 0 or 1
	Column int `json:"column" yaml:"column"`

	Metrics []MetricOption `json:"metrics" yaml:"metrics"`
}

MetricCategory consists of the label, optional column, and metrics for a metricsType Parameter

type MetricOption added in v1.1.0

type MetricOption struct {
	Name            string  `json:"name" yaml:"name"`
	Description     *string `json:"description" yaml:"description"`
	KPI             *bool   `json:"kpi" yaml:"kpi"`
	DefaultDisabled bool    `json:"defaultDisabled" yaml:"defaultDisabled"`
}

MetricOption is an individual metric that can be specified for a metricsType Parameter

type MockResourceStore added in v1.16.0

type MockResourceStore struct {
	mock.Mock
}

MockResourceStore is an autogenerated mock type for the ResourceStore type

func NewMockResourceStore added in v1.16.0

func NewMockResourceStore(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockResourceStore

NewMockResourceStore creates a new instance of MockResourceStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockResourceStore) Destination added in v1.16.0

func (_m *MockResourceStore) Destination(ctx context.Context, name string) (*Destination, error)

Destination provides a mock function with given fields: ctx, name

func (*MockResourceStore) DestinationType added in v1.16.0

func (_m *MockResourceStore) DestinationType(ctx context.Context, name string) (*DestinationType, error)

DestinationType provides a mock function with given fields: ctx, name

func (*MockResourceStore) EXPECT added in v1.16.0

func (*MockResourceStore) Processor added in v1.16.0

func (_m *MockResourceStore) Processor(ctx context.Context, name string) (*Processor, error)

Processor provides a mock function with given fields: ctx, name

func (*MockResourceStore) ProcessorType added in v1.16.0

func (_m *MockResourceStore) ProcessorType(ctx context.Context, name string) (*ProcessorType, error)

ProcessorType provides a mock function with given fields: ctx, name

func (*MockResourceStore) Source added in v1.16.0

func (_m *MockResourceStore) Source(ctx context.Context, name string) (*Source, error)

Source provides a mock function with given fields: ctx, name

func (*MockResourceStore) SourceType added in v1.16.0

func (_m *MockResourceStore) SourceType(ctx context.Context, name string) (*SourceType, error)

SourceType provides a mock function with given fields: ctx, name

type MockResourceStore_DestinationType_Call added in v1.16.0

type MockResourceStore_DestinationType_Call struct {
	*mock.Call
}

MockResourceStore_DestinationType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DestinationType'

func (*MockResourceStore_DestinationType_Call) Return added in v1.16.0

func (*MockResourceStore_DestinationType_Call) Run added in v1.16.0

func (*MockResourceStore_DestinationType_Call) RunAndReturn added in v1.16.0

type MockResourceStore_Destination_Call added in v1.16.0

type MockResourceStore_Destination_Call struct {
	*mock.Call
}

MockResourceStore_Destination_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Destination'

func (*MockResourceStore_Destination_Call) Return added in v1.16.0

func (*MockResourceStore_Destination_Call) Run added in v1.16.0

func (*MockResourceStore_Destination_Call) RunAndReturn added in v1.16.0

type MockResourceStore_Expecter added in v1.16.0

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

func (*MockResourceStore_Expecter) Destination added in v1.16.0

func (_e *MockResourceStore_Expecter) Destination(ctx interface{}, name interface{}) *MockResourceStore_Destination_Call

Destination is a helper method to define mock.On call

  • ctx context.Context
  • name string

func (*MockResourceStore_Expecter) DestinationType added in v1.16.0

func (_e *MockResourceStore_Expecter) DestinationType(ctx interface{}, name interface{}) *MockResourceStore_DestinationType_Call

DestinationType is a helper method to define mock.On call

  • ctx context.Context
  • name string

func (*MockResourceStore_Expecter) Processor added in v1.16.0

func (_e *MockResourceStore_Expecter) Processor(ctx interface{}, name interface{}) *MockResourceStore_Processor_Call

Processor is a helper method to define mock.On call

  • ctx context.Context
  • name string

func (*MockResourceStore_Expecter) ProcessorType added in v1.16.0

func (_e *MockResourceStore_Expecter) ProcessorType(ctx interface{}, name interface{}) *MockResourceStore_ProcessorType_Call

ProcessorType is a helper method to define mock.On call

  • ctx context.Context
  • name string

func (*MockResourceStore_Expecter) Source added in v1.16.0

func (_e *MockResourceStore_Expecter) Source(ctx interface{}, name interface{}) *MockResourceStore_Source_Call

Source is a helper method to define mock.On call

  • ctx context.Context
  • name string

func (*MockResourceStore_Expecter) SourceType added in v1.16.0

func (_e *MockResourceStore_Expecter) SourceType(ctx interface{}, name interface{}) *MockResourceStore_SourceType_Call

SourceType is a helper method to define mock.On call

  • ctx context.Context
  • name string

type MockResourceStore_ProcessorType_Call added in v1.16.0

type MockResourceStore_ProcessorType_Call struct {
	*mock.Call
}

MockResourceStore_ProcessorType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessorType'

func (*MockResourceStore_ProcessorType_Call) Return added in v1.16.0

func (*MockResourceStore_ProcessorType_Call) Run added in v1.16.0

func (*MockResourceStore_ProcessorType_Call) RunAndReturn added in v1.16.0

type MockResourceStore_Processor_Call added in v1.16.0

type MockResourceStore_Processor_Call struct {
	*mock.Call
}

MockResourceStore_Processor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Processor'

func (*MockResourceStore_Processor_Call) Return added in v1.16.0

func (*MockResourceStore_Processor_Call) Run added in v1.16.0

func (*MockResourceStore_Processor_Call) RunAndReturn added in v1.16.0

type MockResourceStore_SourceType_Call added in v1.16.0

type MockResourceStore_SourceType_Call struct {
	*mock.Call
}

MockResourceStore_SourceType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SourceType'

func (*MockResourceStore_SourceType_Call) Return added in v1.16.0

func (*MockResourceStore_SourceType_Call) Run added in v1.16.0

func (*MockResourceStore_SourceType_Call) RunAndReturn added in v1.16.0

type MockResourceStore_Source_Call added in v1.16.0

type MockResourceStore_Source_Call struct {
	*mock.Call
}

MockResourceStore_Source_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Source'

func (*MockResourceStore_Source_Call) Return added in v1.16.0

func (*MockResourceStore_Source_Call) Run added in v1.16.0

func (*MockResourceStore_Source_Call) RunAndReturn added in v1.16.0

type NoStatus added in v1.16.0

type NoStatus struct {
}

NoStatus is a placeholder for resources that do not have a status

type Parameter

type Parameter struct {
	// Name is the name of the parameter
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// Value could be any of the following: string, bool, int, enum (string), float, []string, map
	Value interface{} `json:"value" yaml:"value" mapstructure:"value"`

	// Sensitive will be true if the value is sensitive and should be masked when printed.
	Sensitive bool `json:"sensitive,omitempty" yaml:"sensitive,omitempty" mapstructure:"sensitive"`
}

Parameter is a field that can be set by the user when creating a resource

type ParameterDefinition

type ParameterDefinition struct {
	Name        string `json:"name" yaml:"name"`
	Label       string `json:"label" yaml:"label"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Required    bool   `json:"required,omitempty" yaml:"required,omitempty"`

	// "string", "int", "bool", "strings", or "enum"
	Type string `json:"type" yaml:"type"`

	// only useable if Type == "enum"
	ValidValues []string `json:"validValues,omitempty" yaml:"validValues,omitempty" mapstructure:"validValues"`

	// Must be valid according to Type & ValidValues
	Default        interface{}           `json:"default,omitempty" yaml:"default,omitempty"`
	RelevantIf     []RelevantIfCondition `json:"relevantIf,omitempty" yaml:"relevantIf,omitempty" mapstructure:"relevantIf"`
	Hidden         bool                  `json:"hidden,omitempty" yaml:"hidden,omitempty"`
	AdvancedConfig bool                  `json:"advancedConfig,omitempty" yaml:"advancedConfig,omitempty" mapstructure:"advancedConfig"`

	Options ParameterOptions `json:"options,omitempty" yaml:"options,omitempty"`

	Documentation []DocumentationLink `json:"documentation,omitempty" yaml:"documentation,omitempty"`
}

ParameterDefinition is a basic description of a definition's parameter. This implementation comes directly from stanza plugin parameters with slight modifications for mapstructure.

type ParameterOptions added in v1.0.0

type ParameterOptions struct {
	// Creatable will modify the "enum" parameter from a select to
	// a creatable select where a user can specify a custom value
	Creatable bool `json:"creatable,omitempty" yaml:"creatable,omitempty"`

	// TrackUnchecked will modify the "enums" parameter to store the
	// unchecked values as the value.
	TrackUnchecked bool `json:"trackUnchecked,omitempty" yaml:"trackUnchecked,omitempty"`

	// GridColumns will specify the number of flex-grid columns the
	// control will take up, must be an integer between 1 and 12 or
	// unspecified.
	GridColumns *int `json:"gridColumns,omitempty" yaml:"gridColumns,omitempty"`

	// SectionHeader is used to indicate that the bool parameter input is
	// a switch for further configuration for UI styling.
	SectionHeader *bool `json:"sectionHeader,omitempty" yaml:"sectionHeader,omitempty"`

	MetricCategories []MetricCategory `json:"metricCategories,omitempty" yaml:"metricCategories,omitempty"`

	// Multiline indicates that a multiline textarea should be used for editing a "string" parameter.
	Multiline bool `json:"multiline,omitempty" yaml:"multiline,omitempty"`

	// Labels indicate labels that can be used when rendering the parameter. This was added for the "map" parameter type
	// to make the "key" and "value" labels configurable.
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`

	// Password indicates the string field is for a password and will be hidden by the UI.
	// Only applies to string parameters.
	// Deprecated, use Sensitive instead.
	Password bool `json:"password,omitempty" yaml:"password,omitempty"`

	// Sensitive indicates that the field is sensitive and will be masked with (sensitive) in the response.
	Sensitive bool `json:"sensitive,omitempty" yaml:"sensitive,omitempty"`

	// SubHeader will place a subheader above the parameter.
	SubHeader string `json:"subHeader,omitempty" yaml:"subHeader,omitempty"`

	// HorizontalDivider will add a horizontal divider after the parameter at full
	// width of the form.
	HorizontalDivider bool `json:"horizontalDivider,omitempty" yaml:"horizontalDivider,omitempty"`
}

ParameterOptions specify further customization for input parameters

type ParameterizedSpec

type ParameterizedSpec struct {
	Type       string      `yaml:"type,omitempty" json:"type,omitempty" mapstructure:"type"`
	Parameters []Parameter `yaml:"parameters,omitempty" json:"parameters,omitempty" mapstructure:"parameters"`

	Processors []ResourceConfiguration `yaml:"processors,omitempty" json:"processors,omitempty" mapstructure:"processors"`
	Disabled   bool                    `yaml:"disabled,omitempty" json:"disabled,omitempty" mapstructure:"disabled"`
}

ParameterizedSpec is the spec for a ParameterizedResource

func (*ParameterizedSpec) ResourceParameters added in v1.19.0

func (s *ParameterizedSpec) ResourceParameters() []Parameter

ResourceParameters returns the parameters for this resource

type PatchAgentVersionsRequest added in v1.0.0

type PatchAgentVersionsRequest struct {
	Version string   `json:"version"`
	IDs     []string `json:"ids"`
}

PatchAgentVersionsRequest is the REST API body for PATCH /v1/agents/version

type PhaseAgentCount added in v1.16.0

type PhaseAgentCount struct {
	Initial    int     `json:"initial" yaml:"initial" mapstructure:"initial"`
	Multiplier float64 `json:"multiplier" yaml:"multiplier" mapstructure:"multiplier"`
	Maximum    int     `json:"maximum" yaml:"maximum" mapstructure:"maximum"`
}

PhaseAgentCount is the number of agents that will be updated in each phase of a rollout.

type PipelineTypeUsage added in v1.3.0

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

PipelineTypeUsage contains information about active telemetry on the Configuration and its sources and destinations.

func (*PipelineTypeUsage) ActiveFlags added in v1.3.0

func (p *PipelineTypeUsage) ActiveFlags() otel.PipelineTypeFlags

ActiveFlags returns the pipeline type flags that are in use by the configuration.

func (*PipelineTypeUsage) ActiveFlagsForDestination added in v1.3.0

func (p *PipelineTypeUsage) ActiveFlagsForDestination(name string) otel.PipelineTypeFlags

ActiveFlagsForDestination returns the PipelineTypeFlags that are active for a destination with given name.

type PostAgentVersionRequest

type PostAgentVersionRequest struct {
	Version string `json:"version"`
}

PostAgentVersionRequest is the REST API body for POST /v1/agents/{id}/version

type PostCopyConfigRequest added in v1.0.0

type PostCopyConfigRequest struct {
	// The intended name of the duplicated config
	Name string `json:"name"`
}

PostCopyConfigRequest is the REST API body for PUT /v1/configurations/{name}/copy

type PostCopyConfigResponse added in v1.0.0

type PostCopyConfigResponse = PostCopyConfigRequest

PostCopyConfigResponse is the REST API response to PUT /v1/configurations/{name}/copy

type Printable

type Printable interface {
	// PrintableKindSingular returns the singular form of the Kind, e.g. "Configuration"
	PrintableKindSingular() string

	// PrintableKindPlural returns the plural form of the Kind, e.g. "Configurations"
	PrintableKindPlural() string

	// PrintableFieldTitles returns the list of field titles, used for printing a table of resources
	PrintableFieldTitles() []string

	// PrintableFieldValue returns the field value for a title, used for printing a table of resources
	PrintableFieldValue(title string) string
}

Printable is implemented for resources so that they can be printed by the CLI.

type PrintableVersion added in v1.16.0

type PrintableVersion interface {
	// PrintableVersionFieldTitles returns the list of field titles to print for version history of a resource
	PrintableVersionFieldTitles() []string

	Printable
}

PrintableVersion can be implemented for resources that have custom fields to display with individual versions

type Processor added in v0.5.2

type Processor struct {
	// ResourceMeta is the metadata for the Processor
	ResourceMeta `yaml:",inline" mapstructure:",squash"`
	// Spec is the specification for the Processor containing the type and parameters
	Spec                      ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
	StatusType[VersionStatus] `yaml:",inline" mapstructure:",squash"`
}

Processor will generate an exporter and be at the end of a pipeline

func FindProcessor added in v0.5.2

func FindProcessor(ctx context.Context, processor *ResourceConfiguration, defaultName string, store ResourceStore) (*Processor, error)

FindProcessor returns a Processor from the store if it exists. If it doesn't exist, it creates a new Processor with the specified defaultName.

func NewProcessor added in v0.5.2

func NewProcessor(name string, processorTypeName string, parameters []Parameter) *Processor

NewProcessor creates a new Processor with the specified name, type, and parameters

func NewProcessorWithSpec added in v0.5.2

func NewProcessorWithSpec(name string, spec ParameterizedSpec) *Processor

NewProcessorWithSpec creates a new Processor with the specified spec

func (*Processor) ComponentID added in v0.5.2

func (s *Processor) ComponentID(name string) otel.ComponentID

ComponentID provides a unique component id for the specified component name

func (*Processor) GetKind added in v0.5.2

func (s *Processor) GetKind() Kind

GetKind returns "Processor"

func (*Processor) GetSpec added in v1.16.0

func (s *Processor) GetSpec() any

GetSpec returns the spec for this resource.

func (*Processor) MaskSensitiveParameters added in v1.19.0

func (s *Processor) MaskSensitiveParameters(ctx context.Context)

MaskSensitiveParameters masks sensitive parameter values based on the ParameterDefinitions in the ResourceType

func (*Processor) PreserveSensitiveParameters added in v1.19.0

func (s *Processor) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error

PreserveSensitiveParameters will replace parameters with the SensitiveParameterPlaceholder value with the value of the parameter from the existing resource. This does nothing if existing is nil because there is no existing resource.

func (*Processor) PrintableFieldTitles added in v0.5.2

func (s *Processor) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Processor) PrintableFieldValue added in v0.5.2

func (s *Processor) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Processor) ResourceParameters added in v0.5.2

func (s *Processor) ResourceParameters() []Parameter

ResourceParameters are the parameters passed to the ResourceType to generate the configuration

func (*Processor) ResourceTypeName added in v0.5.2

func (s *Processor) ResourceTypeName() string

ResourceTypeName is the name of the ResourceType that renders this resource type

func (*Processor) UpdateDependencies added in v1.16.0

func (s *Processor) UpdateDependencies(ctx context.Context, store ResourceStore) error

UpdateDependencies updates the dependencies for this resource to use the latest version.

func (*Processor) ValidateWithStore added in v0.5.2

func (s *Processor) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the processor is valid, returning an error if it is not. It uses the store to retrieve the processor type so that parameter values can be validated against the parameter definitions.

type ProcessorResponse added in v0.5.2

type ProcessorResponse struct {
	Processor *Processor `json:"processor"`
}

ProcessorResponse is the REST API response to GET /v1/processors/:name

type ProcessorType added in v0.5.2

type ProcessorType struct {
	ResourceType `yaml:",inline" mapstructure:",squash"`
}

ProcessorType is a ResourceType used to define sources

func NewProcessorType added in v0.5.2

func NewProcessorType(name string, parameters []ParameterDefinition) *ProcessorType

NewProcessorType creates a new processor-type with the specified name,

func NewProcessorTypeWithSpec added in v0.5.2

func NewProcessorTypeWithSpec(name string, spec ResourceTypeSpec) *ProcessorType

NewProcessorTypeWithSpec creates a new processor-type with the specified name and spec.

func (*ProcessorType) GetKind added in v0.5.2

func (s *ProcessorType) GetKind() Kind

GetKind returns "ProcessorType"

type ProcessorTypeResponse added in v0.5.2

type ProcessorTypeResponse struct {
	ProcessorType *ProcessorType `json:"processorType"`
}

ProcessorTypeResponse is the REST API response to GET /v1/processorType/:name

type ProcessorTypesResponse added in v0.5.2

type ProcessorTypesResponse struct {
	ProcessorTypes []*ProcessorType `json:"processorTypes"`
}

ProcessorTypesResponse is the REST API response to GET /v1/processorTypes

type ProcessorsResponse added in v0.5.2

type ProcessorsResponse struct {
	Processors []*Processor `json:"processors"`
}

ProcessorsResponse is the REST API response to GET /v1/processors

type RelevantIfCondition

type RelevantIfCondition struct {
	Name     string `json:"name" yaml:"name" mapstructure:"name"`
	Operator string `json:"operator" yaml:"operator" mapstructure:"operator"`
	Value    any    `json:"value" yaml:"value" mapstructure:"value"`
}

RelevantIfCondition specifies a condition under which a parameter is deemed relevant.

type Resource

type Resource interface {
	// all resources can be labeled
	Labeled

	// all resources can be indexed
	modelSearch.Indexed

	// all resources have a unique key
	HasUniqueKey

	// all resources can be printed
	Printable

	// Name returns the name for this resource
	Name() string

	// ID returns the uuid for this resource
	ID() string

	// SetID replaces the uuid for this resource
	SetID(id string)

	// EnsureID generates a new uuid for a resource if none exists
	EnsureID()

	// Version returns the version for this resource
	Version() Version

	// SetVersion replaces the version for this resource
	SetVersion(version Version)

	// Hash returns the hash of the resource spec
	Hash() string

	// EnsureHash generates a new hash for a resource if none exists. Hash is a hex formatted sha256 hash of the
	// json-encoded spec that is used to determine if the spec has changed.
	EnsureHash(spec any)

	// DateModified returns the date the resource was last modified
	DateModified() *time.Time

	// SetDateModified replaces the date the resource was last modified
	SetDateModified(date *time.Time)

	// EnsureMetadata ensures that the ID, Version, and Hash fields are set.
	EnsureMetadata(spec any)

	// GetKind returns the Kind of this resource
	GetKind() Kind

	// Description returns a description of the resource
	Description() string

	// Validate ensures that the resource is valid
	Validate() (warnings string, errors error)

	// ValidateWithStore ensures that the resource is valid and allows for extra validation given a store. It may also
	// make minor changes to the Resource, like ensuring references specify a specific version.
	ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

	// UpdateDependencies updates the dependencies for this resource to use the latest version.
	UpdateDependencies(ctx context.Context, store ResourceStore) error

	// GetSpec returns the spec for this resource. All resources have a spec, but the format and contents of the spec will
	// be different for different resource types.
	GetSpec() any

	// GetStatus returns the status for this resource. All resources have a status, but the format and contents of the
	// status will be different for different resource types.
	// Initially, used for rollout status of a configuration.
	GetStatus() any

	// SetStatus replaces the status for this resource.
	SetStatus(status any) error

	// IsLatest returns true if the latest field on the status for this resource is true. Currently this is only used for
	// Configurations, Sources, Processors, Destinations, SourceTypes, ProcessorTypes, and DestinationTypes. For other
	// resources this always returns true.
	IsLatest() bool

	// SetLatest sets the value of the latest field on the status for this resource. Currently this is only used for
	// Configurations, Sources, Processors, Destinations, SourceTypes, ProcessorTypes, and DestinationTypes. For other
	// resources this does nothing.
	SetLatest(latest bool)

	// IsPending returns true if the pending field on the status for this resource is true. Currently this is only used
	// for Configurations. For other resources this always returns false.
	IsPending() bool

	// SetPending sets the value of the pending field on the status for this resource. Currently this is only used for
	// Configurations. For other resources this does nothing.
	SetPending(pending bool)

	// IsCurrent returns true if the current field on the status for this resource is true. Currently this is only used
	// for Configurations. For other resources this always returns false.
	IsCurrent() bool

	// SetCurrent sets the value of the current field on the status for this resource. Currently this is only used for
	// Configurations. For other resources this does nothing.
	SetCurrent(current bool)

	// IsDeprecated returns true if the deprecated field on the status for this resource is true.
	IsDeprecated() bool
}

Resource is implemented by all resources, e.g. SourceType, DestinationType, Configuration, etc.

func NewEmptyResource

func NewEmptyResource(kind Kind) (Resource, error)

NewEmptyResource returns a new empty resource of the specified Kind

func NewEmptyVersionResource added in v1.16.0

func NewEmptyVersionResource(version string, kind Kind) (Resource, error)

NewEmptyVersionResource returns a new empty resource of the specified Kind

func ParseResource

func ParseResource(r *AnyResource) (Resource, error)

ParseResource parses an AnyResource into a Resource

func ParseResourceStrict added in v1.15.0

func ParseResourceStrict(r *AnyResource) (Resource, error)

ParseResourceStrict maps the Spec of the provided resource to a specific type of Resource It will error if there are any unused keys

func ParseResources

func ParseResources(resources []*AnyResource) ([]Resource, error)

ParseResources parses a slice of AnyResource into a Resource

func ParseResourcesStrict added in v1.15.0

func ParseResourcesStrict(resources []*AnyResource) ([]Resource, error)

ParseResourcesStrict parses all the generic AnyResources into their concrete resource structs. Any extra fields on any of the resources will cause an error.

type ResourceConfiguration

type ResourceConfiguration struct {
	// ID will be generated and is used to uniquely identify the resource
	ID string `json:"id,omitempty" yaml:"id,omitempty" mapstructure:"id"`

	// Name must be specified if this is a reference to another resource by name
	Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name"`

	// DisplayName is a friendly name of the resource that will be displayed in the UI
	DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty" mapstructure:"displayName"`

	// ParameterizedSpec contains the definition of an embedded resource if this is not a reference to another resource
	ParameterizedSpec `yaml:",inline" mapstructure:",squash"`
}

ResourceConfiguration defines Sources and Destinations within a Configuration or Processors within a Source or Destination.

func (*ResourceConfiguration) ResourceParameters added in v1.19.0

func (rc *ResourceConfiguration) ResourceParameters() []Parameter

ResourceParameters returns the resource parameters for this resource.

func (*ResourceConfiguration) ShallowEqual added in v1.23.0

func (rc *ResourceConfiguration) ShallowEqual(other *ResourceConfiguration) bool

ShallowEqual compares the Resource configuration at a high level. It does not compare any child ResourceConfiguration objects.

type ResourceKind added in v1.16.0

type ResourceKind[T Resource] interface {
	// NewEmptyResource returns a new empty resource of the specified type
	NewEmptyResource() T
}

ResourceKind describes an interface for resources registered dynamically

type ResourceMeta

type ResourceMeta struct {
	APIVersion string   `yaml:"apiVersion,omitempty" json:"apiVersion"`
	Kind       Kind     `yaml:"kind,omitempty" json:"kind"`
	Metadata   Metadata `yaml:"metadata,omitempty" json:"metadata"`
}

ResourceMeta TODO(doc)

func (*ResourceMeta) DateModified added in v1.16.0

func (r *ResourceMeta) DateModified() *time.Time

DateModified returns the date the resource was last modified

func (*ResourceMeta) Description

func (r *ResourceMeta) Description() string

Description returns the description.

func (*ResourceMeta) EnsureHash added in v1.16.0

func (r *ResourceMeta) EnsureHash(spec any)

EnsureHash computes the hash of the resource spec and sets it on the resource

func (*ResourceMeta) EnsureID

func (r *ResourceMeta) EnsureID()

EnsureID sets the ID to a random uuid if not already set.

func (*ResourceMeta) EnsureMetadata added in v1.16.0

func (r *ResourceMeta) EnsureMetadata(spec any)

EnsureMetadata ensures that the metadata is set to reasonable defaults

func (*ResourceMeta) GetKind

func (r *ResourceMeta) GetKind() Kind

GetKind returns the Kind of this resource.

func (*ResourceMeta) GetLabels

func (r *ResourceMeta) GetLabels() Labels

GetLabels implements the Labeled interface for Resources

func (*ResourceMeta) GetResourceMeta added in v1.16.0

func (r *ResourceMeta) GetResourceMeta() ResourceMeta

GetResourceMeta returns the ResourceMeta for this resource.

func (*ResourceMeta) Hash added in v1.16.0

func (r *ResourceMeta) Hash() string

Hash returns the hash of the resource spec

func (*ResourceMeta) ID

func (r *ResourceMeta) ID() string

ID returns the ID

func (*ResourceMeta) IndexFields

func (r *ResourceMeta) IndexFields(index modelSearch.Indexer)

IndexFields returns a map of field name to field value to be stored in the index

func (*ResourceMeta) IndexID

func (r *ResourceMeta) IndexID() string

IndexID returns an ID used to identify the resource that is indexed

func (*ResourceMeta) IndexLabels

func (r *ResourceMeta) IndexLabels(index modelSearch.Indexer)

IndexLabels returns a map of label name to label value to be stored in the index

func (*ResourceMeta) IsDeprecated added in v1.23.0

func (r *ResourceMeta) IsDeprecated() bool

IsDeprecated returns true if the deprecated field on the status for this resource is true.

func (*ResourceMeta) Name

func (r *ResourceMeta) Name() string

Name returns the name.

func (*ResourceMeta) NameAndVersion added in v1.16.0

func (r *ResourceMeta) NameAndVersion() string

NameAndVersion returns the Resource name:version for this Resource

func (*ResourceMeta) PrintableFieldTitles

func (r *ResourceMeta) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*ResourceMeta) PrintableFieldValue

func (r *ResourceMeta) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources. The implementation for ResourceMeta contains fields common to all resources. Resources for defer to this implementation for anything not specific to or overridden by that resource kind.

func (*ResourceMeta) PrintableKindPlural

func (r *ResourceMeta) PrintableKindPlural() string

PrintableKindPlural returns the plural form of the Kind, e.g. "Configurations"

func (*ResourceMeta) PrintableKindSingular

func (r *ResourceMeta) PrintableKindSingular() string

PrintableKindSingular returns the singular form of the Kind, e.g. "Configuration"

func (*ResourceMeta) SetDateModified added in v1.16.0

func (r *ResourceMeta) SetDateModified(date *time.Time)

SetDateModified replaces the date the resource was last modified

func (*ResourceMeta) SetID

func (r *ResourceMeta) SetID(id string)

SetID replaces the uuid for this resource

func (*ResourceMeta) SetLabels added in v1.16.0

func (r *ResourceMeta) SetLabels(l Labels)

SetLabels implements the Labeled interface for Resources

func (*ResourceMeta) SetVersion added in v1.16.0

func (r *ResourceMeta) SetVersion(version Version)

SetVersion replaces the version for this resource

func (*ResourceMeta) UniqueKey

func (r *ResourceMeta) UniqueKey() string

UniqueKey returns the resource Name to uniquely identify a resource. Some Resource implementations use the ID instead.

func (*ResourceMeta) UpdateDependencies added in v1.16.0

func (r *ResourceMeta) UpdateDependencies(_ context.Context, _ ResourceStore) error

UpdateDependencies updates the dependencies for this resource to use the latest version.

func (*ResourceMeta) Validate

func (r *ResourceMeta) Validate() (warnings string, errors error)

Validate checks that the resource is valid, returning an error if it is not. This provides generic validation for all resources. Specific resources should provide their own Validate method and call this to validate the ResourceMeta.

func (*ResourceMeta) ValidateWithStore

func (r *ResourceMeta) ValidateWithStore(_ context.Context, _ ResourceStore) (warnings string, errors error)

ValidateWithStore allows for additional validation when a store is available.

func (*ResourceMeta) Version added in v1.16.0

func (r *ResourceMeta) Version() Version

Version returns the version

type ResourceStatus

type ResourceStatus struct {
	// Resource is the resource that was updated
	Resource Resource `json:"resource" mapstructure:"resource"`
	// Status is the status of the resource after the update
	Status UpdateStatus `json:"status" mapstructure:"status"`
	// Reason will be set if status is invalid or error
	Reason string `json:"reason" mapstructure:"reason"`
}

ResourceStatus contains a resource and its status after an update, which is of type UpdateStatus used in store and rest packages.

func NewResourceStatus

func NewResourceStatus(r Resource, s UpdateStatus) *ResourceStatus

NewResourceStatus returns a status for a resource

func NewResourceStatusWithError added in v1.16.0

func NewResourceStatusWithError(r Resource, err error) *ResourceStatus

NewResourceStatusWithError returns a status for an invalid resource

func NewResourceStatusWithReason

func NewResourceStatusWithReason(r Resource, s UpdateStatus, reason string) *ResourceStatus

NewResourceStatusWithReason returns a status for a resource with the specified reason

func (*ResourceStatus) String added in v0.5.2

func (s *ResourceStatus) String() string

type ResourceStore

type ResourceStore interface {
	Source(ctx context.Context, name string) (*Source, error)
	SourceType(ctx context.Context, name string) (*SourceType, error)
	Processor(ctx context.Context, name string) (*Processor, error)
	ProcessorType(ctx context.Context, name string) (*ProcessorType, error)
	Destination(ctx context.Context, name string) (*Destination, error)
	DestinationType(ctx context.Context, name string) (*DestinationType, error)
}

ResourceStore provides access to resources required to render configurations that use Sources and Destinations.

type ResourceType

type ResourceType struct {
	ResourceMeta              `yaml:",inline" mapstructure:",squash"`
	Spec                      ResourceTypeSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
	StatusType[VersionStatus] `yaml:",inline" mapstructure:",squash"`
}

ResourceType is a resource that describes a type of resource including parameters for creating that resource and a template for formatting the resource configuration.

There are separate ResourceTypes for each type of resource, e.g. SourceType for Source resources.

func (*ResourceType) GetSpec added in v1.16.0

func (rt *ResourceType) GetSpec() any

GetSpec returns the spec for this resource.

func (*ResourceType) PrintableFieldTitles

func (rt *ResourceType) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*ResourceType) Validate

func (rt *ResourceType) Validate() (warnings string, errors error)

Validate returns an error if any part of the ResourceType is invalid

func (*ResourceType) ValidateWithStore

func (rt *ResourceType) ValidateWithStore(_ context.Context, _ ResourceStore) (warnings string, errors error)

ValidateWithStore returns an error if any part of the ResourceType is invalid

type ResourceTypeOutput

type ResourceTypeOutput struct {
	Receivers  ResourceTypeTemplate `json:"receivers,omitempty"  yaml:"receivers,omitempty"  mapstructure:"receivers"`
	Processors ResourceTypeTemplate `json:"processors,omitempty" yaml:"processors,omitempty" mapstructure:"processors"`
	Exporters  ResourceTypeTemplate `json:"exporters,omitempty"  yaml:"exporters,omitempty"  mapstructure:"exporters"`
	Extensions ResourceTypeTemplate `json:"extensions,omitempty" yaml:"extensions,omitempty" mapstructure:"extensions"`
}

ResourceTypeOutput describes the output of the resource type

func (ResourceTypeOutput) Empty

func (s ResourceTypeOutput) Empty() bool

Empty returns true if Receivers, Processors, Exporters, and Extensions are the zero value ""

type ResourceTypeSpec

type ResourceTypeSpec struct {
	Version string `json:"version,omitempty" yaml:"version,omitempty" mapstructure:"version"`

	// Parameters currently uses the model from stanza. Eventually we will probably create a separate definition for
	// BindPlane.
	Parameters         []ParameterDefinition `json:"parameters"  yaml:"parameters"  mapstructure:"parameters"`
	SupportedPlatforms []string              `json:"supportedPlatforms,omitempty" yaml:"supportedPlatforms,omitempty" mapstructure:"supportedPlatforms"`

	// individual
	Logs    ResourceTypeOutput `json:"logs,omitempty"    yaml:"logs,omitempty"    mapstructure:"logs"`
	Metrics ResourceTypeOutput `json:"metrics,omitempty" yaml:"metrics,omitempty" mapstructure:"metrics"`
	Traces  ResourceTypeOutput `json:"traces,omitempty"  yaml:"traces,omitempty"  mapstructure:"traces"`

	// pairs (alphabetical order)
	LogsMetrics   ResourceTypeOutput `json:"logs+metrics,omitempty"   yaml:"logs+metrics,omitempty"   mapstructure:"logs+metrics"`
	LogsTraces    ResourceTypeOutput `json:"logs+traces,omitempty"    yaml:"logs+traces,omitempty"    mapstructure:"logs+traces"`
	MetricsTraces ResourceTypeOutput `json:"metrics+traces,omitempty" yaml:"metrics+traces,omitempty" mapstructure:"metrics+traces"`

	// all three (alphabetical order)
	LogsMetricsTraces ResourceTypeOutput `json:"logs+metrics+traces,omitempty" yaml:"logs+metrics+traces,omitempty" mapstructure:"logs+metrics+traces"`
}

ResourceTypeSpec is the spec for a resourceType to

func (*ResourceTypeSpec) ParameterDefinition

func (s *ResourceTypeSpec) ParameterDefinition(name string) *ParameterDefinition

ParameterDefinition returns the ParameterDefinition with the specified name or nil if no such parameter exists

func (*ResourceTypeSpec) ParameterDefinitionWithLabel added in v1.23.0

func (s *ResourceTypeSpec) ParameterDefinitionWithLabel(label string) *ParameterDefinition

ParameterDefinitionWithLabel returns the first ParameterDefinition with the specified label or nil if no such parameter exists

func (*ResourceTypeSpec) TelemetryTypes

func (s *ResourceTypeSpec) TelemetryTypes() []otel.PipelineType

TelemetryTypes returns the supported telemetry types (logs, metrics, or traces). Only applicable to SourceTypes.

type ResourceTypeTemplate

type ResourceTypeTemplate string

ResourceTypeTemplate is a go-template that evaluates to an array of OpenTelemetry resources

type Rollout added in v1.16.0

type Rollout struct {
	// Name will be set to the Name of the configuration when requested via Configuration.Rollout()
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// Status is the status of the rollout
	Status RolloutStatus `json:"status" yaml:"status" mapstructure:"status"`

	// Options are set when the Rollout is created based on the rollout options specified in the configuration
	Options RolloutOptions `json:"options" yaml:"options" mapstructure:"options"`

	// Phase starts at zero and increments until all agents are updated. In each phase, initial*multiplier^phase agents will be updated.
	Phase int `json:"phase" yaml:"phase" mapstructure:"phase"`

	// Progress is the current progress of the rollout
	Progress RolloutProgress `json:"progress" yaml:"progress" mapstructure:"progress"`
}

Rollout contains details about the rollout and its progress

func (*Rollout) AgentsNextPhase added in v1.16.0

func (r *Rollout) AgentsNextPhase() int

AgentsNextPhase returns the number of agents that will be updated in the next phase. If the rollout is not in the started state or additional agents are pending, zero is returned.

func (*Rollout) AgentsPerPhase added in v1.16.0

func (r *Rollout) AgentsPerPhase() int

AgentsPerPhase returns the number of agents that will be updated in the current phase.

func (*Rollout) PrintableFieldTitles added in v1.16.0

func (r *Rollout) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Rollout) PrintableFieldValue added in v1.16.0

func (r *Rollout) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Rollout) PrintableKindPlural added in v1.16.0

func (r *Rollout) PrintableKindPlural() string

PrintableKindPlural returns the plural form of the Kind, e.g. "Configurations"

func (*Rollout) PrintableKindSingular added in v1.16.0

func (r *Rollout) PrintableKindSingular() string

PrintableKindSingular returns the singular form of the Kind, e.g. "Configuration"

func (*Rollout) UpdateStatus added in v1.16.0

func (r *Rollout) UpdateStatus(progress RolloutProgress) (newAgentsPending int)

UpdateStatus updates the status of the rollout based on the number of completed, errored, pending, and waiting agents.

type RolloutOptions added in v1.16.0

type RolloutOptions struct {
	// StartAutomatically determines if this rollout transitions immediately from RolloutStatusPending to
	// RolloutStatusStarted without requiring that it be started manually.
	StartAutomatically bool `json:"startAutomatically" yaml:"startAutomatically" mapstructure:"startAutomatically"`

	// RollbackOnFailure determines if the rollout should be rolled back to the previous configuration if the rollout
	// fails.
	RollbackOnFailure bool `json:"rollbackOnFailure" yaml:"rollbackOnFailure" mapstructure:"rollbackOnFailure"`

	// PhaseAgentCount determines the rate at which agents will be updated during a rollout.
	PhaseAgentCount PhaseAgentCount `json:"phaseAgentCount" yaml:"phaseAgentCount" mapstructure:"phaseAgentCount"`

	// MaxErrors is the maximum number of failed agents before the rollout will be considered an error
	MaxErrors int `json:"maxErrors" yaml:"maxErrors" mapstructure:"maxErrors"`
}

RolloutOptions are stored with a configuration and determine how rollouts for that configuration are managed.

func RolloutOptionsForAgentCount added in v1.23.0

func RolloutOptionsForAgentCount(agentCount int) RolloutOptions

RolloutOptionsForAgentCount returns the RolloutOptions that should be used for a rollout of the specified number of agents.

type RolloutProgress added in v1.16.0

type RolloutProgress struct {
	// Completed is the number of agents with new version with Connected status
	Completed int `json:"completed" yaml:"completed" mapstructure:"completed"`

	// Errors is the number of agents with new version with Error Status
	Errors int `json:"errors" yaml:"errors" mapstructure:"errors"`

	// Pending is the number of agents that are currently being configured
	Pending int `json:"pending" yaml:"pending" mapstructure:"pending"`

	// Waiting is the number of agents that need to be scheduled for configuration
	Waiting int `json:"waiting" yaml:"waiting" mapstructure:"waiting"`
}

RolloutProgress is the current progress of the rollout

type RolloutSize added in v1.23.0

type RolloutSize string

RolloutSize is used to determine the default rollout options for a configuration.

const (
	// RolloutSmall is a rollout of 1-20 Agents
	RolloutSmall RolloutSize = "small"
	// RolloutMedium is a rollout of  20-500 Agents
	RolloutMedium RolloutSize = "medium"
	// RolloutLarge is a rollout of  500+ Agents
	RolloutLarge RolloutSize = "large"
)

type RolloutStatus added in v1.16.0

type RolloutStatus int

RolloutStatus is the status for a configuration rollout

const (
	// RolloutStatusPending is created, manual start required
	RolloutStatusPending RolloutStatus = 0

	// RolloutStatusStarted is in progress
	RolloutStatusStarted RolloutStatus = 1

	// RolloutStatusPaused is paused by the user
	RolloutStatusPaused RolloutStatus = 2

	// RolloutStatusError is a failed rollout because of too many errors
	RolloutStatusError RolloutStatus = 3

	// RolloutStatusStable is a completed rollout saved for labeled agents connecting
	RolloutStatusStable RolloutStatus = 4

	// RolloutStatusReplaced is an incomplete rollout replaced by another rollout
	RolloutStatusReplaced RolloutStatus = 5
)

func (RolloutStatus) MarshalGQL added in v1.16.0

func (s RolloutStatus) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface.

func (RolloutStatus) String added in v1.16.0

func (s RolloutStatus) String() string

func (*RolloutStatus) UnmarshalGQL added in v1.16.0

func (s *RolloutStatus) UnmarshalGQL(i interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface.

type Selector

type Selector struct {
	labels.Selector
}

Selector is a wrapper for labels.Selector

func EmptySelector

func EmptySelector() Selector

EmptySelector returns a Selector that has no labels and matches nothing

func EverythingSelector

func EverythingSelector() Selector

EverythingSelector returns a Selector that matches everything

func SelectorFromMap

func SelectorFromMap(m map[string]string) (Selector, error)

SelectorFromMap takes a map[string]string and returns a Selector and error.

func SelectorFromString

func SelectorFromString(selector string) (Selector, error)

SelectorFromString takes a string and returns a Selector and error

func (*Selector) MatchLabels

func (s *Selector) MatchLabels() (labels MatchLabels, complete bool)

MatchLabels returns the portion of the Selector that consists of simple name=value label matches. A Selector supports more complex selection and this should only be used in cases where Matches() would have terrible performance and partial selection is ok. This will return false for complete if there are selectors requirements that cannot be expressed with match labels.

type Source

type Source struct {
	// ResourceMeta is the metadata for the Source
	ResourceMeta `yaml:",inline" mapstructure:",squash"`
	// Spec is the specification for the Source that contains the type and parameters
	Spec                      ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
	StatusType[VersionStatus] `yaml:",inline" mapstructure:",squash"`
}

Source will generate an exporter and be at the end of a pipeline

func FindSource

func FindSource(ctx context.Context, source *ResourceConfiguration, defaultName string, store ResourceStore) (*Source, error)

FindSource returns a Source from the store if it exists. If it doesn't exist, it creates a new Source with the specified defaultName.

func NewSource

func NewSource(name string, sourceTypeName string, parameters []Parameter) *Source

NewSource creates a new Source with the specified name, type, and parameters

func NewSourceWithSpec

func NewSourceWithSpec(name string, spec ParameterizedSpec) *Source

NewSourceWithSpec creates a new Source with the specified spec

func (*Source) ComponentID

func (s *Source) ComponentID(name string) otel.ComponentID

ComponentID provides a unique component id for the specified component name

func (*Source) GetKind

func (s *Source) GetKind() Kind

GetKind returns "Source"

func (*Source) GetSpec added in v1.16.0

func (s *Source) GetSpec() any

GetSpec returns the spec for this resource.

func (*Source) MaskSensitiveParameters added in v1.19.0

func (s *Source) MaskSensitiveParameters(ctx context.Context)

MaskSensitiveParameters masks sensitive parameter values based on the ParameterDefinitions in the ResourceType

func (*Source) PreserveSensitiveParameters added in v1.19.0

func (s *Source) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error

PreserveSensitiveParameters will replace parameters with the SensitiveParameterPlaceholder value with the value of the parameter from the existing resource. This does nothing if existing is nil because there is no existing resource.

func (*Source) PrintableFieldTitles

func (s *Source) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Source) PrintableFieldValue

func (s *Source) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Source) ResourceParameters

func (s *Source) ResourceParameters() []Parameter

ResourceParameters are the parameters passed to the ResourceType to generate the configuration

func (*Source) ResourceTypeName

func (s *Source) ResourceTypeName() string

ResourceTypeName is the name of the ResourceType that renders this resource type

func (*Source) UpdateDependencies added in v1.16.0

func (s *Source) UpdateDependencies(ctx context.Context, store ResourceStore) error

UpdateDependencies updates the dependencies for this resource to use the latest version.

func (*Source) ValidateWithStore

func (s *Source) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the source is valid, returning an error if it is not. It uses the store to retrieve the source type so that parameter values can be validated against the parameter definitions.

type SourceResponse

type SourceResponse struct {
	Source *Source `json:"source"`
}

SourceResponse is the REST API response to GET /v1/sources/:name

type SourceType

type SourceType struct {
	ResourceType `yaml:",inline" mapstructure:",squash"`
}

SourceType is a ResourceType used to define sources

func NewSourceType

func NewSourceType(name string, parameters []ParameterDefinition, supportedPlatforms []string) *SourceType

NewSourceType creates a new source-type with the specified name,

func NewSourceTypeWithSpec

func NewSourceTypeWithSpec(name string, spec ResourceTypeSpec) *SourceType

NewSourceTypeWithSpec creates a new source-type with the specified name and spec.

func (*SourceType) GetKind

func (s *SourceType) GetKind() Kind

GetKind returns "SourceType"

type SourceTypeResponse

type SourceTypeResponse struct {
	SourceType *SourceType `json:"sourceType"`
}

SourceTypeResponse is the REST API response to GET /v1/sourceType/:name

type SourceTypesResponse

type SourceTypesResponse struct {
	SourceTypes []*SourceType `json:"sourceTypes"`
}

SourceTypesResponse is the REST API response to GET /v1/sourceTypes

type SourcesResponse

type SourcesResponse struct {
	Sources []*Source `json:"sources"`
}

SourcesResponse is the REST API response to GET /v1/sources

type StartRolloutPayload added in v1.16.0

type StartRolloutPayload struct {
	Options *RolloutOptions `json:"options"`
}

StartRolloutPayload is the REST API body to POST /v1/rollouts/:name/start

type StatusType added in v1.16.0

type StatusType[T any] struct {
	Status T `yaml:"status,omitempty" json:"status,omitempty" mapstructure:"status,omitempty"`
}

StatusType is a shared implementation of a Status field, GetStatus(), and SetStatus() that is used by resources that have a status.

func NewStatusType added in v1.16.0

func NewStatusType[T any](t T) StatusType[T]

NewStatusType returns a new StatusType[T] with the given status.

func (*StatusType[T]) GetStatus added in v1.16.0

func (t *StatusType[T]) GetStatus() any

GetStatus returns the status for this resource.

func (*StatusType[T]) IsCurrent added in v1.16.0

func (t *StatusType[T]) IsCurrent() bool

IsCurrent returns true if the current field on the status for this resource is true. Currently this is only used for Configurations. For other resources this always returns false.

func (*StatusType[T]) IsLatest added in v1.16.0

func (t *StatusType[T]) IsLatest() bool

IsLatest returns true if the latest field on the status for this resource is true. Currently this is only used for Configurations, Sources, Processors, Destinations, SourceTypes, ProcessorTypes, and DestinationTypes. For other resources this always returns true.

func (*StatusType[T]) IsPending added in v1.16.0

func (t *StatusType[T]) IsPending() bool

IsPending returns true if the pending field on the status for this resource is true. Currently this is only used for Configurations. For other resources this always returns false.

func (*StatusType[T]) SetCurrent added in v1.16.0

func (t *StatusType[T]) SetCurrent(current bool)

SetCurrent sets the value of the current field on the status for this resource. Currently this is only used for Configurations. For other resources this does nothing.

func (*StatusType[T]) SetLatest added in v1.16.0

func (t *StatusType[T]) SetLatest(latest bool)

SetLatest sets the value of the latest field on the status for this resource. Currently this is only used for Configurations, Sources, Processors, Destinations, SourceTypes, ProcessorTypes, and DestinationTypes. For other resources this does nothing.

func (*StatusType[T]) SetPending added in v1.16.0

func (t *StatusType[T]) SetPending(pending bool)

SetPending sets the value of the pending field on the status for this resource. Currently this is only used for Configurations. For other resources this does nothing.

func (*StatusType[T]) SetStatus added in v1.16.0

func (t *StatusType[T]) SetStatus(status any) error

SetStatus replaces the status for this resource.

type TemplateErrorHandler

type TemplateErrorHandler func(error)

TemplateErrorHandler handles errors during template evaluation. Typically these will be logged but they could be accumulated and reported to the user.

type UpdateStatus

type UpdateStatus string

UpdateStatus is part of ResourceStatus that indicates the result of ApplyResources and DeleteResources on the Store.

const (
	// StatusUnchanged indicates that there were no changes to a modified resource because the existing resource is the same
	StatusUnchanged UpdateStatus = "unchanged"

	// StatusConfigured indicates that changes were applied to an existing resource
	StatusConfigured UpdateStatus = "configured"

	// StatusCreated indicates that a new resource was created
	StatusCreated UpdateStatus = "created"

	// StatusDeleted indicates that a resource was deleted, either from the store or the current filtered view of resources
	StatusDeleted UpdateStatus = "deleted"

	// StatusInvalid represents an attempt to add or update a resource with an invalid resource
	StatusInvalid UpdateStatus = "invalid"

	// StatusError is used when an individual resource cannot be applied because of an error
	StatusError UpdateStatus = "error"

	// StatusInUse is used when attempting to delete a resource that is being referenced by another
	StatusInUse UpdateStatus = "in-use"

	// StatusForbidden is used when attempting to modify or delete a resource without sufficient permission
	StatusForbidden UpdateStatus = "forbidden"

	// StatusDeprecated is used when attempting to seed a resource that is deprecated that doesn't already exist
	StatusDeprecated UpdateStatus = "deprecated"
)

type Version added in v1.16.0

type Version int

Version indicates the version of a resource. It is generally incremented for each update to a resource, but configurations are only incremented when a rollout is started.

const (
	// VersionPending refers to the pending Version of a resource, which is the version that is currently being rolled
	// out. This is currently only used for Configurations.
	VersionPending Version = -2

	// VersionCurrent refers to the current Version of a resource, which is the last version to be successfully rolled
	// out. This is currently only used for Configurations.
	VersionCurrent Version = -1

	// VersionLatest refers to the latest Version of a resource which is the latest version that has been created.
	VersionLatest Version = 0
)

func SplitVersion added in v1.16.0

func SplitVersion(resourceKey string) (string, Version)

SplitVersion splits a resource key into the resource key and version.

func SplitVersionDefault added in v1.16.0

func SplitVersionDefault(resourceKey string, defaultVersion Version) (string, Version)

SplitVersionDefault splits a resource key into the resource key and version and allows a default version to be specified if none is specified or the specified version cannot be parsed.

func (Version) MarshalGQL added in v1.16.0

func (v Version) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface.

func (*Version) UnmarshalGQL added in v1.16.0

func (v *Version) UnmarshalGQL(i interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface.

type VersionStatus added in v1.16.0

type VersionStatus struct {
	Latest bool `json:"latest" yaml:"latest" mapstructure:"latest"`
}

VersionStatus indicates if the resource is the latest version

Directories

Path Synopsis
Package graph provides the Graph type, which is used to display topology in the UI
Package graph provides the Graph type, which is used to display topology in the UI
Package observiq provides models and functions for interacting with managed observIQ OTel agents.
Package observiq provides models and functions for interacting with managed observIQ OTel agents.
Package otel provides functions for working with OTel pipelines
Package otel provides functions for working with OTel pipelines
Package search provides a search interface
Package search provides a search interface
Package validation contains functions for validating constraints are met for given strings
Package validation contains functions for validating constraints are met for given strings
Package version contains the version logic for models in BindPlane
Package version contains the version logic for models in BindPlane

Jump to

Keyboard shortcuts

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