Documentation
¶
Overview ¶
Package model contains the data model for resources used in BindPlane
Index ¶
- Constants
- Variables
- func AsKind[T Resource](resource Resource) (T, error)
- func Clone[T Resource](r T) (result T, err error)
- func ContextWithoutSensitiveParameterMasking(ctx context.Context) context.Context
- func EvalProcessor(ctx context.Context, processor *ResourceConfiguration, defaultName string, ...) (string, otel.Partials)
- func GetOssOtelHeaders() map[string]string
- func HasVersionKind(kind Kind) bool
- func IsVersionedKind(kind Kind) bool
- func IsWithoutSensitiveParameterMasking(ctx context.Context) bool
- func JoinVersion(resourceKey string, version Version) string
- func NameAndVersion(name string, version Version) string
- func NewResourceID() string
- func NewSecretKey() string
- func ParameterValue(parameters []Parameter, name string) any
- func Parse[T Resource](r []*AnyResource) ([]T, error)
- func ParseOne[T Resource](r *AnyResource) (resource T, err error)
- func ParseResourceStatus[T any](resource Resource) (*T, bool)
- func PreserveSensitiveParameters(ctx context.Context, resource HasResourceParameters, existing *AnyResource) error
- func PrintResourceUpdates(writer io.Writer, resourceStatuses []*AnyResourceStatus)
- func PrintableFieldValues(p Printable) []string
- func PrintableFieldValuesForTitles(p Printable, titles []string) []string
- func Register[T Resource](apiVersion string, kind Kind, resourceKind ResourceKind[T])
- func RegisterDefault[T Resource](apiVersion string, kind Kind, resourceKind ResourceKind[T])
- func RegisterKind(kind Kind)
- func SetVersion[R Resource](resource R, Version Version) R
- func SnapshotProcessor(position MeasurementPosition, resourceName string) otel.ComponentID
- func SortAgentVersionsLatestFirst(agentVersions []*AgentVersion)
- func SortAgentsByName(agents []*Agent)
- func TrimVersion(resourceKey string) string
- func UniqueKeys[S ~[]T, T HasUniqueKey](resources S) []string
- type Agent
- func (a *Agent) Connect(newAgentVersion string)
- func (a *Agent) ConnectedDurationDisplayText() string
- func (a *Agent) Disconnect()
- func (a *Agent) DisconnectedDurationDisplayText() string
- func (a *Agent) DisconnectedSince(since time.Time) bool
- func (a *Agent) Features() AgentFeatures
- func (a *Agent) GetLabels() Labels
- func (a *Agent) HasFeatures(feature AgentFeatures) bool
- func (a *Agent) IndexFields(index modelSearch.Indexer)
- func (a *Agent) IndexID() string
- func (a *Agent) IndexLabels(index modelSearch.Indexer)
- func (a *Agent) MatchesSelector(selector Selector) bool
- func (a *Agent) PrintableFieldTitles() []string
- func (a *Agent) PrintableFieldValue(title string) string
- func (a *Agent) PrintableKindPlural() string
- func (a *Agent) PrintableKindSingular() string
- func (a *Agent) SetCurrentConfiguration(configuration *Configuration)
- func (a *Agent) SetFutureConfiguration(configuration *Configuration)
- func (a *Agent) SetLabels(l Labels)
- func (a *Agent) SetPendingConfiguration(configuration *Configuration)
- func (a *Agent) StatusDisplayText() string
- func (a *Agent) SupportsUpgrade() bool
- func (a *Agent) UniqueKey() string
- func (a *Agent) UpgradeComplete(version, errorMessage string)
- func (a *Agent) UpgradeStarted(version string, allPackagesHash []byte)
- func (a *Agent) UpgradeTo(version string)
- type AgentDownload
- type AgentFeatures
- type AgentInstaller
- type AgentLabelsPayload
- type AgentLabelsResponse
- type AgentResponse
- type AgentSelector
- type AgentStatus
- type AgentTypeName
- type AgentUpgrade
- type AgentUpgradeStatus
- type AgentVersion
- func (v *AgentVersion) AgentType() string
- func (v *AgentVersion) AgentVersion() string
- func (v *AgentVersion) Download(platform string) *AgentDownload
- func (v *AgentVersion) GetKind() Kind
- func (v *AgentVersion) GetSpec() any
- func (v *AgentVersion) Installer(platform string) *AgentInstaller
- func (v *AgentVersion) PrintableFieldTitles() []string
- func (v *AgentVersion) PrintableFieldValue(title string) string
- func (v *AgentVersion) Public() bool
- func (v *AgentVersion) SemanticVersion() *semver.Version
- func (v *AgentVersion) Validate() (warnings string, errors error)
- type AgentVersionResponse
- type AgentVersionSpec
- type AgentVersionsResponse
- type AgentsResponse
- type AnyResource
- func (r *AnyResource) GetResourceMeta() ResourceMeta
- func (r *AnyResource) GetSpec() any
- func (r *AnyResource) MaskSensitiveParameters(ctx context.Context)
- func (r *AnyResource) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error
- func (r *AnyResource) Scan(value interface{}) error
- func (r AnyResource) Value() (driver.Value, error)
- type AnyResourceStatus
- type ApplyPayload
- type ApplyResponse
- type ApplyResponseClientSide
- type AwsCloudWatchNamedFieldItem
- type BulkAgentLabelsPayload
- type BulkAgentLabelsResponse
- type CloudWatchNamedFieldValue
- type Configuration
- func (c *Configuration) AgentSelector() Selector
- func (c *Configuration) Duplicate(name string) *Configuration
- func (c *Configuration) GetKind() Kind
- func (c *Configuration) GetSpec() any
- func (c *Configuration) Graph(ctx context.Context, store ResourceStore) (*graph.Graph, error)
- func (c *Configuration) IndexFields(index modelSearch.Indexer)
- func (c *Configuration) IsForAgent(agent *Agent) bool
- func (c *Configuration) MaskSensitiveParameters(ctx context.Context)
- func (c *Configuration) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error
- func (c *Configuration) PrintableFieldTitles() []string
- func (c *Configuration) PrintableFieldValue(title string) string
- func (c *Configuration) PrintableVersionFieldTitles() []string
- func (c *Configuration) Render(ctx context.Context, agent *Agent, bindPlaneURL string, ...) (string, error)
- func (c *Configuration) Rollout() *Rollout
- func (c *Configuration) Type() ConfigurationType
- func (c *Configuration) UpdateDependencies(ctx context.Context, store ResourceStore) error
- func (c *Configuration) Usage(ctx context.Context, store ResourceStore) *PipelineTypeUsage
- func (c *Configuration) Validate() (warnings string, errors error)
- func (c *Configuration) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)
- type ConfigurationResponse
- type ConfigurationSpec
- type ConfigurationStatus
- type ConfigurationType
- type ConfigurationVersions
- type ConfigurationsResponse
- type DeleteAgentsPayload
- type DeleteAgentsResponse
- type DeletePayload
- type DeleteResponse
- type DeleteResponseClientSide
- type Destination
- func (d *Destination) ComponentID(name string) otel.ComponentID
- func (d *Destination) GetKind() Kind
- func (d *Destination) GetSpec() any
- func (d *Destination) MaskSensitiveParameters(ctx context.Context)
- func (d *Destination) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error
- func (d *Destination) PrintableFieldTitles() []string
- func (d *Destination) PrintableFieldValue(title string) string
- func (d *Destination) ResourceParameters() []Parameter
- func (d *Destination) ResourceTypeName() string
- func (d *Destination) UpdateDependencies(ctx context.Context, store ResourceStore) error
- func (d *Destination) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)
- type DestinationResponse
- type DestinationType
- type DestinationTypeResponse
- type DestinationTypesResponse
- type DestinationsResponse
- type DocumentationLink
- type ErrorResponse
- type HasAgentSelector
- type HasResourceParameters
- type HasSensitiveParameters
- type HasUniqueKey
- type HistoryResponse
- type InstallCommandResponse
- type Kind
- type Labeled
- type Labels
- func (l *Labels) AsMap() map[string]string
- func (l Labels) BindPlane() Labels
- func (l Labels) Conflicts(o Labels) bool
- func (l Labels) Custom() Labels
- func (l *Labels) MarshalJSON() ([]byte, error)
- func (l *Labels) Scan(value interface{}) error
- func (l *Labels) UnmarshalJSON(b []byte) error
- func (l Labels) Value() (driver.Value, error)
- type ManagerTLS
- type MatchLabels
- type MeasurementPosition
- type Metadata
- type MetricCategory
- type MetricOption
- type MockResourceStore
- func (_m *MockResourceStore) Destination(ctx context.Context, name string) (*Destination, error)
- func (_m *MockResourceStore) DestinationType(ctx context.Context, name string) (*DestinationType, error)
- func (_m *MockResourceStore) EXPECT() *MockResourceStore_Expecter
- func (_m *MockResourceStore) Processor(ctx context.Context, name string) (*Processor, error)
- func (_m *MockResourceStore) ProcessorType(ctx context.Context, name string) (*ProcessorType, error)
- func (_m *MockResourceStore) Source(ctx context.Context, name string) (*Source, error)
- func (_m *MockResourceStore) SourceType(ctx context.Context, name string) (*SourceType, error)
- type MockResourceStore_DestinationType_Call
- func (_c *MockResourceStore_DestinationType_Call) Return(_a0 *DestinationType, _a1 error) *MockResourceStore_DestinationType_Call
- func (_c *MockResourceStore_DestinationType_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_DestinationType_Call
- func (_c *MockResourceStore_DestinationType_Call) RunAndReturn(run func(context.Context, string) (*DestinationType, error)) *MockResourceStore_DestinationType_Call
- type MockResourceStore_Destination_Call
- func (_c *MockResourceStore_Destination_Call) Return(_a0 *Destination, _a1 error) *MockResourceStore_Destination_Call
- func (_c *MockResourceStore_Destination_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_Destination_Call
- func (_c *MockResourceStore_Destination_Call) RunAndReturn(run func(context.Context, string) (*Destination, error)) *MockResourceStore_Destination_Call
- type MockResourceStore_Expecter
- func (_e *MockResourceStore_Expecter) Destination(ctx interface{}, name interface{}) *MockResourceStore_Destination_Call
- func (_e *MockResourceStore_Expecter) DestinationType(ctx interface{}, name interface{}) *MockResourceStore_DestinationType_Call
- func (_e *MockResourceStore_Expecter) Processor(ctx interface{}, name interface{}) *MockResourceStore_Processor_Call
- func (_e *MockResourceStore_Expecter) ProcessorType(ctx interface{}, name interface{}) *MockResourceStore_ProcessorType_Call
- func (_e *MockResourceStore_Expecter) Source(ctx interface{}, name interface{}) *MockResourceStore_Source_Call
- func (_e *MockResourceStore_Expecter) SourceType(ctx interface{}, name interface{}) *MockResourceStore_SourceType_Call
- type MockResourceStore_ProcessorType_Call
- func (_c *MockResourceStore_ProcessorType_Call) Return(_a0 *ProcessorType, _a1 error) *MockResourceStore_ProcessorType_Call
- func (_c *MockResourceStore_ProcessorType_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_ProcessorType_Call
- func (_c *MockResourceStore_ProcessorType_Call) RunAndReturn(run func(context.Context, string) (*ProcessorType, error)) *MockResourceStore_ProcessorType_Call
- type MockResourceStore_Processor_Call
- func (_c *MockResourceStore_Processor_Call) Return(_a0 *Processor, _a1 error) *MockResourceStore_Processor_Call
- func (_c *MockResourceStore_Processor_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_Processor_Call
- func (_c *MockResourceStore_Processor_Call) RunAndReturn(run func(context.Context, string) (*Processor, error)) *MockResourceStore_Processor_Call
- type MockResourceStore_SourceType_Call
- func (_c *MockResourceStore_SourceType_Call) Return(_a0 *SourceType, _a1 error) *MockResourceStore_SourceType_Call
- func (_c *MockResourceStore_SourceType_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_SourceType_Call
- func (_c *MockResourceStore_SourceType_Call) RunAndReturn(run func(context.Context, string) (*SourceType, error)) *MockResourceStore_SourceType_Call
- type MockResourceStore_Source_Call
- func (_c *MockResourceStore_Source_Call) Return(_a0 *Source, _a1 error) *MockResourceStore_Source_Call
- func (_c *MockResourceStore_Source_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_Source_Call
- func (_c *MockResourceStore_Source_Call) RunAndReturn(run func(context.Context, string) (*Source, error)) *MockResourceStore_Source_Call
- type NoStatus
- type Parameter
- type ParameterDefinition
- type ParameterOptions
- type ParameterizedSpec
- type PatchAgentVersionsRequest
- type PhaseAgentCount
- type PipelineTypeUsage
- type PostAgentVersionRequest
- type PostCopyConfigRequest
- type PostCopyConfigResponse
- type Printable
- type PrintableVersion
- type Processor
- func (s *Processor) ComponentID(name string) otel.ComponentID
- func (s *Processor) GetKind() Kind
- func (s *Processor) GetSpec() any
- func (s *Processor) MaskSensitiveParameters(ctx context.Context)
- func (s *Processor) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error
- func (s *Processor) PrintableFieldTitles() []string
- func (s *Processor) PrintableFieldValue(title string) string
- func (s *Processor) ResourceParameters() []Parameter
- func (s *Processor) ResourceTypeName() string
- func (s *Processor) UpdateDependencies(ctx context.Context, store ResourceStore) error
- func (s *Processor) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)
- type ProcessorResponse
- type ProcessorType
- type ProcessorTypeResponse
- type ProcessorTypesResponse
- type ProcessorsResponse
- type RelevantIfCondition
- type Resource
- func NewEmptyResource(kind Kind) (Resource, error)
- func NewEmptyVersionResource(version string, kind Kind) (Resource, error)
- func ParseResource(r *AnyResource) (Resource, error)
- func ParseResourceStrict(r *AnyResource) (Resource, error)
- func ParseResources(resources []*AnyResource) ([]Resource, error)
- func ParseResourcesStrict(resources []*AnyResource) ([]Resource, error)
- type ResourceConfiguration
- type ResourceKind
- type ResourceMeta
- func (r *ResourceMeta) DateModified() *time.Time
- func (r *ResourceMeta) Description() string
- func (r *ResourceMeta) EnsureHash(spec any)
- func (r *ResourceMeta) EnsureID()
- func (r *ResourceMeta) EnsureMetadata(spec any)
- func (r *ResourceMeta) GetKind() Kind
- func (r *ResourceMeta) GetLabels() Labels
- func (r *ResourceMeta) GetResourceMeta() ResourceMeta
- func (r *ResourceMeta) Hash() string
- func (r *ResourceMeta) ID() string
- func (r *ResourceMeta) IndexFields(index modelSearch.Indexer)
- func (r *ResourceMeta) IndexID() string
- func (r *ResourceMeta) IndexLabels(index modelSearch.Indexer)
- func (r *ResourceMeta) Name() string
- func (r *ResourceMeta) NameAndVersion() string
- func (r *ResourceMeta) PrintableFieldTitles() []string
- func (r *ResourceMeta) PrintableFieldValue(title string) string
- func (r *ResourceMeta) PrintableKindPlural() string
- func (r *ResourceMeta) PrintableKindSingular() string
- func (r *ResourceMeta) SetDateModified(date *time.Time)
- func (r *ResourceMeta) SetID(id string)
- func (r *ResourceMeta) SetLabels(l Labels)
- func (r *ResourceMeta) SetVersion(version Version)
- func (r *ResourceMeta) UniqueKey() string
- func (r *ResourceMeta) UpdateDependencies(_ context.Context, _ ResourceStore) error
- func (r *ResourceMeta) Validate() (warnings string, errors error)
- func (r *ResourceMeta) ValidateWithStore(_ context.Context, _ ResourceStore) (warnings string, errors error)
- func (r *ResourceMeta) Version() Version
- type ResourceStatus
- type ResourceStore
- type ResourceType
- type ResourceTypeOutput
- type ResourceTypeSpec
- type ResourceTypeTemplate
- type Rollout
- func (r *Rollout) AgentsNextPhase() int
- func (r *Rollout) AgentsPerPhase() int
- func (r *Rollout) PrintableFieldTitles() []string
- func (r *Rollout) PrintableFieldValue(title string) string
- func (r *Rollout) PrintableKindPlural() string
- func (r *Rollout) PrintableKindSingular() string
- func (r *Rollout) UpdateStatus(progress RolloutProgress) (newAgentsPending int)
- type RolloutOptions
- type RolloutProgress
- type RolloutStatus
- type Selector
- type Source
- func (s *Source) ComponentID(name string) otel.ComponentID
- func (s *Source) GetKind() Kind
- func (s *Source) GetSpec() any
- func (s *Source) MaskSensitiveParameters(ctx context.Context)
- func (s *Source) PreserveSensitiveParameters(ctx context.Context, existing *AnyResource) error
- func (s *Source) PrintableFieldTitles() []string
- func (s *Source) PrintableFieldValue(title string) string
- func (s *Source) ResourceParameters() []Parameter
- func (s *Source) ResourceTypeName() string
- func (s *Source) UpdateDependencies(ctx context.Context, store ResourceStore) error
- func (s *Source) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)
- type SourceResponse
- type SourceType
- type SourceTypeResponse
- type SourceTypesResponse
- type SourcesResponse
- type StartRolloutPayload
- type StatusType
- func (t *StatusType[T]) GetStatus() any
- func (t *StatusType[T]) IsCurrent() bool
- func (t *StatusType[T]) IsLatest() bool
- func (t *StatusType[T]) IsPending() bool
- func (t *StatusType[T]) SetCurrent(current bool)
- func (t *StatusType[T]) SetLatest(latest bool)
- func (t *StatusType[T]) SetPending(pending bool)
- func (t *StatusType[T]) SetStatus(status any) error
- type TemplateErrorHandler
- type UpdateStatus
- type Version
- type VersionStatus
Constants ¶
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" )
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" )
const ( // MetadataName TODO(doc) MetadataName = "name" // MetadataID TODO(doc) MetadataID = "id" )
const AgentFeaturesDefault = AgentSupportsUpgrade
AgentFeaturesDefault is the default bitmask of features supported by Agents
const ResourceDateFormat = "2006-01-02 15:04:05"
ResourceDateFormat is used when formatting dates for Resources.
const SensitiveParameterPlaceholder = "(sensitive)"
SensitiveParameterPlaceholder is the value returned for sensitive parameters
Variables ¶
var DefaultRolloutOptions = RolloutOptions{ 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
var ErrInvalidPlatform = errors.New("invalid platform name")
ErrInvalidPlatform is returned when a platform name is not valid
var ErrMissingSupportedPlatforms = errors.New("supportedPlatforms must be specified")
ErrMissingSupportedPlatforms is returned when the supportedPlatforms field is missing or empty
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
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 ContextWithoutSensitiveParameterMasking ¶ added in v1.19.0
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
GetOssOtelHeaders are the Headers used to add headers to the otel configuration
func HasVersionKind ¶ added in v1.16.0
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
IsVersionedKind returns true if the kind is versioned
func IsWithoutSensitiveParameterMasking ¶ added in v1.19.0
IsWithoutSensitiveParameterMasking returns true if the context has been set to not mask sensitive parameters
func JoinVersion ¶ added in v1.16.0
JoinVersion joins a resource key and version into a resource key for the specified version.
func NameAndVersion ¶ added in v1.16.0
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
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
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 PrintResourceUpdates ¶
func PrintResourceUpdates(writer io.Writer, resourceStatuses []*AnyResourceStatus)
PrintResourceUpdates TODO(doc)
func PrintableFieldValues ¶
PrintableFieldValues uses PrintableFieldTitles and PrintableFieldValue of the specified Printable to assemble the list of values to print
func PrintableFieldValuesForTitles ¶
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
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 TrimVersion ¶ added in v1.16.0
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 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"` 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 ¶
Connect updates the ConnectedAt and DisconnectedAt fields of the agent and should be called when the agent connects.
func (*Agent) ConnectedDurationDisplayText ¶
ConnectedDurationDisplayText TODO(doc)
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.
func (*Agent) DisconnectedDurationDisplayText ¶
DisconnectedDurationDisplayText TODO(doc) What RFC?
func (*Agent) DisconnectedSince ¶
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) 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) 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 ¶
MatchesSelector returns true if the given selector matches the agent's labels.
func (*Agent) PrintableFieldTitles ¶
PrintableFieldTitles returns the list of field titles, used for printing a table of resources
func (*Agent) PrintableFieldValue ¶
PrintableFieldValue returns the field value for a title, used for printing a table of resources
func (*Agent) PrintableKindPlural ¶
PrintableKindPlural returns the singular form of the Kind, e.g. "Agents"
func (*Agent) PrintableKindSingular ¶
PrintableKindSingular returns the singular form of the Kind, e.g. "Agent"
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) 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 ¶
StatusDisplayText returns the string representation of the agent's status.
func (*Agent) SupportsUpgrade ¶ added in v1.0.0
SupportsUpgrade returns true if this agent supports upgrade
func (*Agent) UpgradeComplete ¶ added in v1.0.0
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
UpgradeStarted is set when the upgrade instructions have actually been sent to the Agent.
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 ¶
AgentLabelsPayload is the REST API body for PATCH /v1/agents/{id}/labels
type AgentLabelsResponse ¶
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 TODO(doc)
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
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" json:",inline" mapstructure:",squash"` // Spec TODO(doc) Spec AgentVersionSpec `json:"spec" yaml:"spec" mapstructure:"spec"` StatusType[NoStatus] `yaml:",inline" json:",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" json:",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
type AnyResourceStatus ¶
type AnyResourceStatus struct { Resource AnyResource `json:"resource" mapstructure:"resource"` Status UpdateStatus `json:"status" mapstructure:"status"` Reason string `json:"reason" mapstructure:"reason"` }
AnyResourceStatus TODO(doc) Same as ResourceStatus but used by 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 TODO(doc) ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"` // Spec TODO(doc) Spec ConfigurationSpec `json:"spec" yaml:"spec" mapstructure:"spec"` StatusType[ConfigurationStatus] `yaml:",inline" json:",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
func (c *Configuration) Usage(ctx context.Context, store ResourceStore) *PipelineTypeUsage
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"` 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
func (*ConfigurationVersions) UniqueKey ¶ added in v1.16.0
func (cv *ConfigurationVersions) UniqueKey() string
UniqueKey returns the agent ID to uniquely identify an Agent
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 TODO(doc) ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"` // Spec TODO(doc) Spec ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"` StatusType[VersionStatus] `yaml:",inline" json:",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) 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" json:",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 ¶ added in v1.0.0
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 TODO(docs) AgentSelector() Selector IsForAgent(agent *Agent) bool }
HasAgentSelector TODO(docs)
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 ¶
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 TODO(doc) GetLabels() Labels // SetLabels TODO(doc) SetLabels(l Labels) }
Labeled TODO(doc)
type Labels ¶
Labels is a wrapper around Kubernetes labels.Set struct, which is just a type definition for map[string]string.
func LabelsFromMap ¶
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 ¶
LabelsFromMerge merges new labels into existing labels. Any labels with blank values in the merged labels will be removed
func LabelsFromSelector ¶
LabelsFromSelector TODO(doc)
func LabelsFromValidatedMap ¶
LabelsFromValidatedMap returns a set of labels from map that is assumed to already be validated.
func (Labels) BindPlane ¶
BindPlane returns the BindPlane labels, i.e. labels starting with "bindplane/"
func (Labels) Conflicts ¶
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) MarshalJSON ¶
MarshalJSON marshals the Labels as jsoniter. An empty Labels will be marshalled as `{}`
func (*Labels) Scan ¶ added in v1.16.0
Scan is used to translate from a JSONB field in postgres to ResourceType
func (*Labels) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON bytes into the Label's internal Set
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 ¶
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"` }
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
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 (_m *MockResourceStore) EXPECT() *MockResourceStore_Expecter
func (*MockResourceStore) Processor ¶ added in v1.16.0
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
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
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 (_c *MockResourceStore_DestinationType_Call) Return(_a0 *DestinationType, _a1 error) *MockResourceStore_DestinationType_Call
func (*MockResourceStore_DestinationType_Call) Run ¶ added in v1.16.0
func (_c *MockResourceStore_DestinationType_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_DestinationType_Call
func (*MockResourceStore_DestinationType_Call) RunAndReturn ¶ added in v1.16.0
func (_c *MockResourceStore_DestinationType_Call) RunAndReturn(run func(context.Context, string) (*DestinationType, error)) *MockResourceStore_DestinationType_Call
type MockResourceStore_Destination_Call ¶ added in v1.16.0
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 (_c *MockResourceStore_Destination_Call) Return(_a0 *Destination, _a1 error) *MockResourceStore_Destination_Call
func (*MockResourceStore_Destination_Call) Run ¶ added in v1.16.0
func (_c *MockResourceStore_Destination_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_Destination_Call
func (*MockResourceStore_Destination_Call) RunAndReturn ¶ added in v1.16.0
func (_c *MockResourceStore_Destination_Call) RunAndReturn(run func(context.Context, string) (*Destination, error)) *MockResourceStore_Destination_Call
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
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 (_c *MockResourceStore_ProcessorType_Call) Return(_a0 *ProcessorType, _a1 error) *MockResourceStore_ProcessorType_Call
func (*MockResourceStore_ProcessorType_Call) Run ¶ added in v1.16.0
func (_c *MockResourceStore_ProcessorType_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_ProcessorType_Call
func (*MockResourceStore_ProcessorType_Call) RunAndReturn ¶ added in v1.16.0
func (_c *MockResourceStore_ProcessorType_Call) RunAndReturn(run func(context.Context, string) (*ProcessorType, error)) *MockResourceStore_ProcessorType_Call
type MockResourceStore_Processor_Call ¶ added in v1.16.0
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 (_c *MockResourceStore_Processor_Call) Return(_a0 *Processor, _a1 error) *MockResourceStore_Processor_Call
func (*MockResourceStore_Processor_Call) Run ¶ added in v1.16.0
func (_c *MockResourceStore_Processor_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_Processor_Call
func (*MockResourceStore_Processor_Call) RunAndReturn ¶ added in v1.16.0
func (_c *MockResourceStore_Processor_Call) RunAndReturn(run func(context.Context, string) (*Processor, error)) *MockResourceStore_Processor_Call
type MockResourceStore_SourceType_Call ¶ added in v1.16.0
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 (_c *MockResourceStore_SourceType_Call) Return(_a0 *SourceType, _a1 error) *MockResourceStore_SourceType_Call
func (*MockResourceStore_SourceType_Call) Run ¶ added in v1.16.0
func (_c *MockResourceStore_SourceType_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_SourceType_Call
func (*MockResourceStore_SourceType_Call) RunAndReturn ¶ added in v1.16.0
func (_c *MockResourceStore_SourceType_Call) RunAndReturn(run func(context.Context, string) (*SourceType, error)) *MockResourceStore_SourceType_Call
type MockResourceStore_Source_Call ¶ added in v1.16.0
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 (_c *MockResourceStore_Source_Call) Return(_a0 *Source, _a1 error) *MockResourceStore_Source_Call
func (*MockResourceStore_Source_Call) Run ¶ added in v1.16.0
func (_c *MockResourceStore_Source_Call) Run(run func(ctx context.Context, name string)) *MockResourceStore_Source_Call
func (*MockResourceStore_Source_Call) RunAndReturn ¶ added in v1.16.0
func (_c *MockResourceStore_Source_Call) RunAndReturn(run func(context.Context, string) (*Source, error)) *MockResourceStore_Source_Call
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 TODO(doc)
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"` }
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
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 TODO(doc) ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"` // Spec TODO(doc) Spec ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"` StatusType[VersionStatus] `yaml:",inline" json:",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
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) MaskSensitiveParameters ¶ added in v1.19.0
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
PrintableFieldTitles returns the list of field titles, used for printing a table of resources
func (*Processor) PrintableFieldValue ¶ added in v0.5.2
PrintableFieldValue returns the field value for a title, used for printing a table of resources
func (*Processor) ResourceParameters ¶ added in v0.5.2
ResourceParameters are the parameters passed to the ResourceType to generate the configuration
func (*Processor) ResourceTypeName ¶ added in v0.5.2
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" json:",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) }
Resource is implemented by all resources, e.g. SourceType, DestinationType, Configuration, etc.
func NewEmptyResource ¶
NewEmptyResource returns a new empty resource of the specified Kind
func NewEmptyVersionResource ¶ added in v1.16.0
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" json:",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.
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) 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) 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 TODO(doc) Resource Resource `json:"resource" mapstructure:"resource"` // Status TODO(doc) 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 TODO(doc)
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" json:",inline" mapstructure:",squash"` Spec ResourceTypeSpec `json:"spec" yaml:"spec" mapstructure:"spec"` StatusType[VersionStatus] `yaml:",inline" json:",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) 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
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
AgentsPerPhase returns the number of agents that will be updated in the current phase.
func (*Rollout) PrintableFieldTitles ¶ added in v1.16.0
PrintableFieldTitles returns the list of field titles, used for printing a table of resources
func (*Rollout) PrintableFieldValue ¶ added in v1.16.0
PrintableFieldValue returns the field value for a title, used for printing a table of resources
func (*Rollout) PrintableKindPlural ¶ added in v1.16.0
PrintableKindPlural returns the plural form of the Kind, e.g. "Configurations"
func (*Rollout) PrintableKindSingular ¶ added in v1.16.0
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.
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 RolloutStatus ¶ added in v1.16.0
type RolloutStatus int
RolloutStatus is used to track the status of a 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 ¶
Selector TODO(docs)
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 ¶
SelectorFromMap takes a map[string]string and returns a Selector and error.
func SelectorFromString ¶
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 TODO(doc) ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"` // Spec TODO(doc) Spec ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"` StatusType[VersionStatus] `yaml:",inline" json:",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 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) MaskSensitiveParameters ¶ added in v1.19.0
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 ¶
PrintableFieldTitles returns the list of field titles, used for printing a table of resources
func (*Source) PrintableFieldValue ¶
PrintableFieldValue returns the field value for a title, used for printing a table of resources
func (*Source) ResourceParameters ¶
ResourceParameters are the parameters passed to the ResourceType to generate the configuration
func (*Source) ResourceTypeName ¶
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" json:",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.
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" )
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
SplitVersion splits a resource key into the resource key and version.
func SplitVersionDefault ¶ added in v1.16.0
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
MarshalGQL implements the graphql.Marshaler interface.
func (*Version) UnmarshalGQL ¶ added in v1.16.0
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
Source Files
¶
- agent.go
- agent_version.go
- configuration.go
- destination.go
- destination_type.go
- has_unique_key.go
- init.go
- labels.go
- mock_resource_store.go
- parameter.go
- parameterized_resource.go
- printable.go
- processor.go
- processor_type.go
- registry.go
- resource.go
- resource_id.go
- resource_kind.go
- resource_status.go
- resource_status_type.go
- resource_type.go
- rest.go
- secret_key.go
- selector.go
- source.go
- source_type.go
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 |