entities

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash added in v0.41.0

func Hash(org string, entity HashableEntity) string

Types

type AlertPolicy added in v0.45.0

type AlertPolicy struct {
	TypeMeta `json:",inline" yaml:",inline"`
	Metadata Metadata   `json:"metadata"`
	Spec     PolicySpec `json:"spec"`
}

func NewAlertPolicy added in v0.45.0

func NewAlertPolicy() *AlertPolicy

func (*AlertPolicy) Kind added in v0.45.0

func (a *AlertPolicy) Kind() string

func (*AlertPolicy) Validate added in v0.45.0

func (a *AlertPolicy) Validate() error

func (*AlertPolicy) Version added in v0.45.0

func (a *AlertPolicy) Version() string

type DeepEntity added in v0.25.0

type DeepEntity interface {
	Entity
	Metadata() Metadata
	Spec() map[string]interface{}
}

type Edge added in v0.20.0

type Edge struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

type Entity

type Entity interface {
	Version() string
	Kind() string
	Validate() error
}

Entity is the interface of an entity object It can be used for type asserting

type EntityContext added in v0.31.0

type EntityContext struct {
	Metadata Metadata `json:"metadata"`
}

EntityContext - Entity Contexts are used to represent arbitrary or custom entities defined by the user. They are comprised solely of Metadata.

func (*EntityContext) Kind added in v0.31.0

func (c *EntityContext) Kind() string

func (*EntityContext) Validate added in v0.31.0

func (c *EntityContext) Validate() error

func (*EntityContext) Version added in v0.31.0

func (c *EntityContext) Version() string

type HashableEntity added in v0.41.0

type HashableEntity interface {
	Entity
	GetMetadata() Metadata
}

type Indicator

type Indicator struct {
	TypeMeta `json:",inline" yaml:",inline"`
	Metadata `json:"metadata,omitempty"`

	Spec IndicatorSpec `json:"spec" yaml:"spec"`
}

func NewIndicator added in v0.21.0

func NewIndicator() *Indicator

NewIndicator returns a new instance of the Indicator struct with non-zero values for internal maps

func NewIndicatorForObjective added in v0.21.0

func NewIndicatorForObjective(o *Objective, from time.Time, to time.Time) *Indicator

func (*Indicator) Kind

func (i *Indicator) Kind() string

func (*Indicator) Validate added in v0.25.1

func (i *Indicator) Validate() error

func (*Indicator) Version

func (i *Indicator) Version() string

type IndicatorSpec

type IndicatorSpec struct {
	From    time.Time `json:"from"`
	To      time.Time `json:"to"`
	Percent float64   `json:"percent"`
}

type Labels

type Labels map[string]string

func (Labels) AssertHasFields added in v0.40.0

func (l Labels) AssertHasFields(fields ...string) error

type Manifest

type Manifest []*Objective

Manifest - a slice of Objectives

func (*Manifest) Hash added in v0.20.0

func (m *Manifest) Hash() string

Hash - returns an MD5 hash of the manifest

func (*Manifest) LoadFromFile

func (m *Manifest) LoadFromFile(path string) (err error)

type ManifestContents added in v0.25.1

type ManifestContents []DeepEntity

func LoadFromFile added in v0.25.0

func LoadFromFile(path string) (ManifestContents, error)

func (ManifestContents) Objectives added in v0.25.1

func (m ManifestContents) Objectives() []*Objective

type ManifestObject added in v0.25.0

type ManifestObject struct {
	APIVersion    string                 `json:"apiVersion" yaml:"apiVersion"`
	KindValue     string                 `json:"kind" yaml:"kind"`
	MetadataValue Metadata               `json:"metadata" yaml:"metadata"`
	SpecValue     map[string]interface{} `json:"spec" yaml:"spec"`
}

func (*ManifestObject) Kind added in v0.25.0

func (t *ManifestObject) Kind() string

func (*ManifestObject) Metadata added in v0.25.0

func (t *ManifestObject) Metadata() Metadata

