nobl9

package module
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

README

N9

checks tests vulnerabilities

Nobl9 SDK, WORK IN PROGRESS...

Documentation

Overview

Package nobl9 provide an abstraction for communication with API

Package nobl9 provide an abstraction for communication with API

Index

Constants

View Source
const (
	KindSLO         = "SLO"
	KindService     = "Service"
	KindAgent       = "Agent"
	KindProject     = "Project"
	KindAlertPolicy = "AlertPolicy"
	KindAlert       = "Alert"
	KindAlertMethod = "AlertMethod"
	KindDirect      = "Direct"
	KindDataExport  = "DataExport"
	KindRoleBinding = "RoleBinding"
)

Possible values of field kind for valid Objects.

View Source
const (
	HeaderOrganization  = "organization"
	HeaderProject       = "project"
	HeaderAuthorization = "Authorization"
	HeaderUserAgent     = "User-Agent"
	HeaderClientID      = "ClientID"
)

HTTP headers keys used across app

View Source
const (
	QueryKeyName        = "name"
	QueryKeyTime        = "t"
	QueryKeyFrom        = "from"
	QueryKeyTo          = "to"
	QueryKeySeries      = "series"
	QueryKeySteps       = "steps"
	QueryKeySlo         = "slo"
	QueryKeyTimeWindow  = "window"
	QueryKeyPercentiles = "q"
)

HTTP GET query keys used across app

View Source
const (
	P1  string = "p1"
	P5  string = "p5"
	P10 string = "p10"
	P50 string = "p50"
	P90 string = "p90"
	P95 string = "p95"
	P99 string = "p99"
)
View Source
const (
	APIVersion = "n9/v1alpha"
)

APIVersion is a value of valid apiVersions

View Source
const DefaultProject = "default"

DefaultProject is a value of the default project.

View Source
const HiddenValue = "[hidden]"

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

View Source
const ProjectsWildcard = "*"

ProjectsWildcard is used in HeaderProject when requesting for all projects

View Source
const (
	Timeout = 10 * time.Second
)

Timeout use for every request

Variables

View Source
var ErrConcurrencyIssue = errors.New("operation failed due to concurrency issue but can be retried")

Functions

func EnhanceError

func EnhanceError(o ObjectGeneric, err error) error

EnhanceError annotates error with path of manifest source, if it exists it not returns the same error as passed as argument

func GetAvailablePercentiles

func GetAvailablePercentiles() []string

func IsDNS1123Label

func IsDNS1123Label(value string) []string

IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).

func IsObjectAvailable

func IsObjectAvailable(o Object) bool

IsObjectAvailable returns true if given object is available in SDK.

func Parse

func Parse(o ObjectGeneric, parsedObjects *APIObjects, onlyHeaders bool) error

Parse takes care of all Object supported by n9/v1alpha apiVersion

func UnsupportedKindErr

func UnsupportedKindErr(o ObjectGeneric) error

UnsupportedKindErr returns appropriate error for missing value in field kind for not empty field kind returns always that is not supported for this apiVersion so have to be validated before

Types

type APIObjects

type APIObjects struct {
	SLOs          []SLO
	Services      []Service
	Agents        []Agent
	AlertPolicies []AlertPolicy
	Alerts        []Alert
	AlertMethods  []AlertMethod
	Directs       []Direct
	DataExports   []DataExport
	Projects      []Project
	RoleBindings  []RoleBinding
}

APIObjects - all Objects available for this version of API Sorted in order of applying

type Agent

type Agent struct {
	ObjectHeader
	Spec   AgentSpec   `json:"spec"`
	Status AgentStatus `json:"status"`
}

Agent struct which mapped one to one with kind: Agent yaml definition.

type AgentSpec

type AgentSpec struct {
	Description         string                          `json:"description,omitempty"`
	SourceOf            []string                        `json:"sourceOf" example:"Metrics,Services"`
	ReleaseChannel      string                          `json:"releaseChannel,omitempty" example:"beta,stable"`
	QueryDelay          *QueryDelayDuration             `json:"queryDelay"`
	AmazonPrometheus    *AmazonPrometheusAgentConfig    `json:"amazonPrometheus,omitempty"`
	AppDynamics         *AppDynamicsAgentConfig         `json:"appDynamics,omitempty"`
	BigQuery            *BigQueryAgentConfig            `json:"bigQuery,omitempty"`
	CloudWatch          *CloudWatchAgentConfig          `json:"cloudWatch,omitempty"`
	Datadog             *DatadogAgentConfig             `json:"datadog,omitempty"`
	Dynatrace           *DynatraceAgentConfig           `json:"dynatrace,omitempty"`
	Elasticsearch       *ElasticsearchAgentConfig       `json:"elasticsearch,omitempty"`
	GCM                 *GCMAgentConfig                 `json:"gcm,omitempty"`
	GrafanaLoki         *GrafanaLokiAgentConfig         `json:"grafanaLoki,omitempty"`
	Graphite            *GraphiteAgentConfig            `json:"graphite,omitempty"`
	InfluxDB            *InfluxDBAgentConfig            `json:"influxdb,omitempty"`
	Instana             *InstanaAgentConfig             `json:"instana,omitempty"`
	Lightstep           *LightstepAgentConfig           `json:"lightstep,omitempty"`
	NewRelic            *NewRelicAgentConfig            `json:"newRelic,omitempty"`
	OpenTSDB            *OpenTSDBAgentConfig            `json:"opentsdb,omitempty"`
	Pingdom             *PingdomAgentConfig             `json:"pingdom,omitempty"`
	Prometheus          *PrometheusAgentConfig          `json:"prometheus,omitempty"`
	Redshift            *RedshiftAgentConfig            `json:"redshift,omitempty"`
	Splunk              *SplunkAgentConfig              `json:"splunk,omitempty"`
	SplunkObservability *SplunkObservabilityAgentConfig `json:"splunkObservability,omitempty"`
	SumoLogic           *SumoLogicAgentConfig           `json:"sumoLogic,omitempty"`
	ThousandEyes        *ThousandEyesAgentConfig        `json:"thousandEyes,omitempty"`
}

AgentSpec represents content of Spec typical for Agent Object.

type AgentStatus

type AgentStatus struct {
	AgentType      string `json:"agentType" example:"Prometheus"`
	AgentVersion   string `json:"agentVersion,omitempty" example:"0.0.9"`
	LastConnection string `json:"lastConnection,omitempty" example:"2020-08-31T14:26:13Z"`
}

AgentStatus represents content of Status optional for Agent Object.

type AgentWithSLOs

type AgentWithSLOs struct {
	Agent Agent `json:"agent"`
	SLOs  []SLO `json:"slos"`
}

AgentWithSLOs struct which mapped one to one with kind: agent and slo yaml definition.

type Alert

type Alert struct {
	ObjectHeader
	Spec AlertSpec `json:"spec"`
}

Alert represents triggered alert

type AlertCondition

type AlertCondition struct {
	Measurement      string      `json:"measurement"`
	Value            interface{} `json:"value"`
	LastsForDuration string      `json:"lastsFor,omitempty"` //nolint:lll
	CoolDownDuration string      `json:"coolDown,omitempty"` //nolint:lll
	Operator         string      `json:"op"`
}

AlertCondition represents a condition to meet to trigger an alert.

type AlertMethod

type AlertMethod struct {
	ObjectHeader
	Spec AlertMethodSpec `json:"spec"`
}

AlertMethod represents the configuration required to send a notification to an external service when an alert is triggered.

