models

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter added in v0.0.6

type Adapter struct {
	Location string                       `json:"adapter_location"`
	Name     string                       `json:"name"`
	Ops      []*meshes.SupportedOperation `json:"ops"`
}

Adapter represents an adapter in Meshery

type AdaptersTrackerInterface added in v0.0.6

type AdaptersTrackerInterface interface {
	AddAdapter(context.Context, string)
	RemoveAdapter(context.Context, string)
	GetAdapters(context.Context) []string
}

AdaptersTrackerInterface defines the methods a type should implement to be an adapter tracker

type Grafana added in v0.0.6

type Grafana struct {
	GrafanaURL    string `json:"grafanaURL,omitempty"`
	GrafanaAPIKey string `json:"grafanaAPIKey,omitempty"`
	// GrafanaBoardSearch string          `json:"grafanaBoardSearch,omitempty"`
	GrafanaBoards []*SelectedGrafanaConfig `json:"selectedBoardsConfigs,omitempty"`
}

Grafana represents the Grafana session config

type GrafanaBoard added in v0.0.6

type GrafanaBoard struct {
	URI          string                 `json:"uri,omitempty"`
	Title        string                 `json:"title,omitempty"`
	Slug         string                 `json:"slug,omitempty"`
	UID          string                 `json:"uid,omitempty"`
	OrgID        uint                   `json:"org_id,omitempty"`
	Panels       []*sdk.Panel           `json:"panels,omitempty"`
	TemplateVars []*GrafanaTemplateVars `json:"template_vars,omitempty"`
}

GrafanaBoard represents a Grafana board

type GrafanaDataSource added in v0.0.6

