v1alpha

package
v0.71.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MPL-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package v1alpha represents objects available in API n9/v1alpha

Package v1alpha represents objects available in API n9/v1alpha

Index

Constants

View Source
const (
	//nolint:lll
	IPRegex          string = `` /* 659-byte string literal not displayed */
	URLSchemaRegex   string = `((?i)(https?):\/\/)`
	URLUsernameRegex string = `(\S+(:\S*)?@)`
	URLPathRegex     string = `((\/|\?|#)[^\s]*)`
	URLPortRegex     string = `(:(\d{1,5}))`
	//nolint:lll
	URLIPRegex        string = `([1-9]\d?|1\d\d|2[01]\d|22[0-3]|24\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-5]))`
	URLSubdomainRegex string = `((www\.)|([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])*[a-zA-Z0-9]\.[a-zA-Z0-9]+))`
	//nolint:lll
	URLRegex            = `^` + URLSchemaRegex + URLUsernameRegex + `?` + `((` + URLIPRegex + `|(\[` + IPRegex + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + URLSubdomainRegex + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + URLPortRegex + `?` + URLPathRegex + `?$`
	NumericRegex string = "^[-+]?[0-9]+(?:\\.[0-9]+)?$"
	//nolint:lll
	//cspell:ignore FFFD
	RoleARNRegex         string = `^[\x{0009}\x{000A}\x{000D}\x{0020}-\x{007E}\x{0085}\x{00A0}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+$`
	AzureResourceIDRegex string = `^\/subscriptions\/[a-zA-Z0-9-]+\/resourceGroups\/[a-zA-Z0-9-]+\/providers\/[a-zA-Z0-9-\._]+\/[a-zA-Z0-9-_]+\/[a-zA-Z0-9-_]+$` //nolint:lll
)

Regular expressions for validating URL. It is from https://github.com/asaskevich/govalidator. The same regex is used on the frontend side.

View Source
const (
	LightstepMetricDataType     = "metric"
	LightstepLatencyDataType    = "latency"
	LightstepErrorRateDataType  = "error_rate"
	LightstepTotalCountDataType = "total"
	LightstepGoodCountDataType  = "good"
)
View Source
const (
	PingdomTypeUptime      = "uptime"
	PingdomTypeTransaction = "transaction"
)
View Source
const APIVersion = "n9/v1alpha"

APIVersion is a value of valid apiVersions

GCM aliases GoogleCloudMonitoring. Eventually we should solve this inconsistency between the enum name and its string representation.

View Source
const HiddenValue = "[hidden]"

HiddenValue can be used as a value of a secret field and is ignored during saving

View Source
const MinimalSupportedQueryDelayAgentVersion = "v0.65.0-beta09"

Variables

View Source
var (
	ErrAgentTypeChanged          = fmt.Errorf("cannot change agent type")
	ErrDirectTypeChanged         = fmt.Errorf("cannot change direct type")
	ErrDirectSecretRequired      = fmt.Errorf("direct secrets cannot be empty")
	ErrAlertMethodSecretRequired = fmt.Errorf("alert method secrets cannot be empty")
	ErrAlertMethodTypeChanged    = fmt.Errorf("cannot change alert method type")
)
View Source
var ErrInvalidDataSourceType = errors.New("not a valid DataSourceType")
View Source
var ErrInvalidReleaseChannel = fmt.Errorf("not a valid ReleaseChannel, try [%s]", strings.Join(_ReleaseChannelNames, ", "))

Functions

func DataDogSiteValidationRule added in v0.68.0

func DataDogSiteValidationRule() validation.SingleRule[string]

func FieldRuleMetadataDisplayName added in v0.49.0

func FieldRuleMetadataDisplayName[S any](getter func(S) string) validation.PropertyRules[string, S]

func FieldRuleMetadataLabels added in v0.49.0

func FieldRuleMetadataLabels[S any](getter func(S) Labels) validation.PropertyRules[Labels, S]

func FieldRuleMetadataName added in v0.49.0

func FieldRuleMetadataName[S any](getter func(S) string) validation.PropertyRules[string, S]

func FieldRuleMetadataProject added in v0.49.0

func FieldRuleMetadataProject[S any](getter func(S) string) validation.PropertyRules[string, S]

func FieldRuleSpecDescription added in v0.49.0

func FieldRuleSpecDescription[S any](getter func(S) string) validation.PropertyRules[string, S]

func HistoricalDataRetrievalValidation added in v0.68.0

func HistoricalDataRetrievalValidation() validation.Validator[HistoricalDataRetrieval]

func IsDNS1123Label