type AlertMethodAssignment

type AlertMethodAssignment struct {
	Project string `json:"project,omitempty"`
	Name    string `json:"name"`
}

AlertMethodAssignment represents an AlertMethod assigned to AlertPolicy.

type AlertMethodSpec

type AlertMethodSpec struct {
	Description string                 `json:"description"`
	Webhook     *WebhookAlertMethod    `json:"webhook,omitempty"`
	PagerDuty   *PagerDutyAlertMethod  `json:"pagerduty,omitempty"`
	Slack       *SlackAlertMethod      `json:"slack,omitempty"`
	Discord     *DiscordAlertMethod    `json:"discord,omitempty"`
	Opsgenie    *OpsgenieAlertMethod   `json:"opsgenie,omitempty"`
	ServiceNow  *ServiceNowAlertMethod `json:"servicenow,omitempty"`
	Jira        *JiraAlertMethod       `json:"jira,omitempty"`
	Teams       *TeamsAlertMethod      `json:"msteams,omitempty"`
	Email       *EmailAlertMethod      `json:"email,omitempty"`
}

AlertMethodSpec represents content of AlertMethod's Spec.

type AlertMethodWithAlertPolicy

type AlertMethodWithAlertPolicy struct {
	AlertMethod   PublicAlertMethod `json:"alertMethod"`
	AlertPolicies []AlertPolicy     `json:"alertPolicies"`
}

type AlertPolicy

type AlertPolicy struct {
	ObjectHeader
	Spec AlertPolicySpec `json:"spec"`
}

AlertPolicy represents a set of conditions that can trigger an alert.

type AlertPolicySpec

type AlertPolicySpec struct {
	Description  string              `json:"description"`
	Severity     string              `json:"severity"`
	Conditions   []AlertCondition    `json:"conditions"`
	AlertMethods []PublicAlertMethod `json:"alertMethods"`
}

AlertPolicySpec represents content of AlertPolicy's Spec.

func (AlertPolicySpec) GetAlertMethods

func (spec AlertPolicySpec) GetAlertMethods() []PublicAlertMethod

type AlertPolicyWithSLOs

type AlertPolicyWithSLOs struct {
	AlertPolicy AlertPolicy `json:"alertPolicy"`
	SLOs        []SLO       `json:"slos"`
}

AlertPolicyWithSLOs struct which mapped one to one with kind: alert policy and slo yaml definition

type AlertSpec

type AlertSpec struct {
	AlertPolicy    Metadata `json:"alertPolicy"`
	SLO            Metadata `json:"slo"`
	Service        Metadata `json:"service"`
	ThresholdValue float64  `json:"thresholdValue,omitempty"`
	ClockTime      string   `json:"clockTime,omitempty"`
	Severity       string   `json:"severity"`
}

AlertSpec represents content of Alert's Spec

type AmazonPrometheusAgentConfig added in v0.3.0

type AmazonPrometheusAgentConfig struct {
	URL    string `json:"url" validate:"required,url"`
	Region string `json:"region" validate:"required,max=255"`
}

AmazonPrometheusAgentConfig represents content of Amazon Managed Service Configuration typical for Agent Object.

type AmazonPrometheusMetric added in v0.3.0

type AmazonPrometheusMetric struct {
	PromQL *string `json:"promql"`
}

AmazonPrometheusMetric describes metric from AmazonPrometheus server.

type AnomalyConfig added in v0.9.0

type AnomalyConfig struct {
	NoData *AnomalyConfigNoData `json:"noData" validate:"omitempty"`
}

AnomalyConfig represents relationship between anomaly type and selected notification methods.

type AnomalyConfigAlertMethod added in v0.9.0

type AnomalyConfigAlertMethod struct {
	Name    string `json:"name" validate:"required,objectName" example:"slack-monitoring-channel"`
	Project string `json:"project,omitempty" validate:"objectName" example:"default"`
}

AnomalyConfigAlertMethod represents a single alert method used in AnomalyConfig defined by name and project.

type AnomalyConfigNoData added in v0.9.0

type AnomalyConfigNoData struct {
	AlertMethods []AnomalyConfigAlertMethod `json:"alertMethods" validate:"required"`
}

AnomalyConfigNoData contains alertMethods used for No Data anomaly type.

type AnyJSONObj

type AnyJSONObj = map[string]interface{}

AnyJSONObj can store a generic representation on any valid JSON

func Annotate

func Annotate(
	object AnyJSONObj,
	org string,
) AnyJSONObj

Annotate injects to objects additional organization field

type AppDynamicsAgentConfig

type AppDynamicsAgentConfig struct {
	URL *string `json:"url,omitempty" example:"https://nobl9.saas.appdynamics.com"`
}

AppDynamicsAgentConfig represents content of AppDynamics Configuration typical for Agent Object.

type AppDynamicsConfig

type AppDynamicsConfig struct {
	URL string `json:"url,omitempty" example:"https://nobl9.saas.appdynamics.com"`
}

AppDynamicsConfig represents content of AppDynamics Configuration typical for DataSource Object.

type AppDynamicsDirectConfig

type AppDynamicsDirectConfig struct {
	URL          string `json:"url,omitempty" validate:"httpsURL" example:"https://{tenant}.saas.appdynamics.com"`
	AccountName  string `json:"accountName,omitempty" example:"accountID"`
	ClientID     string `json:"clientID,omitempty" example:"apiClientID@accountID"`
	ClientSecret string `json:"clientSecret,omitempty" example:"secret"`
	ClientName   string `json:"clientName,omitempty" example:"apiClientID"`
}

AppDynamicsDirectConfig represents content of AppDynamics configuration typical for Direct Object

type AppDynamicsMetric

type AppDynamicsMetric struct {
	ApplicationName *string `json:"applicationName"`
	MetricPath      *string `json:"metricPath"`
}

AppDynamicsMetric describes metric from AppDynamics

type Attachment

type Attachment struct {
	URL         string  `json:"url"`
	DisplayName *string `json:"displayName,omitempty"`
}

Attachment represents user defined URL attached to SLO

type BigQueryAgentConfig

type BigQueryAgentConfig struct{}

BigQueryAgentConfig represents content of BigQuery configuration. Since the agent does not require additional configuration this is just a marker struct.

type BigQueryDirectConfig

type BigQueryDirectConfig struct {
	ServiceAccountKey string `json:"serviceAccountKey,omitempty" example:"secret"`
}

BigQueryDirectConfig represents content of BigQuery configuration typical for Direct Object.

type BigQueryMetric

type BigQueryMetric struct {
	Query     string `json:"query"`
	ProjectID string `json:"projectId"`
	Location  string `json:"location"`
}

BigQueryMetric describes metric from BigQuery.

type BurnDownTimeSeries

type BurnDownTimeSeries struct {
	BurnDown []TimeSeriesData `json:"burnDown,omitempty"`
}

type Calendar

type Calendar struct {
	StartTime string `json:"startTime"`
	TimeZone  string `json:"timeZone"`
}

Calendar struct represents calendar time window

type Client

type Client struct {
	Creds Credentials
	// contains filtered or unexported fields
}

Client represents API high level client

func NewClient

func NewClient(ingestURL, organization, project, userAgent string, clientID string, clientSecret string, oktaOrgURL, oktaAuthServer string) (*Client, error)

NewClient returns fully configured instance of API high level client

func (*Client) ApplyAgents added in v0.4.0

func (c *Client) ApplyAgents(objects []AnyJSONObj) ([]objectData, error)