func (*ManifestObject) Spec added in v0.25.0

func (t *ManifestObject) Spec() map[string]interface{}

func (*ManifestObject) Validate added in v0.25.0

func (t *ManifestObject) Validate() error

func (*ManifestObject) Version added in v0.25.0

func (t *ManifestObject) Version() string

type Metadata

type Metadata struct {
	// Name of the object representation
	Name string `json:"-" yaml:"-"`

	// Map of string keys and values that can be used to identify an entity
	Labels Labels `json:"labels,omitempty" yaml:"labels,omitempty"`

	// List of map of string keys and values that can be used to link entities together
	// by identifying relationships
	// All string keys and values in the same map are mandatory to make a link (AND operand)
	// while any map of the list is necessary to make a link (OR operand)
	// example:
	// RelatedTo:
	//   - service:web
	//     region:us
	//   - service:web
	//     region:eu
	// In this example, the current object representation will be linked to
	// any other entity that is a web service and located in US or EU regions
	RelatedTo []map[string]string `json:"relatedTo,omitempty" yaml:"relatedTo,omitempty"`

	// Map of string keys and values that are additional information about an entity
	Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}

ObjectMeta is metadata that all entities must have

func (Metadata) GetSelector added in v0.44.0

func (m Metadata) GetSelector() string

turn labels into a base64 encoded selector

func (Metadata) Validate added in v0.25.1

func (m Metadata) Validate() error

type Node added in v0.20.0

type Node struct {
	ID       string      `json:"id"`
	Metadata Metadata    `json:"metadata"`
	Kind     string      `json:"kind"`
	Spec     interface{} `json:"spec"`
}

type NodeGraph added in v0.20.0

type NodeGraph struct {
	Nodes []*Node `json:"nodes"`
	Edges []*Edge `json:"edges"`
}

func (*NodeGraph) MarshalJSON added in v0.20.0

func (g *NodeGraph) MarshalJSON() ([]byte, error)

MarshalJSON - custom JSON unmarshaller for NodeGraph type used to insure that empty values are returned instead of null

Eg:

{ "nodes": [], "edges": [] }
vs.
{ "nodes": null, "edges": null }

type Objective

type Objective struct {
	TypeMeta `json:",inline" yaml:",inline"`
	Metadata `json:"metadata,omitempty"`

	Spec ObjectiveSpec `json:"spec" yaml:"spec"`
}

func NewObjective

func NewObjective() *Objective

NewObjective returns a new instance of the Objective struct with non-zero values for internal maps

func (*Objective) GetIndicatorsLabelsAsSelector added in v0.44.0

func (o *Objective) GetIndicatorsLabelsAsSelector() string

turn indicator labels into a base64 encoded selector

func (*Objective) GetMetadata added in v0.41.0

func (o *Objective) GetMetadata() Metadata

func (*Objective) Kind

func (o *Objective) Kind() string

func (*Objective) Validate added in v0.40.0

func (o *Objective) Validate() error

func (*Objective) Version

func (o *Objective) Version() string

type ObjectiveResult

type ObjectiveResult struct {
	TypeMeta                `json:",inline" yaml:",inline"`
	ObjectiveResultResponse `json:",inline" yaml:",inline"`
}

func (ObjectiveResult) GetMetadata added in v0.44.0

func (o ObjectiveResult) GetMetadata() Metadata

func (ObjectiveResult) Kind

func (o ObjectiveResult) Kind() string

func (*ObjectiveResult) Validate added in v0.40.0

func (o *ObjectiveResult) Validate() error

func (ObjectiveResult) Version

func (o ObjectiveResult) Version() string

type ObjectiveResultResponse

type ObjectiveResultResponse struct {
	Metadata `json:"metadata,omitempty"`
	Spec     ObjectiveResultSpec `json:"spec" yaml:"spec"`
}

type ObjectiveResultSpec

