synthetics

package
v0.0.0-...-42feff4 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

synthetics

This is a simple REST client for the Kentik Synthetics API.

It is not meant as a general client but rather a slim version specifically for Odyssey.

Documentation

Overview

Copyright 2022 KentikLabs

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// Agent Status
	AgentStatusOK = "AGENT_STATUS_OK"
	IPFamilyV4    = "IP_FAMILY_V4"
)
View Source
const (
	// Test Types
	TestTypeURL = "url"
	TestTypeIP  = "ip"
	// Test Status
	TestStatusActive = "TEST_STATUS_ACTIVE"
	TestStatusPaused = "TEST_STATUS_PAUSED"
	// Test Tasks
	TestTaskHTTP  = "http"
	TestTaskTrace = "traceroute"
	TestTaskPing  = "ping"
	// Test IP Family
	TestIPFamilyV4   = "IP_FAMILY_V4"
	TestIPFamilyV6   = "IP_FAMILY_V6"
	TestIPFamilyDual = "IP_FAMILY_DUAL"
	// Test Protocol
	TestProtocolTCP  = "tcp"
	TestProtocolUDP  = "udp"
	TestProtocolICMP = "icmp"
)

Variables

View Source
var (
	ErrAgentNotFound = errors.New("agent not found")
)

Functions

This section is empty.

Types

type Agent

type Agent struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Status   string `json:"status,omitempty"`
	Alias    string `json:"alias,omitempty"`
	Type     string `json:"type,omitempty"`
	OS       string `json:"os,omitempty"`
	IP       string `json:"ip,omitempty"`
	SiteID   string `json:"site_id,omitempty"`
	SiteName string `json:"site_name,omitempty"`
	Version  string `json:"version,omitempty"`
}

type Client

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

func NewClient

func NewClient(email, token string, log logr.Logger) *Client

NewClient returns a new Sythentics API client

func (*Client) Agents

func (c *Client) Agents(ctx context.Context) ([]*Agent, error)

func (*Client) AuthorizeAgent

func (c *Client) AuthorizeAgent(ctx context.Context, agentID, agentName, siteID string) error

func (*Client) CreateTest

func (c *Client) CreateTest(ctx context.Context, t *Test) (*Test, error)

func (*Client) DeleteAgent

func (c *Client) DeleteAgent(ctx context.Context, agentID string) error

func (*Client) DeleteTest

func (c *Client) DeleteTest(ctx context.Context, testID string) error

func (*Client) GetAgent

func (c *Client) GetAgent(ctx context.Context, name string) (*Agent, error)

func (*Client) GetSite

func (c *Client) GetSite(ctx context.Context, name string) (*Site, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, email string) (*User, error)

func (*Client) Tests

func (c *Client) Tests(ctx context.Context) ([]*Test, error)

func (*Client) UpdateTest

func (c *Client) UpdateTest(ctx context.Context, t *Test, updateFields []string) error

type DNSTest

type DNSTest struct {
	Target  string   `json:"target,omitempty"`
	Timeout float64  `json:"timeout"`
	Type    string   `json:"type,omitempty"`
	Servers []string `json:"servers,omitempty"`
	Port    int      `json:"port,omitempty"`
}

type PageLoadTest

type PageLoadTest struct {
	Target          string            `json:"target,omitempty"`
	Timeout         float64           `json:"timeout"`
	Headers         map[string]string `json:"headers,omitempty"`
	CSSSelectors    map[string]string `json:"cssSelectors,omitempty"`
	IgnoreTLSErrors bool              `json:"ignoreTlsErrors,omitempty"`
}

type PingTest

type PingTest struct {
	Timeout  int    `json:"timeout"`
	Count    int    `json:"count"`
	Delay    int    `json:"delay"`
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
}

type Site

type Site struct {
	ID        int    `json:"id,omit_empty"`
	Name      string `json:"site_name,omit_empty"`
	CompanyID int    `json:"company_id,omit_empty"`
}

type Test

type Test struct {
	ID       string        `json:"id,omitempty"`
	Name     string        `json:"name"`
	Type     string        `json:"type"`
	Status   string        `json:"status"`
	Settings *TestSettings `json:"settings"`
}

type TestAgent

type TestAgent struct {
	Target string `json:"target"`
}

type TestDNSGrid

type TestDNSGrid struct {
	Targets []string `json:"targets"`
	Type    string   `json:"type"`
}

type TestFlow

type TestFlow struct {
	Type                    string `json:"type"`
	Target                  string `json:"target"`
	TargetRefreshIntervalMs int    `json:"targetRefreshIntervalMillis"`
	MaxTasks                int    `json:"maxTasks"`
	InetDirection           string `json:"inetDirection"`
	Direction               string `json:"direction"`
}