ApplyAgents applies (create or update) list of agents passed as argument via API and returns agent data on creation.

func (*Client) ApplyObjects

func (c *Client) ApplyObjects(objects []AnyJSONObj) error

ApplyObjects applies (create or update) list of objects passed as argument via API.

func (*Client) DeleteObjects

func (c *Client) DeleteObjects(objects []AnyJSONObj) error

DeleteObjects deletes list of objects passed as argument via API.

func (*Client) DeleteObjectsByName

func (c *Client) DeleteObjectsByName(object Object, names ...string) error

DeleteObjectsByName makes a call to endpoint for deleting objects with passed names and object types.

func (*Client) GetAWSExternalID

func (c *Client) GetAWSExternalID() (string, error)

func (*Client) GetAgents added in v0.8.1

func (c *Client) GetAgents(timestamp string, names ...string) ([]Agent, error)

GetAgents returns array of Agent, when names are passed - query for these names otherwise returns list of all available objects.

func (*Client) GetBearerHeader

func (c *Client) GetBearerHeader() string

GetBearerHeader returns an authorization header which should be included if not empty in requests to the resource server

func (*Client) GetDirects added in v0.7.0

func (c *Client) GetDirects(timestamp string, names ...string) ([]Direct, error)

GetDirects returns array of Direct, when names are passed - query for these names otherwise returns list of all available objects.

func (*Client) GetObject

func (c *Client) GetObject(object Object, timestamp string, names ...string) ([]AnyJSONObj, error)

GetObject returns array of supported type of Objects, when names are passed - query for these names otherwise returns list of all available objects.

func (*Client) GetTimeSeries

func (c *Client) GetTimeSeries(
	timeSeries TimeSerie, sloName string, from, to time.Time, steps int,
) (interface{}, error)

type CloudWatchAgentConfig added in v0.3.0

type CloudWatchAgentConfig struct {
}

CloudWatchAgentConfig represents content of CloudWatch Configuration typical for Agent Object.

type CloudWatchDirectConfig added in v0.7.0

type CloudWatchDirectConfig struct {
	AccessKeyID     string `json:"accessKeyID,omitempty" example:"secret"`
	SecretAccessKey string `json:"secretAccessKey,omitempty" example:"secret"`
}

CloudWatchDirectConfig represents content of CloudWatch configuration typical for Direct Object.

type CloudWatchMetric

type CloudWatchMetric struct {
	Region     *string                     `json:"region"`
	Namespace  *string                     `json:"namespace"`
	MetricName *string                     `json:"metricName"`
	Stat       *string                     `json:"stat"`
	Dimensions []CloudWatchMetricDimension `json:"dimensions"`
	SQL        *string                     `json:"sql"`
	JSON       *string                     `json:"json"`
}

CloudWatchMetric describes metric from CloudWatch.

type CloudWatchMetricDimension

type CloudWatchMetricDimension struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

CloudWatchMetricDimension describes name/value pair that is part of the identity of a metric.

type Composite

type Composite struct {
	BudgetTarget      float64                     `json:"target"`
	BurnRateCondition *CompositeBurnRateCondition `json:"burnRateCondition"`
}

type CompositeBurnRateCondition

type CompositeBurnRateCondition struct {
	Value    float64 `json:"value"`
	Operator string  `json:"op,omitempty" example:"gte"`
}

type CountMetricsSpec

type CountMetricsSpec struct {
	Incremental *bool       `json:"incremental"`
	GoodMetric  *MetricSpec `json:"good"`
	TotalMetric *MetricSpec `json:"total"`
}

CountMetricsSpec represents set of two time series of good and total counts

type CountsSLITimeSeries

type CountsSLITimeSeries struct {
	GoodCount  TimeSeriesData `json:"goodCount,omitempty"`
	TotalCount TimeSeriesData `json:"totalCount,omitempty"`
}

type Credentials

type Credentials struct {
	ClientID     string
	ClientSecret string
	AccessToken  string
	// contains filtered or unexported fields
}

Credentials stores Okta service-to-service app credentials

type CumulativeBurnedTimeSeries

type CumulativeBurnedTimeSeries struct {
	CumulativeBurned TimeSeriesData `json:"cumulativeBurned,omitempty"`
}

type DataExport

type DataExport struct {
	ObjectHeader
	Spec   DataExportSpec   `json:"spec"`
	Status DataExportStatus `json:"status"`
}

DataExport struct which mapped one to one with kind: DataExport yaml definition

type DataExportSpec

type DataExportSpec struct {
	ExportType string      `json:"exportType"`
	Spec       interface{} `json:"spec"`
}

DataExportSpec represents content of DataExport's Spec

type DataExportStatus

type DataExportStatus struct {
	ExportJob     DataExportStatusJob `json:"exportJob"`
	AWSExternalID *string             `json:"awsExternalID,omitempty"`
}

DataExportStatus represents content of Status optional for DataExport Object

type DataExportStatusJob

type DataExportStatusJob struct {
	Timestamp string `json:"timestamp,omitempty" example:"2021-02-09T10:43:07Z"`
	State     string `json:"state" example:"finished"`
}

DataExportStatusJob represents content of ExportJob status

type DataSourceStatus

type DataSourceStatus struct {
	DataSourceType string `json:"dataSourceType" example:"Prometheus"`
}

DataSourceStatus represents content of Status optional for DataSource Object.

type DatadogAgentConfig

type DatadogAgentConfig struct {
	Site string `json:"site,omitempty"`
}

DatadogAgentConfig represents content of Datadog Configuration typical for Agent Object.

type DatadogConfig

type DatadogConfig struct {
	Site string `json:"site,omitempty"`
}

DatadogConfig represents content of Datadog Configuration typical for DataSource Object.

type DatadogDirectConfig

type DatadogDirectConfig struct {
	Site           string `json:"site,omitempty" example:"eu"`
	APIKey         string `json:"apiKey,omitempty" example:"secret"`
	ApplicationKey string `json:"applicationKey,omitempty" example:"secret"`
}

DatadogDirectConfig represents content of Datadog configuration typical for Direct Object.

type DatadogMetric

type DatadogMetric struct {
	Query *string `json:"query"`
}

DatadogMetric describes metric from Datadog

type Direct

type Direct struct {
	ObjectHeader
	Spec   DirectSpec   `json:"spec"`
	Status DirectStatus `json:"status"`
}

Direct struct which mapped one to one with kind: Direct yaml definition

type DirectSpec

type DirectSpec struct {
	Description             string                           `json:"description,omitempty" example:"Datadog description"` //nolint:lll
	SourceOf                []string                         `json:"sourceOf" example:"Metrics,Services"`
	ReleaseChannel          string                           `json:"releaseChannel,omitempty" example:"beta,stable"`
	LogCollectionEnabled    *bool                            `json:"logCollectionEnabled,omitempty"`
	HistoricalDataRetrieval *HistoricalDataRetrieval         `json:"historicalDataRetrieval"`
	QueryDelay              *QueryDelayDuration              `json:"queryDelay"`
	AppDynamics             *AppDynamicsDirectConfig         `json:"appDynamics,omitempty"`
	BigQuery                *BigQueryDirectConfig            `json:"bigQuery,omitempty"`
	CloudWatch              *CloudWatchDirectConfig          `json:"cloudWatch,omitempty"`
	Datadog                 *DatadogDirectConfig             `json:"datadog,omitempty"`
	Dynatrace               *DynatraceDirectConfig           `json:"dynatrace,omitempty"`
	GCM                     *GCMDirectConfig                 `json:"gcm,omitempty"`
	InfluxDB                *InfluxDBDirectConfig            `json:"influxdb,omitempty"`
	Instana                 *InstanaDirectConfig             `json:"instana,omitempty"`
	Lightstep               *LightstepDirectConfig           `json:"lightstep,omitempty"`
	NewRelic                *NewRelicDirectConfig            `json:"newRelic,omitempty"`
	Pingdom                 *PingdomDirectConfig             `json:"pingdom,omitempty"`
	Redshift                *RedshiftDirectConfig            `json:"redshift,omitempty"`
	Splunk                  *SplunkDirectConfig              `json:"splunk,omitempty"`
	SplunkObservability     *SplunkObservabilityDirectConfig `json:"splunkObservability,omitempty"`
	SumoLogic               *SumoLogicDirectConfig           `json:"sumoLogic,omitempty"`
	ThousandEyes            *ThousandEyesDirectConfig        `json:"thousandEyes,omitempty"`
}