type ObjectiveResultSpec struct {
	IndicatorSelector Selector `json:"indicatorSelector" yaml:"indicatorSelector"`
	ObjectivePercent  float64  `json:"objectivePercent" yaml:"objectivePercent"`
	ActualPercent     float64  `json:"actualPercent" yaml:"actualPercent"`
	RemainingPercent  float64  `json:"remainingPercent" yaml:"remainingPercent"`
}

type ObjectiveScore added in v0.44.0

type ObjectiveScore struct {
	TypeMeta `json:",inline" yaml:",inline"`
	Metadata `json:"metadata,omitempty"`

	Spec ObjectiveScoreSpec `json:"spec" yaml:"spec"`
}

func (*ObjectiveScore) GetMetadata added in v0.44.0

func (o *ObjectiveScore) GetMetadata() Metadata

func (*ObjectiveScore) Kind added in v0.44.0

func (o *ObjectiveScore) Kind() string

func (*ObjectiveScore) Validate added in v0.44.0

func (o *ObjectiveScore) Validate() error

func (*ObjectiveScore) Version added in v0.44.0

func (o *ObjectiveScore) Version() string

type ObjectiveScoreSpec added in v0.44.0

type ObjectiveScoreSpec struct {
	ObjectiveResultSelector    Selector `json:"objectiveResultSelector" yaml:"objectiveResultSelector"`
	TargetDeltaPercentage      float64  `json:"targetDeltaPercentage" yaml:"targetDeltaPercentage"`
	ReliabilityScore           float64  `json:"reliabilityScore" yaml:"reliabilityScore"`
	HistoricalReliabilityScore float64  `json:"historicalReliabilityScore" yaml:"historicalReliabilityScore"`
}

type ObjectiveSpec

type ObjectiveSpec struct {
	IndicatorSelector Selector      `json:"indicatorSelector" yaml:"indicatorSelector"`
	ObjectivePercent  float64       `json:"objectivePercent" yaml:"objectivePercent"`
	Window            core.Duration `json:"window" yaml:"window"`
}

type Operation added in v0.32.0

type Operation struct {
	Metadata Metadata      `json:"metadata"`
	Spec     OperationSpec `json:"spec"`
}

type OperationSpec added in v0.32.0

type OperationSpec struct {
	Outcome string `json:"outcome"`
}

type PolicySpec added in v0.45.0

type PolicySpec struct {
	Threshold     float64  `json:"threshold"`
	AlertChannels []Labels `json:"alertChannels"`
	Severity      int      `json:"severity"`
	MessageBody   string   `json:"messageBody"`
	Enabled       bool     `json:"enabled"`
}

type ScoreCard added in v0.44.0

type ScoreCard struct {
	TypeMeta `json:",inline" yaml:",inline"`
	Metadata `json:"metadata,omitempty"`

	Spec ScoreCardSpec `json:"spec" yaml:"spec"`
}

func (*ScoreCard) GetMetadata added in v0.44.0

func (sc *ScoreCard) GetMetadata() Metadata

func (*ScoreCard) GetSpec added in v0.44.0

func (sc *ScoreCard) GetSpec() ScoreCardSpec

func (*ScoreCard) Kind added in v0.44.0

func (sc *ScoreCard) Kind() string

func (*ScoreCard) Validate added in v0.44.0

func (sc *ScoreCard) Validate() error

func (*ScoreCard) Version added in v0.44.0

func (sc *ScoreCard) Version() string

type ScoreCardSpec added in v0.44.0

type ScoreCardSpec struct {
	ObjectivesSelector []Selector `json:"objectivesSelector" yaml:"objectivesSelector"`
	ReliabilityScore   float64    `json:"reliabilityScore" yaml:"reliabilityScore"`
}

type Selector

type Selector Labels

type TypeMeta

type TypeMeta struct {
	// APIVersion defines the versioned schema of this representation of an object
	APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`

	// Kind is a string value representing the REST resource this object represents.
	// In CamelCase.
	Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
}

TypeMeta describes an individual object in the entity API with strings representing the type of the object and its API schema version

Jump to

Keyboard shortcuts

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