type GrafanaDataSource struct {
	ID   uint   `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

GrafanaDataSource represents a Grafana datasource like Prometheus

type GrafanaPanel added in v0.0.6

type GrafanaPanel struct {
	PType string `json:"type,omitempty"`
	ID    uint   `json:"id,omitempty"`
	Title string `json:"title,omitempty"`
}

GrafanaPanel represents Grafana panel

type GrafanaTemplateVars added in v0.0.6

type GrafanaTemplateVars struct {
	Name       string             `json:"name,omitempty"`
	Query      string             `json:"query,omitempty"`
	Datasource *GrafanaDataSource `json:"datasource,omitempty"`
	Hide       uint8              `json:"hide,omitempty"`
	Value      interface{}        `json:"value,omitempty"`
}

GrafanaTemplateVars represents template variables in a bboard

type HandlerConfig

type HandlerConfig struct {
	SessionName   string
	RefCookieName string

	SessionStore sessions.Store

	SaaSTokenName string
	SaaSBaseURL   string

	AdapterTracker AdaptersTrackerInterface
	QueryTracker   QueryTrackerInterface

	Queue taskq.Queue

	SessionPersister SessionPersister

	KubeConfigFolder string
}

HandlerConfig holds all the config pieces needed by handler methods

type HandlerInterface

type HandlerInterface interface {
	AuthMiddleware(http.Handler) http.Handler
	SessionInjectorMiddleware(func(http.ResponseWriter, *http.Request, *sessions.Session, *User)) http.Handler

	LoginHandler(w http.ResponseWriter, r *http.Request)
	LogoutHandler(w http.ResponseWriter, req *http.Request)
	UserHandler(w http.ResponseWriter, r *http.Request, session *sessions.Session, user *User)

	K8SConfigHandler(w http.ResponseWriter, r *http.Request, session *sessions.Session, user *User)
	GetContextsFromK8SConfig(w http.ResponseWriter, req *http.Request)
	KubernetesPingHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	InstalledMeshesHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)

	LoadTestHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	CollectStaticMetrics(config *SubmitMetricsConfig) error
	FetchResultsHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)

	MeshAdapterConfigHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	MeshOpsHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	GetAllAdaptersHandler(w http.ResponseWriter, req *http.Request)
	EventStreamHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	AdapterPingHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)

	GrafanaConfigHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	GrafanaBoardsHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	GrafanaQueryHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	GrafanaQueryRangeHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	SaveSelectedGrafanaBoardsHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)

	PrometheusConfigHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	GrafanaBoardImportForPrometheusHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	PrometheusQueryHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	PrometheusQueryRangeHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	PrometheusStaticBoardHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
	SaveSelectedPrometheusBoardsHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)

	SessionSyncHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, user *User)
}

HandlerInterface defines the methods a Handler should define

type K8SConfig added in v0.0.6

type K8SConfig struct {
	InClusterConfig   bool   `json:"inClusterConfig,omitempty"`
	K8Sfile           string `json:"k8sfile,omitempty"`
	Config            []byte `json:"config,omitempty"`
	Server            string `json:"configuredServer,omitempty"`
	ContextName       string `json:"contextName,omitempty"`
	ClusterConfigured bool   `json:"clusterConfigured,omitempty"`

	ServerVersion string     `json:"server_version,omitempty"`
	Nodes         []*K8SNode `json:"nodes,omitempty"`
}

K8SConfig represents all the k8s session config

type K8SContext added in v0.0.6

type K8SContext struct {
	ContextName string `json:"contextName"`
	ClusterName string `json:"clusterName"`
	// ContextDisplayName string `json:"context-display-name"`
	IsCurrentContext bool `json:"currentContext"`
}

K8SContext is just used to send contexts to the UI

type K8SNode added in v0.1.6

type K8SNode struct {
	InternalIP              string `json:"internal_ip,omitempty"`
	HostName                string `json:"hostname,omitempty"`
	AllocatableCPU          string `json:"allocatable_cpu,omitempty"`
	AllocatableMemory       string `json:"allocatable_memory,omitempty"`
	CapacityCPU             string `json:"capacity_cpu,omitempty"`
	CapacityMemory          string `json:"capacity_memory,omitempty"`
	OSImage                 string `json:"os_image,omitempty"`
	OperatingSystem         string `json:"operating_system,omitempty"`
	KubeletVersion          string `json:"kubelet_version,omitempty"`
	KubeProxyVersion        string `json:"kubeproxy_version,omitempty"`
	ContainerRuntimeVersion string `json:"container_runtime_version,omitempty"`
	Architecture            string `json:"architecture,omitempty"`
}

K8SNode - represents a kubernetes node

type LoadTestOptions added in v0.0.6

type LoadTestOptions struct {
	Name string
	URL  string

	HTTPQPS float64

	HTTPNumThreads int

	IsInsecure bool
	Duration   time.Duration

	Cert, Key, CACert string

	AllowInitialErrors bool

	IsGRPC           bool
	GRPCStreamsCount int
	GRPCDoHealth     bool
	GRPCHealthSvc    string
	GRPCDoPing       bool
	GRPCPingDelay    time.Duration
}

LoadTestOptions represents the load test options

type LoadTestResponse added in v0.2.0

type LoadTestResponse struct {
	Status  LoadTestStatus `json:"status,omitempty"`
	Message string         `json:"message,omitempty"`
	Result  *MesheryResult `json:"result,omitempty"`
}

LoadTestResponse - used to bundle the response with status to the client

type LoadTestStatus added in v0.2.0

type LoadTestStatus string

LoadTestStatus - used for representing load test status

const (
	// LoadTestError - respresents an error status
	LoadTestError LoadTestStatus = "error"

	// LoadTestInfo - represents a info status
	LoadTestInfo LoadTestStatus = "info"

	// LoadTestSuccess - represents a success status
	LoadTestSuccess LoadTestStatus = "success"
)

type MesheryResult added in v0.0.6

type MesheryResult struct {
	ID     uuid.UUID              `json:"meshery_id,omitempty"`
	Name   string                 `json:"name,omitempty"`
	Mesh   string                 `json:"mesh,omitempty"`
	Result map[string]interface{} `json:"runner_results,omitempty"`

	ServerMetrics     interface{} `json:"server_metrics,omitempty"`
	ServerBoardConfig interface{} `json:"server_board_config,omitempty"`
}

MesheryResult - represents the results from Meshery test run to be shipped

type Prometheus added in v0.0.6

type Prometheus struct {
	PrometheusURL                   string                   `json:"prometheusURL,omitempty"`
	SelectedPrometheusBoardsConfigs []*SelectedGrafanaConfig `json:"selectedPrometheusBoardsConfigs,omitempty"`
}

Prometheus represents the prometheus session config

type QueryTrackerInterface added in v0.0.6

type QueryTrackerInterface interface {
	AddOrFlagQuery(ctx context.Context, uuid, query string, flag bool)
	RemoveUUID(ctx context.Context, uuid string)
	GetQueriesForUUID(ctx context.Context, uuid string) map[string]bool
}

QueryTrackerInterface defines the methods for working with query UUIDs

type SelectedGrafanaConfig added in v0.0.6

type SelectedGrafanaConfig struct {
	GrafanaBoard         *GrafanaBoard `json:"board,omitempty"`
	GrafanaPanels        []*sdk.Panel  `json:"panels,omitempty"`
	SelectedTemplateVars []string      `json:"templateVars,omitempty"`
}

SelectedGrafanaConfig represents the selected boards, panels, and template variables

type Session added in v0.0.6

type Session struct {
	// User         *User       `json:"user,omitempty"`
	K8SConfig    *K8SConfig  `json:"k8sConfig,omitempty"`
	MeshAdapters []*Adapter  `json:"meshAdapters,omitempty"`
	Grafana      *Grafana    `json:"grafana,omitempty"`
	Prometheus   *Prometheus `json:"prometheus,omitempty"`
}

Session represents the data stored in session / local DB

type SessionPersister added in v0.0.6

type SessionPersister interface {
	Read(userID string) (*Session, error)
	Write(userID string, data *Session) error
	Delete(userID string) error

	// Lock(userID string)
	// Unlock(userID string)
	Close()
}

SessionPersister defines methods for a session persister

type SubmitMetricsConfig added in v0.0.6

type SubmitMetricsConfig struct {
	TestUUID, ResultID, PromURL string
	StartTime, EndTime          time.Time
	TokenKey, TokenVal          string
}

SubmitMetricsConfig is used to store config used for submitting metrics

type User

type User struct {
	UserID    string `json:"user_id,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
}

User - represents a user in Meshery

Jump to

Keyboard shortcuts

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