DirectSpec represents content of Spec typical for Direct Object

type DirectStatus

type DirectStatus struct {
	DirectType string `json:"directType" example:"Datadog"`
}

DirectStatus represents content of Status optional for Direct Object

type DiscordAlertMethod

type DiscordAlertMethod struct {
	URL string `json:"url"` // Field required when AlertMethod is created.
}

DiscordAlertMethod represents a set of properties required to send message to Discord.

type DynatraceAgentConfig

type DynatraceAgentConfig struct {
	URL string `json:"url,omitempty"` //nolint: lll
}

DynatraceAgentConfig represents content of Dynatrace Configuration typical for Agent Object.

type DynatraceConfig

type DynatraceConfig struct {
	URL string `json:"url,omitempty"` //nolint: lll
}

DynatraceConfig represents content of Dynatrace Configuration typical for DataSource Object.

type DynatraceDirectConfig added in v0.7.0

type DynatraceDirectConfig struct {
	URL string `` //nolint: lll
	/* 128-byte string literal not displayed */
	DynatraceToken string `json:"dynatraceToken,omitempty" example:"secret"`
}

DynatraceDirectConfig represents content of Dynatrace configuration typical for Direct Object.

type DynatraceMetric

type DynatraceMetric struct {
	MetricSelector *string `json:"metricSelector"`
}

DynatraceMetric describes metric from Dynatrace.

type ElasticsearchAgentConfig

type ElasticsearchAgentConfig struct {
	URL string `json:"url,omitempty"`
}

ElasticsearchAgentConfig represents content of Elasticsearch Configuration typical for Agent Object.

type ElasticsearchConfig

type ElasticsearchConfig struct {
	URL string `json:"url,omitempty"`
}

ElasticsearchConfig represents content of Elasticsearch Configuration typical for DataSource Object.

type ElasticsearchMetric

type ElasticsearchMetric struct {
	Query *string `json:"query"`
	Index *string `json:"index"`
}

ElasticsearchMetric describes metric from Elasticsearch.

type EmailAlertMethod

type EmailAlertMethod struct {
	To  []string `json:"to,omitempty"`
	Cc  []string `json:"cc,omitempty"`
	Bcc []string `json:"bcc,omitempty"`
	// Deprecated: Defining custom template for email alert method is now deprecated. This property is ignored.
	Subject string `json:"subject,omitempty"`
	// Deprecated: Defining custom template for email alert method is now deprecated. This property is ignored.
	Body string `json:"body,omitempty"`
}

EmailAlertMethod represents a set of properties required to send an email.

type FilterEntry

type FilterEntry struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

FilterEntry represents single metric label to be matched against value.

type GCMAgentConfig added in v0.3.0

type GCMAgentConfig struct {
}

GCMAgentConfig represents content of GCM configuration.

type GCMDirectConfig added in v0.7.0

type GCMDirectConfig struct {
	ServiceAccountKey string `json:"serviceAccountKey,omitempty" example:"secret"`
}

GCMDirectConfig represents content of GCM configuration typical for Direct Object.

type GCMMetric added in v0.3.0

type GCMMetric struct {
	ProjectID string `json:"projectId"`
	Query     string `json:"query"`
}

GCMMetric describes metadata used to fetch metrics from Google Cloud Monitoring API.

type GCSDataExportSpec

type GCSDataExportSpec struct {
	BucketName string `json:"bucketName"`
}

GCSDataExportSpec represents content of GCP Cloud Storage export type spec.

type GrafanaLokiAgentConfig

type GrafanaLokiAgentConfig struct {
	URL string `json:"url,omitempty" example:"example of GrafanaLoki cluster URL"`
}

GrafanaLokiAgentConfig represents content of GrafanaLoki Configuration typical for Agent Object.

type GrafanaLokiMetric

type GrafanaLokiMetric struct {
	Logql *string `json:"logql"`
}

GrafanaLokiMetric describes metric from GrafanaLoki.

type GraphiteAgentConfig

type GraphiteAgentConfig struct {
	URL string `json:"url,omitempty"`
}

GraphiteAgentConfig represents content of Graphite Configuration typical for Agent Object.

type GraphiteMetric

type GraphiteMetric struct {
	MetricPath *string `json:"metricPath"`
}

GraphiteMetric describes metric from Graphite.

type HistoricalDataRetrieval added in v0.7.0

type HistoricalDataRetrieval struct {
	DefaultDuration HistoricalDataRetrievalDuration `json:"defaultDuration"`
	MaxDuration     HistoricalDataRetrievalDuration `json:"maxDuration"`
}

type HistoricalDataRetrievalDuration added in v0.7.0

type HistoricalDataRetrievalDuration struct {
	Unit  string      `json:"unit" example:"Day"`
	Value json.Number `json:"value" example:"30"`
}

type Indicator

type Indicator struct {
	MetricSource *MetricSourceSpec `json:"metricSource"`
}

Indicator represents integration with metric source can be. e.g. Prometheus, Datadog, for internal usage

type InfluxDBAgentConfig added in v0.3.0

type InfluxDBAgentConfig struct {
	URL string `json:"url" validate:"required,url"`
}

InfluxDBAgentConfig represents content of InfluxDB configuration typical fo Agent Object.

type InfluxDBDirectConfig added in v0.7.0

type InfluxDBDirectConfig struct {
	URL            string `json:"url,omitempty"`
	APIToken       string `json:"apiToken,omitempty" example:"secret"`
	OrganizationID string `json:"organizationID,omitempty" example:"secret"`
}

InfluxDBDirectConfig represents content of InfluxDB configuration typical for Direct Object.

type InfluxDBMetric added in v0.3.0

type InfluxDBMetric struct {
	Query *string `json:"query"`
}

InfluxDBMetric describes metric from InfluxDB

type InstanaAgentConfig added in v0.3.0

type InstanaAgentConfig struct {
	URL string `json:"url" validate:"required,url"`
}

InstanaAgentConfig represents content of Instana configuration typical for Agent Object.

type InstanaApplicationMetricGroupBy added in v0.3.0

type InstanaApplicationMetricGroupBy struct {
	Tag               string  `json:"tag"`
	TagEntity         string  `json:"tagEntity"`
	TagSecondLevelKey *string `json:"tagSecondLevelKey"`
}

type InstanaApplicationMetricType added in v0.3.0

type InstanaApplicationMetricType struct {
	MetricID         string                          `json:"metricId"`
	Aggregation      string                          `json:"aggregation"`
	GroupBy          InstanaApplicationMetricGroupBy `json:"groupBy"`
	APIQuery         string                          `json:"apiQuery"`
	IncludeInternal  *bool                           `json:"includeInternal"`
	IncludeSynthetic *bool                           `json:"includeSynthetic"`
}