func IsDNS1123Label(value string) []string

IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123). nolint:lll Source: https://github.com/kubernetes/kubernetes/blob/fdb2cb4c8832da1499069bda918c014762d8ac05/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go

func IsValidRegion added in v0.59.0

func IsValidRegion(code string, regions []AWSRegion) bool

func OperatorNames added in v0.59.0

func OperatorNames() []string

OperatorNames returns a list of possible string values of Operator.

func QueryDelayValidation added in v0.68.0

func QueryDelayValidation() validation.Validator[QueryDelay]

func ReleaseChannelNames added in v0.23.0

func ReleaseChannelNames() []string

ReleaseChannelNames returns a list of possible string values of ReleaseChannel.

func ReleaseChannelValidation added in v0.68.0

func ReleaseChannelValidation() validation.SingleRule[ReleaseChannel]

func ValidationRuleLabels added in v0.48.0

func ValidationRuleLabels() validation.SingleRule[Labels]

Types

type AWSRegion

type AWSRegion struct {
	RegionName string `json:"regionName"`
	Code       string `json:"code"`
}

func AWSRegions

func AWSRegions() []AWSRegion

AWSRegions returns list of all AWS regions. Data is taken from: https://docs.aws.amazon.com/general/latest/gr/rande.html

type AlertSilence

type AlertSilence struct {
	APIVersion string               `json:"apiVersion"`
	Kind       manifest.Kind        `json:"kind"`
	Metadata   AlertSilenceMetadata `json:"metadata"`
	Spec       AlertSilenceSpec     `json:"spec"`
	Status     *AlertSilenceStatus  `json:"status,omitempty"`

	Organization   string `json:"organization,omitempty"`
	ManifestSource string `json:"manifestSrc,omitempty"`
}

AlertSilence represents alerts silencing configuration for given SLO and AlertPolicy.

func (AlertSilence) GetKind added in v0.28.0

func (a AlertSilence) GetKind() manifest.Kind

func (AlertSilence) GetManifestSource added in v0.28.0

func (a AlertSilence) GetManifestSource() string

func (AlertSilence) GetName added in v0.28.0

func (a AlertSilence) GetName() string

func (AlertSilence) GetOrganization added in v0.28.0

func (a AlertSilence) GetOrganization() string

func (AlertSilence) GetProject added in v0.28.0

func (a AlertSilence) GetProject() string

func (AlertSilence) GetVersion added in v0.28.0

func (a AlertSilence) GetVersion() string

func (AlertSilence) SetManifestSource added in v0.28.0

func (a AlertSilence) SetManifestSource(src string) manifest.Object

func (AlertSilence) SetOrganization added in v0.28.0

func (a AlertSilence) SetOrganization(org string) manifest.Object

func (AlertSilence) SetProject added in v0.28.0

func (a AlertSilence) SetProject(project string) manifest.Object

func (AlertSilence) Validate added in v0.28.0

func (a AlertSilence) Validate() error

type AlertSilenceAlertPolicySource

type AlertSilenceAlertPolicySource struct {
	Name    string `json:"name" validate:"required"`
	Project string `json:"project,omitempty"`
}

AlertSilenceAlertPolicySource represents AlertPolicy attached to the SLO.

type AlertSilenceMetadata added in v0.28.0

type AlertSilenceMetadata struct {
	Name    string `json:"name" validate:"required,objectName" example:"name"`
	Project string `json:"project,omitempty" validate:"objectName" example:"default"`
}

AlertSilenceMetadata defines only basic metadata fields - name and project which uniquely identifies object on project level.

type AlertSilencePeriod

type AlertSilencePeriod struct {
	StartTime string `json:"startTime,omitempty"`
	EndTime   string `json:"endTime,omitempty"`
	Duration  string `json:"duration,omitempty"`
}

AlertSilencePeriod represents time range configuration for AlertSilence.

type AlertSilenceSpec

type AlertSilenceSpec struct {
	Description string                        `json:"description" validate:"description"`
	Slo         string                        `json:"slo" validate:"required"`
	AlertPolicy AlertSilenceAlertPolicySource `json:"alertPolicy" validate:"required"`
	Period      AlertSilencePeriod            `json:"period" validate:"required"`
}

AlertSilenceSpec represents content of AlertSilence's Spec.

func (AlertSilenceSpec) GetParsedDuration

func (a AlertSilenceSpec) GetParsedDuration() (time.Duration, error)

func (AlertSilenceSpec) GetParsedEndTimeUTC

func (a AlertSilenceSpec) GetParsedEndTimeUTC() (time.Time, error)