type TestHealthSettings

type TestHealthSettings struct {
	LatencyCritical           float64 `json:"latencyCritical,omitempty"`
	LatencyWarning            float64 `json:"latencyWarning,omitempty"`
	PacketLossCritical        float64 `json:"packetLossCritical,omitempty"`
	PacketLossWarning         float64 `json:"packetLossWarning,omitempty"`
	JitterCritical            float64 `json:"jitterCritical,omitempty"`
	JitterWarning             float64 `json:"jitterWarning,omitempty"`
	HTTPLatencyCritical       float64 `json:"httpLatencyCritical,omitempty"`
	HTTPLatencyWarning        float64 `json:"httpLatencyWarning,omitempty"`
	HTTPValidCodes            []int   `json:"httpValidCodes,omitempty"`
	DNSValidCodes             []int   `json:"dnsValidCodes,omitempty"`
	LatencyCriticalStdDev     float64 `json:"latencyCriticalStddev,omitempty"`
	LatencyWarningStdDev      float64 `json:"latencyWarningStddev,omitempty"`
	JitterCriticalStdDev      float64 `json:"jitterCriticalStddev,omitempty"`
	JitterWarningStdDev       float64 `json:"jitterWarningStddev,omitempty"`
	UnhealthySubtestThreshold float64 `json:"unhealthySubtestThreshold,omitempty"`
	HTTPLatencyCriticalStdDev float64 `json:"httpLatencyCriticalStddev,omitempty"`
	HTTPLatencyWarningStdDev  float64 `json:"httpWarningCriticalStddev,omitempty"`
}

type TestHostname

type TestHostname struct {
	Target string `json:"target"`
}

type TestIP

type TestIP struct {
	Targets []string `json:"targets"`
}

type TestNetworkGrid

type TestNetworkGrid struct {
	Targets []string `json:"targets"`
}

type TestSettings

type TestSettings struct {
	Hostname       *TestHostname       `json:"hostname,omitempty"`
	IP             *TestIP             `json:"ip,omitempty"`
	Agent          *TestAgent          `json:"agent,omitempty"`
	Flow           *TestFlow           `json:"flow,omitempty"`
	Site           *TestSite           `json:"site,omitempty"`
	Tag            *TestTag            `json:"tag,omitempty"`
	DNS            *DNSTest            `json:"dns,omitempty"`
	URL            *URLTest            `json:"url,omitempty"`
	NetworkGrid    *TestNetworkGrid    `json:"networkGrid,omitempty"`
	PageLoad       *PageLoadTest       `json:"pageLoad,omitempty"`
	DNSGrid        *TestDNSGrid        `json:"dnsGrid,omitempty"`
	AgentIDs       []string            `json:"agentIds,omitempty"`
	Period         int                 `json:"period,omitempty"`
	Tasks          []string            `json:"tasks,omitempty"`
	HealthSettings *TestHealthSettings `json:"healthSettings,omitempty"`
	Ping           *PingTest           `json:"ping,omitempty"`
	Trace          *TraceTest          `json:"trace,omitempty"`
	Port           int                 `json:"port,omitempty"`
	Protocol       string              `json:"protocol,omitempty"`
	Family         string              `json:"family,omitempty"`
	Servers        []string            `json:"servers,omitempty"`
	UseLocalIP     bool                `json:"useLocalIp,omitempty"`
	Reciprocal     bool                `json:"reciprocal,omitempty"`
}

type TestSite

type TestSite struct {
	Target string `json:"target"`
}

type TestTag

type TestTag struct {
	Target string `json:"target"`
}

type TraceTest

type TraceTest struct {
	Timeout  int    `json:"timeout"`
	Count    int    `json:"count"`
	Delay    int    `json:"delay"`
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
	Limit    int    `json:"limit"`
}

type URLTest

type URLTest struct {
	Target          string            `json:"target,omitempty"`
	Timeout         float64           `json:"timeout"`
	Method          string            `json:"method,omitempty"`
	Headers         map[string]string `json:"headers,omitempty"`
	Body            string            `json:"body,omitempty"`
	CSSSelectors    map[string]string `json:"cssSelectors,omitempty"`
	IgnoreTLSErrors bool              `json:"ignoreTlsErrors,omitempty"`
	Expiry          int               `json:"expiry,omitempty"`
}

type User

type User struct {
	ID        string `json:"id,omit_empty"`
	Username  string `json:"username,omit_empty"`
	FullName  string `json:"user_full_name,omit_empty"`
	Email     string `json:"user_email,omitempty"`
	CompanyID string `json:"company_id,omitempty"`
}

Jump to

Keyboard shortcuts

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