InstanaApplicationMetricType describes Application for InstanaMetric.

type InstanaDirectConfig added in v0.7.0

type InstanaDirectConfig struct {
	URL      string `json:"url,omitempty"`
	APIToken string `json:"apiToken,omitempty" example:"secret"`
}

InstanaDirectConfig represents content of Instana configuration typical for Direct Object.

type InstanaInfrastructureMetricType added in v0.3.0

type InstanaInfrastructureMetricType struct {
	MetricRetrievalMethod string  `json:"metricRetrievalMethod"`
	Query                 *string `json:"query"`
	SnapshotID            *string `json:"snapshotId"`
	MetricID              string  `json:"metricId"`
	PluginID              string  `json:"pluginId"`
}

InstanaInfrastructureMetricType describes Infrastructure for InstanaMetric.

type InstanaMetric added in v0.3.0

type InstanaMetric struct {
	MetricType     string                           `json:"metricType"`
	Infrastructure *InstanaInfrastructureMetricType `json:"infrastructure"`
	Application    *InstanaApplicationMetricType    `json:"application"`
}

InstanaMetric describes metric from Instana server.

type InstantaneousBurnRateTimeSeries

type InstantaneousBurnRateTimeSeries struct {
	InstantaneousBurnRate TimeSeriesData `json:"instantaneousBurnRate,omitempty"`
}

type JiraAlertMethod

type JiraAlertMethod struct {
	URL        string `json:"url"`
	Username   string `json:"username"`
	APIToken   string `json:"apiToken"` // Field required when AlertMethod is created.
	ProjectKey string `json:"projectKey"`
}

JiraAlertMethod represents a set of properties required create tickets in Jira.

type Labels

type Labels map[string][]string

type LightstepAgentConfig

type LightstepAgentConfig struct {
	Organization string `json:"organization,omitempty" example:"LightStep-Play"`
	Project      string `json:"project,omitempty" example:"play"`
}

LightstepAgentConfig represents content of Lightstep Configuration typical for Agent Object.

type LightstepConfig

type LightstepConfig struct {
	Organization string `json:"organization,omitempty" example:"LightStep-Play"`
	Project      string `json:"project,omitempty" example:"play"`
}

LightstepConfig represents content of Lightstep Configuration typical for DataSource Object.

type LightstepDirectConfig added in v0.7.0

type LightstepDirectConfig struct {
	Organization string `json:"organization,omitempty" example:"LightStep-Play"`
	Project      string `json:"project,omitempty" example:"play"`
	AppToken     string `json:"appToken,omitempty" example:"secret"`
}

LightstepDirectConfig represents content of Lightstep configuration typical for Direct Object.

type LightstepMetric

type LightstepMetric struct {
	StreamID   *string  `json:"streamId"`
	TypeOfData *string  `json:"typeOfData"`
	Percentile *float64 `json:"percentile"`
	UQL        *string  `json:"uql"`
}

LightstepMetric describes metric from Lightstep

type Metadata

type Metadata struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName,omitempty"`
	Project     string `json:"project,omitempty"`
	Labels      Labels `json:"labels,omitempty"`
}

Metadata represents part of object which is common for all available Objects, for internal usage

type MetadataHolder

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

MetadataHolder is an intermediate structure that can provides metadata related field to other structures

type MetricSourceSpec

type MetricSourceSpec struct {
	Project string `json:"project,omitempty"`
	Name    string `json:"name"`
	Kind    string `json:"kind"`
}

type MetricSpec

type MetricSpec struct {
	AmazonPrometheus    *AmazonPrometheusMetric    `json:"amazonPrometheus,omitempty"`
	AppDynamics         *AppDynamicsMetric         `json:"appDynamics,omitempty"`
	BigQuery            *BigQueryMetric            `json:"bigQuery,omitempty"`
	CloudWatch          *CloudWatchMetric          `json:"cloudWatch,omitempty"`
	Datadog             *DatadogMetric             `json:"datadog,omitempty"`
	Dynatrace           *DynatraceMetric           `json:"dynatrace,omitempty"`
	Elasticsearch       *ElasticsearchMetric       `json:"elasticsearch,omitempty"`
	GCM                 *GCMMetric                 `json:"gcm,omitempty"`
	GrafanaLoki         *GrafanaLokiMetric         `json:"grafanaLoki,omitempty"`
	Graphite            *GraphiteMetric            `json:"graphite,omitempty"`
	InfluxDB            *InfluxDBMetric            `json:"influxdb,omitempty"`
	Instana             *InstanaMetric             `json:"instana,omitempty"`
	Lightstep           *LightstepMetric           `json:"lightstep,omitempty"`
	NewRelic            *NewRelicMetric            `json:"newRelic,omitempty"`
	OpenTSDB            *OpenTSDBMetric            `json:"opentsdb,omitempty"`
	Pingdom             *PingdomMetric             `json:"pingdom,omitempty"`
	Prometheus          *PrometheusMetric          `json:"prometheus,omitempty"`
	Redshift            *RedshiftMetric            `json:"redshift,omitempty"`
	Splunk              *SplunkMetric              `json:"splunk,omitempty"`
	SplunkObservability *SplunkObservabilityMetric `json:"splunkObservability,omitempty"`
	SumoLogic           *SumoLogicMetric           `json:"sumoLogic,omitempty"`
	ThousandEyes        *ThousandEyesMetric        `json:"thousandEyes,omitempty"`
}

MetricSpec defines single time series obtained from data source

type NewRelicAgentConfig

type NewRelicAgentConfig struct {
	AccountID json.Number `json:"accountId,omitempty" example:"123654"`
}

NewRelicAgentConfig represents content of NewRelic Configuration typical for Agent Object.

type NewRelicConfig

type NewRelicConfig struct {
	AccountID json.Number `json:"accountId,omitempty" example:"123654"`
}

NewRelicConfig represents content of NewRelic Configuration typical for DataSource Object.

type NewRelicDirectConfig

type NewRelicDirectConfig struct {
	AccountID        json.Number `json:"accountId,omitempty"`
	InsightsQueryKey string      `json:"insightsQueryKey,omitempty" example:"secret"`
}

NewRelicDirectConfig represents content of NewRelic configuration typical for Direct Object.

type NewRelicMetric

type NewRelicMetric struct {
	NRQL *string `json:"nrql"`
}

NewRelicMetric describes metric from NewRelic

type Object

type Object string

Object represents available objects in API to perform operations

const (
	ObjectSLO         Object = "SLO"
	ObjectService     Object = "Service"
	ObjectDataSource  Object = "DataSource"
	ObjectAgent       Object = "Agent"
	ObjectAlertPolicy Object = "AlertPolicy"
	// ObjectAlert represents object used only to return list of Alerts. Applying and deleting alerts is disabled.
	ObjectAlert Object = "Alert"
	// ObjectProject represents object used only to return list of Projects.
	// Applying and deleting projects is not supported.
	ObjectProject     Object = "Project"
	ObjectAlertMethod Object = "AlertMethod"
	// ObjectMetricSource represents ephemeral object used only to return concatenated list of Agents and DataSources.
	ObjectMetricSource Object = "MetricSource"
	ObjectDirect       Object = "Direct"
	ObjectDataExport   Object = "DataExport"
	ObjectRoleBinding  Object = "RoleBinding"
)