func (AlertSilenceSpec) GetParsedStartTimeUTC

func (a AlertSilenceSpec) GetParsedStartTimeUTC() (time.Time, error)

type AlertSilenceStatus

type AlertSilenceStatus struct {
	From      string `json:"from"`
	To        string `json:"to"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

AlertSilenceStatus represents content of Status optional for AlertSilence object.

type DataSourceType

type DataSourceType int

DataSourceType represents the type of data source, either Agent or Direct.

Beware that order of these constants is very important existing integrations are saved in db with type = DataSourceType. New integrations always have to be added as last item in this list to get new "type id".

ENUM(

Prometheus = 1 Datadog NewRelic AppDynamics Splunk Lightstep SplunkObservability Dynatrace ThousandEyes Graphite BigQuery Elasticsearch OpenTSDB GrafanaLoki CloudWatch Pingdom AmazonPrometheus Redshift SumoLogic Instana InfluxDB GoogleCloudMonitoring AzureMonitor Generic Honeycomb )

const (
	// Prometheus is a DataSourceType of type Prometheus.
	Prometheus DataSourceType = iota + 1
	// Datadog is a DataSourceType of type Datadog.
	Datadog
	// NewRelic is a DataSourceType of type NewRelic.
	NewRelic
	// AppDynamics is a DataSourceType of type AppDynamics.
	AppDynamics
	// Splunk is a DataSourceType of type Splunk.
	Splunk
	// Lightstep is a DataSourceType of type Lightstep.
	Lightstep
	// SplunkObservability is a DataSourceType of type SplunkObservability.
	SplunkObservability
	// Dynatrace is a DataSourceType of type Dynatrace.
	Dynatrace
	// ThousandEyes is a DataSourceType of type ThousandEyes.
	ThousandEyes
	// Graphite is a DataSourceType of type Graphite.
	Graphite
	// BigQuery is a DataSourceType of type BigQuery.
	BigQuery
	// Elasticsearch is a DataSourceType of type Elasticsearch.
	Elasticsearch
	// OpenTSDB is a DataSourceType of type OpenTSDB.
	OpenTSDB
	// GrafanaLoki is a DataSourceType of type GrafanaLoki.
	GrafanaLoki
	// CloudWatch is a DataSourceType of type CloudWatch.
	CloudWatch
	// Pingdom is a DataSourceType of type Pingdom.
	Pingdom
	// AmazonPrometheus is a DataSourceType of type AmazonPrometheus.
	AmazonPrometheus
	// Redshift is a DataSourceType of type Redshift.
	Redshift
	// SumoLogic is a DataSourceType of type SumoLogic.
	SumoLogic
	// Instana is a DataSourceType of type Instana.
	Instana
	// InfluxDB is a DataSourceType of type InfluxDB.
	InfluxDB
	// GoogleCloudMonitoring is a DataSourceType of type GoogleCloudMonitoring.
	GoogleCloudMonitoring
	// AzureMonitor is a DataSourceType of type AzureMonitor.
	AzureMonitor
	// Generic is a DataSourceType of type Generic.
	Generic
	// Honeycomb is a DataSourceType of type Honeycomb.
	Honeycomb
)

func DataSourceTypeValues added in v0.60.0

func DataSourceTypeValues() []DataSourceType

DataSourceTypeValues returns a list of the values for DataSourceType

func ParseDataSourceType added in v0.60.0

func ParseDataSourceType(name string) (DataSourceType, error)

ParseDataSourceType attempts to convert a string to a DataSourceType.

func (DataSourceType) IsValid added in v0.60.0

func (x DataSourceType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (DataSourceType) String

func (x DataSourceType) String() string

String implements the Stringer interface.

type Duration added in v0.61.3

type Duration struct {
	Value *int         `json:"value" validate:"required,min=0,max=86400"`
	Unit  DurationUnit `json:"unit" validate:"required"`
}

func (Duration) Duration added in v0.61.3

func (d Duration) Duration() time.Duration

func (Duration) IsZero added in v0.61.3

func (d Duration) IsZero() bool

func (Duration) LessThan added in v0.61.3

func (d Duration) LessThan(b Duration) bool

func (Duration) String added in v0.61.3

func (d Duration) String() string

type DurationUnit added in v0.61.3

type DurationUnit string
const (
	Millisecond DurationUnit = "Millisecond"
	Second      DurationUnit = "Second"
	Minute      DurationUnit = "Minute"
	Hour        DurationUnit = "Hour"
)

func DurationUnitFromString added in v0.61.3

func DurationUnitFromString(unit string) (DurationUnit, error)

func (DurationUnit) Duration added in v0.61.3

func (d DurationUnit) Duration() time.Duration

func (DurationUnit) String added in v0.61.3

func (d DurationUnit) String() string

type ErrInvalidPayload

type ErrInvalidPayload struct {
	Msg string
}

func (ErrInvalidPayload) Error

func (e ErrInvalidPayload) Error() string

type GenericObject added in v0.42.0

type GenericObject map[string]interface{}

GenericObject represents a generic map[string]interface{} representation of manifest.Object. It's useful for scenarios where an implementation does not want to be tied to specific v1alpha versions.

func (GenericObject) GetKind added in v0.42.0

func (g GenericObject) GetKind() manifest.Kind

func (GenericObject) GetManifestSource added in v0.42.0

func (g GenericObject) GetManifestSource() string

func (GenericObject) GetName added in v0.42.0

func (g GenericObject) GetName() string

func (GenericObject) GetOrganization added in v0.42.0

func (g GenericObject) GetOrganization() string

func (GenericObject) GetProject added in v0.42.0

func (g GenericObject) GetProject() string

func (GenericObject) GetVersion added in v0.42.0

func (g GenericObject) GetVersion() string

func (GenericObject) SetManifestSource added in v0.42.0

func (g GenericObject) SetManifestSource(src string) manifest.Object

func (GenericObject) SetOrganization added in v0.42.0

func (g GenericObject) SetOrganization(org string) manifest.Object

func (GenericObject) SetProject added in v0.42.0

func (g GenericObject) SetProject(project string) manifest.Object

func (GenericObject) Validate added in v0.42.0

func (g GenericObject) Validate() error

type HistoricalDataRetrieval

type HistoricalDataRetrieval struct {
	MinimumAgentVersion string                      `json:"minimumAgentVersion,omitempty"`
	MaxDuration         HistoricalRetrievalDuration `json:"maxDuration" validate:"required"`
	DefaultDuration     HistoricalRetrievalDuration `json:"defaultDuration" validate:"required"`
}

HistoricalDataRetrieval represents optional parameters for agent to regard when configuring TimeMachine-related SLO properties

type HistoricalRetrievalDuration

type HistoricalRetrievalDuration struct {
	Value *int                            `json:"value" validate:"required,min=0,max=43200"`
	Unit  HistoricalRetrievalDurationUnit `json:"unit" validate:"required"`
}

HistoricalRetrievalDuration struct was previously called Duration. However, this name was too generic since we also needed to introduce a Duration struct for QueryDelay, which allowed for different time units. Time travel is allowed for days/hours/minutes, and query delay can be set to minutes/seconds. Separating those two structs allows for easier validation logic and avoidance of possible mismatches. Also, later on the database level we have time travel duration unit related enum, that's specifically named for data retrieval purposes. Thus, it was easier to split those Durations into separate structures.

func GetDataRetrievalMaxDuration

func GetDataRetrievalMaxDuration(kind manifest.Kind, typ DataSourceType) (HistoricalRetrievalDuration, error)

func (HistoricalRetrievalDuration) BiggerThan

func (HistoricalRetrievalDuration) IsZero

func (d HistoricalRetrievalDuration) IsZero() bool

type HistoricalRetrievalDurationUnit

type HistoricalRetrievalDurationUnit string
const (
	HRDDay    HistoricalRetrievalDurationUnit = "Day"
	HRDHour   HistoricalRetrievalDurationUnit = "Hour"
	HRDMinute HistoricalRetrievalDurationUnit = "Minute"
)

func HistoricalRetrievalDurationUnitFromString

func HistoricalRetrievalDurationUnitFromString(unit string) (HistoricalRetrievalDurationUnit, error)

func (HistoricalRetrievalDurationUnit) IsValid

func (hrdu HistoricalRetrievalDurationUnit) IsValid() bool

func (HistoricalRetrievalDurationUnit) String

type Key added in v0.48.0

type Key = string

type Labels added in v0.28.0

type Labels map[Key][]Value

func (Labels) Validate added in v0.42.0

func (l Labels) Validate() error

Validate checks if the Labels keys and values are valid.

type ObjectContext added in v0.28.0

type ObjectContext interface {
	GetOrganization() string
	SetOrganization(org string) manifest.Object
}

ObjectContext defines method for interacting with contextual details of the Object which are not directly part of its manifest and are, from the users perspective, read only.

type ObjectError added in v0.48.0

type ObjectError struct {
	Object ObjectMetadata            `json:"object"`
	Errors validation.PropertyErrors `json:"errors"`
}

func ValidateObject added in v0.59.0

func ValidateObject[T manifest.Object](validator validation.Validator[T], s T) *ObjectError

func (*ObjectError) Error added in v0.48.0

func (o *ObjectError) Error() string

type ObjectMetadata added in v0.48.0

type ObjectMetadata struct {
	Kind            manifest.Kind `json:"kind"`
	Name            string        `json:"name"`
	Source          string        `json:"source"`
	IsProjectScoped bool          `json:"isProjectScoped"`
	Project         string        `json:"project,omitempty"`
}

type Operator

type Operator int16

Operator is allowed comparing method for labeling sli

const (
	LessThanEqual Operator = iota + 1
	LessThan
	GreaterThanEqual
	GreaterThan
)

func ParseOperator

func ParseOperator(value string) (Operator, error)

ParseOperator parses string to Operator

func (Operator) String

func (m Operator) String() string

type QueryDelay

type QueryDelay struct {
	MinimumAgentVersion string `json:"minimumAgentVersion,omitempty"`
	Duration
}

type QueryDelayDefaults

type QueryDelayDefaults map[DataSourceType]Duration

func GetQueryDelayDefaults

func GetQueryDelayDefaults() QueryDelayDefaults

GetQueryDelayDefaults serves an exported, single source of truth map that is now a part of v1alpha contract. Its entries are used in two places: in one of internal endpoints serving Query Delay defaults, and in internal telegraf intake configuration, where it is passed to plugins as Query Delay defaults.

WARNING: All string values of this map must satisfy the "customDuration" regex pattern.

func (QueryDelayDefaults) Get added in v0.71.0

type ReleaseChannel added in v0.23.0

type ReleaseChannel int

ReleaseChannel /* ENUM(stable = 1, beta, alpha)*/

const (
	// ReleaseChannelStable is a ReleaseChannel of type Stable.
	ReleaseChannelStable ReleaseChannel = iota + 1
	// ReleaseChannelBeta is a ReleaseChannel of type Beta.
	ReleaseChannelBeta
	// ReleaseChannelAlpha is a ReleaseChannel of type Alpha.
	ReleaseChannelAlpha
)

func ParseReleaseChannel added in v0.23.0

func ParseReleaseChannel(name string) (ReleaseChannel, error)

ParseReleaseChannel attempts to convert a string to a ReleaseChannel.

func ReleaseChannelValues added in v0.23.0

func ReleaseChannelValues() []ReleaseChannel

ReleaseChannelValues returns a list of the values for ReleaseChannel

func (ReleaseChannel) IsValid added in v0.23.0

func (x ReleaseChannel) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ReleaseChannel) MarshalText added in v0.23.0

func (r ReleaseChannel) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (ReleaseChannel) String added in v0.23.0

func (x ReleaseChannel) String() string

String implements the Stringer interface.

func (*ReleaseChannel) UnmarshalText added in v0.23.0

func (r *ReleaseChannel) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Validate

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

Validate should not be used directly, create with NewValidator()

func NewValidator

func NewValidator() *Validate

NewValidator returns an instance of preconfigured Validator for all available objects

func (*Validate) Check

func (val *Validate) Check(s interface{}) error

Check performs validation, it accepts all possible structs and perform checks based on tags for structs fields

type Value added in v0.48.0

type Value = string

Directories

Path Synopsis
Package agent defines Agent object definitions.
Package agent defines Agent object definitions.
Package alert defines Alert object definitions.
Package alert defines Alert object definitions.
Package alertmethod defines AlertMethod object definitions.
Package alertmethod defines AlertMethod object definitions.
Package alertpolicy defines AlertPolicy object definitions and validation.
Package alertpolicy defines AlertPolicy object definitions and validation.
Package annotation defines Annotation object definitions.
Package annotation defines Annotation object definitions.
Package dataexport defines DataExport object definitions.
Package dataexport defines DataExport object definitions.
Package direct defines Direct object definitions.
Package direct defines Direct object definitions.
Package parser provides parsing methods for v1alpha objects.
Package parser provides parsing methods for v1alpha objects.
Package project defines Project object definitions.
Package project defines Project object definitions.
Package rolebinding defines RoleBinding object definitions.
Package rolebinding defines RoleBinding object definitions.
Package service defines Service object definitions.
Package service defines Service object definitions.
Package slo defines SLO object definitions.
Package slo defines SLO object definitions.
Package twindow provides enums and functions to operate with resources related to Time Windows
Package twindow provides enums and functions to operate with resources related to Time Windows
Package usergroup defines UserGroup object definitions.
Package usergroup defines UserGroup object definitions.

Jump to

Keyboard shortcuts

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