List of available objects in API.

func ObjectName

func ObjectName(apiObject string) Object

func (Object) String

func (o Object) String() string

type ObjectGeneric

type ObjectGeneric struct {
	ObjectHeader
	Spec json.RawMessage `json:"spec"`
}

ObjectGeneric represents struct to which every Object is parsable Specific types of Object have different structures as Spec

type ObjectHeader

type ObjectHeader struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	MetadataHolder
	ObjectInternal
}

ObjectHeader represents Header which is common for all available Objects

type ObjectInternal

type ObjectInternal struct {
	Organization string `json:",omitempty" example:"nobl9-dev"`
	ManifestSrc  string `json:",omitempty" example:"x.yml"`
	OktaClientID string `json:"-"` // used only by kind Agent
}

ObjectInternal represents part of object which is only for internal usage, not exposed to the client, for internal usage

type OpenTSDBAgentConfig

type OpenTSDBAgentConfig struct {
	URL string `json:"url,omitempty" example:"example of OpenTSDB cluster URL"`
}

OpenTSDBAgentConfig represents content of OpenTSDB Configuration typical for Agent Object.

type OpenTSDBMetric

type OpenTSDBMetric struct {
	Query *string `json:"query"`
}

OpenTSDBMetric describes metric from OpenTSDB.

type Operation

type Operation int

Operation is an enum that represents an operation that can be done over an object kind

const (
	Get Operation = iota + 1
	TimeSeries
	Reports
)

Possible values of Operation

func ParseOperation

func ParseOperation(val string) (Operation, error)

ParseOperation return Operation matching given string

func (Operation) String

func (operation Operation) String() string

type OpsgenieAlertMethod

type OpsgenieAlertMethod struct {
	Auth string `json:"auth"` // Field required when AlertMethod is created.
	URL  string `json:"url"`
}

OpsgenieAlertMethod represents a set of properties required to send message to Opsgenie.

type PagerDutyAlertMethod

type PagerDutyAlertMethod struct {
	IntegrationKey string          `json:"integrationKey"`
	SendResolution *SendResolution `json:"sendResolution,omitempty"`
}

PagerDutyAlertMethod represents a set of properties required to open an Incident in PagerDuty.

type Payload

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

func (*Payload) AddObject

func (p *Payload) AddObject(in interface{})

func (*Payload) GetObjects

func (p *Payload) GetObjects() []AnyJSONObj

type Percentile

type Percentile struct {
	P1  TimeSeriesData `json:"p1,omitempty"`
	P5  TimeSeriesData `json:"p5,omitempty"`
	P10 TimeSeriesData `json:"p10,omitempty"`
	P50 TimeSeriesData `json:"p50,omitempty"`
	P90 TimeSeriesData `json:"p90,omitempty"`
	P95 TimeSeriesData `json:"p95,omitempty"`
	P99 TimeSeriesData `json:"p99,omitempty"`
}

type Period

type Period struct {
	Begin string `json:"begin"`
	End   string `json:"end"`
}

Period represents period of time

type PingdomAgentConfig added in v0.3.0

type PingdomAgentConfig struct {
}

PingdomAgentConfig represents content of Pingdom Configuration typical for Agent Object.

type PingdomDirectConfig added in v0.7.0

type PingdomDirectConfig struct {
	APIToken string `json:"apiToken,omitempty" example:"secret"`
}

PingdomDirectConfig represents content of Pingdom configuration typical for Direct Object.

type PingdomMetric added in v0.3.0

type PingdomMetric struct {
	CheckID   *string `json:"checkId"`
	CheckType *string `json:"checkType,omitempty"`
	Status    *string `json:"status"`
}

PingdomMetric describes metric from Pingdom.

type Project

type Project struct {
	ObjectInternal
	APIVersion string          `json:"apiVersion"`
	Kind       string          `json:"kind"`
	Metadata   ProjectMetadata `json:"metadata"`
	Spec       ProjectSpec     `json:"spec"`
}

Project struct which mapped one to one with kind: project yaml definition.

type ProjectMetadata

type ProjectMetadata struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName,omitempty"`
	Labels      Labels `json:"labels,omitempty" validate:"omitempty,labels"`
}

type ProjectSpec

type ProjectSpec struct {
	Description string `json:"description"`
}

ProjectSpec represents content of Spec typical for Project Object.

type PrometheusAgentConfig added in v0.3.0

type PrometheusAgentConfig struct {
	URL              *string                     `json:"url,omitempty" example:"http://prometheus-service.monitoring:8080"`
	ServiceDiscovery *PrometheusServiceDiscovery `json:"serviceDiscovery,omitempty"`
}

PrometheusAgentConfig represents content of Prometheus Configuration typical for DataSource Object.

type PrometheusDiscoveryRule

type PrometheusDiscoveryRule struct {
	Discovery          string        `json:"discovery"`
	ServiceNamePattern string        `json:"serviceNamePattern"`
	Filter             []FilterEntry `json:"filter,omitempty"`
}

PrometheusDiscoveryRule provides struct for storing rule for single Service discovery rule from Prometheus.

type PrometheusMetric

type PrometheusMetric struct {
	PromQL *string `json:"promql"`
}

PrometheusMetric describes metric from Prometheus server

type PrometheusServiceDiscovery

type PrometheusServiceDiscovery struct {
	// empty is treated as once, later support 1m, 2d, etc. (for now not validated, skipped)
	Interval string                    `json:"interval,omitempty"`
	Rules    []PrometheusDiscoveryRule `json:"rules,omitempty"`
}

PrometheusServiceDiscovery provides settings for mechanism of auto Service discovery.

type PublicAlertMethod

type PublicAlertMethod struct {
	ObjectHeader
	Spec   PublicAlertMethodSpec    `json:"spec"`
	Status *PublicAlertMethodStatus `json:"status,omitempty"`
}

PublicAlertMethod represents the configuration required to send a notification to an external service when an alert is triggered.

type PublicAlertMethodSpec

type PublicAlertMethodSpec struct {
	Description string                       `json:"description"`
	Webhook     *PublicWebhookAlertMethod    `json:"webhook,omitempty"`
	PagerDuty   *PublicPagerDutyAlertMethod  `json:"pagerduty,omitempty"`
	Slack       *PublicSlackAlertMethod      `json:"slack,omitempty"`
	Discord     *PublicDiscordAlertMethod    `json:"discord,omitempty"`
	Opsgenie    *PublicOpsgenieAlertMethod   `json:"opsgenie,omitempty"`
	ServiceNow  *PublicServiceNowAlertMethod `json:"servicenow,omitempty"`
	Jira        *PublicJiraAlertMethod       `json:"jira,omitempty"`
	Teams       *PublicTeamsAlertMethod      `json:"msteams,omitempty"`
	Email       *EmailAlertMethod            `json:"email,omitempty"`
}

PublicAlertMethodSpec represents content of AlertMethod's Spec without secrets.

type PublicAlertMethodStatus

type PublicAlertMethodStatus struct {
	LastTestDate       string `json:"lastTestDate,omitempty"`
	NextTestPossibleAt string `json:"nextTestPossibleAt,omitempty"`
}

PublicAlertMethodStatus represents content of Status optional for PublicAlertMethod Object

type PublicDiscordAlertMethod

type PublicDiscordAlertMethod struct {
	HiddenURL string `json:"url"`
}

PublicDiscordAlertMethod represents a set of properties required to send message to Discord without secrets.

type PublicJiraAlertMethod

type PublicJiraAlertMethod struct {
	URL            string `json:"url"`
	Username       string `json:"username"`
	ProjectKey     string `json:"projectKey"`
	HiddenAPIToken string `json:"apiToken"`
}

PublicJiraAlertMethod represents a set of properties required create tickets in Jira without secrets.

type PublicOpsgenieAlertMethod

type PublicOpsgenieAlertMethod struct {
	HiddenAuth string `json:"auth"`
	URL        string `json:"url"`
}

PublicOpsgenieAlertMethod represents a set of properties required to send message to Opsgenie without secrets.

type PublicPagerDutyAlertMethod

type PublicPagerDutyAlertMethod struct {
	HiddenIntegrationKey string          `json:"integrationKey"`
	SendResolution       *SendResolution `json:"sendResolution,omitempty"`
}

PublicPagerDutyAlertMethod represents a set of properties required to open an Incident in PagerDuty without secrets.

type PublicServiceNowAlertMethod

type PublicServiceNowAlertMethod struct {
	Username       string `json:"username"`
	InstanceName   string `json:"instanceName"`
	HiddenPassword string `json:"password"`
}

PublicServiceNowAlertMethod represents a set of properties required to send message to ServiceNow without secrets.

type PublicSlackAlertMethod

type PublicSlackAlertMethod struct {
	HiddenURL string `json:"url"`
}

PublicSlackAlertMethod represents a set of properties required to send message to Slack without secrets.

type PublicTeamsAlertMethod

type PublicTeamsAlertMethod struct {
	HiddenURL string `json:"url"`
}

PublicTeamsAlertMethod represents a set of properties required create Microsoft Teams notifications.

type PublicWebhookAlertMethod

type PublicWebhookAlertMethod struct {
	HiddenURL      string          `json:"url"`
	Template       *string         `json:"template,omitempty"`
	TemplateFields []string        `json:"templateFields,omitempty"` //nolint:lll
	Headers        []WebhookHeader `json:"headers,omitempty"`
}

PublicWebhookAlertMethod represents a set of properties required to send a webhook request without secrets.

type QueryDelayDuration added in v0.8.1

type QueryDelayDuration struct {
	Unit  string      `json:"unit" example:"Minute"`
	Value json.Number `json:"value" example:"1"`
}

type RawMetricSpec

type RawMetricSpec struct {
	MetricQuery *MetricSpec `json:"query" validate:"required"`
}

RawMetricSpec represents integration with a metric source for a particular threshold

type RedshiftAgentConfig added in v0.3.0

type RedshiftAgentConfig struct {
}

RedshiftAgentConfig represents content of Redshift configuration typical for Agent Object.

type RedshiftDirectConfig added in v0.7.0

type RedshiftDirectConfig struct {
	AccessKeyID     string `json:"accessKeyID,omitempty" example:"secret"`
	SecretAccessKey string `json:"secretAccessKey,omitempty" example:"secret"`
	SecretARN       string `json:"secretARN,omitempty"`
}

RedshiftDirectConfig represents content of Redshift configuration typical for Direct Object.

type RedshiftMetric added in v0.3.0

type RedshiftMetric struct {
	Region       *string `json:"region"`
	ClusterID    *string `json:"clusterId"`
	DatabaseName *string `json:"databaseName"`
	Query        *string `json:"query"`
}

RedshiftMetric describes metric from Redshift server.

type RoleBinding

type RoleBinding struct {
	ObjectInternal
	APIVersion string              `json:"apiVersion"`
	Kind       string              `json:"kind"`
	Metadata   RoleBindingMetadata `json:"metadata"`
	Spec       RoleBindingSpec     `json:"spec"`
}

RoleBinding represents relation of User and Role

type RoleBindingMetadata

type RoleBindingMetadata struct {
	Name string `json:"name"`
}

type RoleBindingSpec

type RoleBindingSpec struct {
	User       string `json:"user"`
	RoleRef    string `json:"roleRef"`
	ProjectRef string `json:"projectRef,omitempty"`
}

type S3DataExportSpec

type S3DataExportSpec struct {
	BucketName string `json:"bucketName"`
	RoleARN    string `json:"roleArn"` //nolint:lll
}

S3DataExportSpec represents content of Amazon S3 export type spec.

type SLO

type SLO struct {
	ObjectHeader
	Spec SLOSpec `json:"spec"`
}

SLO struct which mapped one to one with kind: slo yaml definition, external usage

type SLOHistoryReport

type SLOHistoryReport struct {
	MetadataHolder
	TimeWindows []TimeWindowHistoryReport `json:"timewindows,omitempty"`
}

type SLOSpec

type SLOSpec struct {
	Description     string         `json:"description"`
	Indicator       Indicator      `json:"indicator"`
	BudgetingMethod string         `json:"budgetingMethod"`
	Thresholds      []Threshold    `json:"objectives"`
	Service         string         `json:"service"`
	TimeWindows     []TimeWindow   `json:"timeWindows"`
	AlertPolicies   []string       `json:"alertPolicies"`
	Attachments     []Attachment   `json:"attachments,omitempty"`
	CreatedAt       string         `json:"createdAt,omitempty"`
	Composite       *Composite     `json:"composite,omitempty"`
	AnomalyConfig   *AnomalyConfig `json:"anomalyConfig,omitempty" validate:"omitempty"`
}

SLOSpec represents content of Spec typical for SLO Object

type SLOTimeSeries

type SLOTimeSeries struct {
	MetadataHolder
	TimeWindows                 []TimeWindowTimeSeries `json:"timewindows,omitempty"`
	RawSLIPercentilesTimeSeries Percentile             `json:"percentiles,omitempty"`
}

type SendResolution

type SendResolution struct {
	Message *string `json:"message"`
}

SendResolution If user set SendResolution, then “Send a notification after the cooldown period is over"

type Service

type Service struct {
	ObjectHeader
	Spec   ServiceSpec   `json:"spec"`
	Status ServiceStatus `json:"status"`
}

Service struct which mapped one to one with kind: service yaml definition

type ServiceNowAlertMethod

type ServiceNowAlertMethod struct {
	Username     string `json:"username"`
	Password     string `json:"password"` // Field required when AlertMethod is created.
	InstanceName string `json:"instanceName"`
}

ServiceNowAlertMethod represents a set of properties required to send message to ServiceNow.

type ServiceSpec

type ServiceSpec struct {
	Description string `json:"description"`
}

ServiceSpec represents content of Spec typical for Service Object

type ServiceStatus

type ServiceStatus struct {
	SloCount int `json:"sloCount"`
}

ServiceStatus represents content of Status optional for Service Object

type ServiceWithSLOs

type ServiceWithSLOs struct {
	Service Service `json:"service"`
	SLOs    []SLO   `json:"slos"`
}

ServiceWithSLOs struct which mapped one to one with kind: service and slo yaml definition

type SlackAlertMethod

type SlackAlertMethod struct {
	URL string `json:"url"` // Required when AlertMethod is created.
}

SlackAlertMethod represents a set of properties required to send message to Slack.

type SplunkAgentConfig

type SplunkAgentConfig struct {
	URL string `json:"url,omitempty" example:"https://localhost:8089/servicesNS/admin/"`
}

SplunkAgentConfig represents content of Splunk Configuration typical for Agent Object.

type SplunkConfig

type SplunkConfig struct {
	URL string `json:"url,omitempty" example:"https://localhost:8089/servicesNS/admin/"`
}

SplunkConfig represents content of Splunk Configuration typical for DataSource Object.

type SplunkDirectConfig added in v0.7.0

type SplunkDirectConfig struct {
	URL         string `json:"url,omitempty"`
	AccessToken string `json:"accessToken,omitempty" example:"secret"`
}

SplunkDirectConfig represents content of Splunk configuration typical for Direct Object.

type SplunkMetric

type SplunkMetric struct {
	Query *string `json:"query"`
}

SplunkMetric describes metric from Splunk

type SplunkObservabilityAgentConfig

type SplunkObservabilityAgentConfig struct {
	Realm string `json:"realm,omitempty" example:"us1"`
}

SplunkObservabilityAgentConfig represents content of SplunkObservability Configuration typical for Agent Object.

type SplunkObservabilityDirectConfig

type SplunkObservabilityDirectConfig struct {
	Realm       string `json:"realm,omitempty" example:"us1"`
	AccessToken string `json:"accessToken,omitempty" example:"secret"`
}

SplunkObservabilityDirectConfig represents content of SplunkObservability configuration typical for Direct Object.

type SplunkObservabilityMetric

type SplunkObservabilityMetric struct {
	Program *string `json:"program"`
}

SplunkObservabilityMetric describes metric from SplunkObservability

type SumoLogicAgentConfig added in v0.3.0

type SumoLogicAgentConfig struct {
	URL string `json:"url" validate:"required,url"`
}

SumoLogicAgentConfig represents content of Sumo Logic configuration typical for Agent Object.

type SumoLogicDirectConfig added in v0.7.0

type SumoLogicDirectConfig struct {
	URL       string `json:"url,omitempty"`
	AccessID  string `json:"accessID,omitempty" example:"secret"`
	AccessKey string `json:"accessKey,omitempty" example:"secret"`
}

SumoLogicDirectConfig represents content of SumoLogic configuration typical for Direct Object.

type SumoLogicMetric added in v0.3.0

type SumoLogicMetric struct {
	Type         *string `json:"type"`
	Query        *string `json:"query"`
	Quantization *string `json:"quantization"`
	Rollup       *string `json:"rollup"`
}

SumoLogicMetric describes metric from SumoLogic server.

type TeamsAlertMethod

type TeamsAlertMethod struct {
	URL string `json:"url"`
}

TeamsAlertMethod represents a set of properties required create Microsoft Teams notifications.

type ThousandEyesAgentConfig

type ThousandEyesAgentConfig struct {
}

ThousandEyesAgentConfig represents content of ThousandEyes Configuration typical for Agent Object.

type ThousandEyesDirectConfig

type ThousandEyesDirectConfig struct {
	OauthBearerToken string `json:"oauthBearerToken,omitempty" example:"secret"`
}

ThousandEyesDirectConfig represents content of ThousandEyes Configuration typical for Direct Object.

type ThousandEyesMetric

type ThousandEyesMetric struct {
	TestID   *int64  `json:"testID"`
	TestType *string `json:"testType"`
}

ThousandEyesMetric describes metric from ThousandEyes.

type Threshold

type Threshold struct {
	ThresholdBase
	// <!-- Go struct field and type names renaming budgetTarget to target has been postponed after GA as requested
	// in PC-1240. -->
	BudgetTarget *float64 `json:"target"`
	// <!-- Go struct field and type names renaming thresholds to objectives has been postponed after GA as requested
	// in PC-1240. -->
	TimeSliceTarget *float64          `json:"timeSliceTarget,omitempty" example:"0.9"`
	CountMetrics    *CountMetricsSpec `json:"countMetrics,omitempty"`
	RawMetric       *RawMetricSpec    `json:"rawMetric,omitempty"`
	Operator        *string           `json:"op,omitempty" example:"lte"`
}

Threshold represents single threshold for SLO, for internal usage

type ThresholdBase

type ThresholdBase struct {
	DisplayName string  `json:"displayName"`
	Value       float64 `json:"value"`
	Name        string  `json:"name"`
}

ThresholdBase base structure representing a threshold

type ThresholdHistoryReport

type ThresholdHistoryReport struct {
	ThresholdBase
	BurnDownTimeSeries
}

type ThresholdTimeSeries

type ThresholdTimeSeries struct {
	ThresholdBase
	InstantaneousBurnRateTimeSeries
	CumulativeBurnedTimeSeries
	Status   ThresholdTimeSeriesStatus `json:"status"`
	Operator *string                   `json:"op,omitempty"`
	CountsSLITimeSeries
	BurnDownTimeSeries
}

type ThresholdTimeSeriesStatus

type ThresholdTimeSeriesStatus struct {
	BurnedBudget            *float64 `json:"burnedBudget,omitempty" example:"0.25"`
	RemainingBudget         *float64 `json:"errorBudgetRemainingPercentage,omitempty" example:"0.25"`
	RemainingBudgetDuration *float64 `json:"errorBudgetRemaining,omitempty" example:"300"`
	InstantaneousBurnRate   *float64 `json:"instantaneousBurnRate,omitempty" example:"1.25"`
	Condition               *string  `json:"condition,omitempty" example:"ok"`
}

type TimeSerie

type TimeSerie int

TimeSerie represents a type of possible time series defined over an object kind

const (
	InstantaneousBurnRate TimeSerie = iota + 1
	CumulativeBurned
	Counts
	BurnDown
	Percentiles
)

Possible time series that can be retrieved

func ParseToTimeSeries

func ParseToTimeSeries(val string) (TimeSerie, error)

ParseToTimeSeries converts string to TimeSerie

func (TimeSerie) String

func (ts TimeSerie) String() string

type TimeSeriesData

type TimeSeriesData [][]interface{}

type TimeWindow

type TimeWindow struct {
	Unit      string    `json:"unit"`
	Count     int       `json:"count"`
	IsRolling bool      `json:"isRolling" example:"true"`
	Calendar  *Calendar `json:"calendar,omitempty"`

	// Period is only returned in `/get/slo` requests it is ignored for `/apply`
	Period *Period `json:"period"`
}

TimeWindow represents content of time window

type TimeWindowHistoryReport

type TimeWindowHistoryReport struct {
	TimeWindow `json:"timewindow,omitempty"`
	Thresholds []ThresholdHistoryReport `json:"objectives,omitempty"`
}

type TimeWindowTimeSeries

type TimeWindowTimeSeries struct {
	TimeWindow `json:"timewindow,omitempty"`
	// <!-- Go struct field and type names renaming thresholds to objectives has been postponed after GA as requested
	// in PC-1240. -->
	Thresholds []ThresholdTimeSeries `json:"objectives,omitempty"`
}

type WebhookAlertMethod

type WebhookAlertMethod struct {
	URL            string          `json:"url"` // Field required when AlertMethod is created.
	Template       *string         `json:"template,omitempty"`
	TemplateFields []string        `json:"templateFields,omitempty"` //nolint:lll
	Headers        []WebhookHeader `json:"headers,omitempty"`
}

WebhookAlertMethod represents a set of properties required to send a webhook request.

type WebhookHeader

type WebhookHeader struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	IsSecret bool   `json:"isSecret"`
}

Directories

Path Synopsis
Package manifest defines the basic primitives for Nobl9 objects schema.
Package manifest defines the basic primitives for Nobl9 objects schema.
v1alpha
Package v1alpha represents objects available in API n9/v1alpha
Package v1alpha represents objects available in API n9/v1alpha
v1alpha/twindow
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 sdk provide an abstraction for communication with API.
Package sdk provide an abstraction for communication with API.

Jump to

Keyboard shortcuts

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