models

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalTokenForAnonymousResults = "dev_token"
)

GlobalTokenForAnonymousResults - stores the global token for anonymous result publishing

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 BitCaskPreferencePersister added in v0.3.3

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

BitCaskPreferencePersister assists with persisting session in a Bitcask store

func NewBitCaskPreferencePersister added in v0.3.3

func NewBitCaskPreferencePersister(folderName string) (*BitCaskPreferencePersister, error)

NewBitCaskPreferencePersister creates a new BitCaskPreferencePersister instance

func (*BitCaskPreferencePersister) ClosePersister added in v0.3.3

func (s *BitCaskPreferencePersister) ClosePersister()

ClosePersister closes the badger store

func (*BitCaskPreferencePersister) DeleteFromPersister added in v0.3.3

func (s *BitCaskPreferencePersister) DeleteFromPersister(userID string) error

DeleteFromPersister removes the session for the user

func (*BitCaskPreferencePersister) ReadFromPersister added in v0.3.3

func (s *BitCaskPreferencePersister) ReadFromPersister(userID string) (*Preference, error)

ReadFromPersister - reads the session data for the given userID

func (*BitCaskPreferencePersister) WriteToPersister added in v0.3.3

func (s *BitCaskPreferencePersister) WriteToPersister(userID string, data *Preference) error

WriteToPersister persists session for the user

type BitCaskResultsPersister added in v0.3.3

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

BitCaskResultsPersister assists with persisting session in a Bitcask store

func NewBitCaskResultsPersister added in v0.3.3

func NewBitCaskResultsPersister(folderName string) (*BitCaskResultsPersister, error)

NewBitCaskResultsPersister creates a new BitCaskResultsPersister instance

func (*BitCaskResultsPersister) CloseResultPersister added in v0.3.3

func (s *BitCaskResultsPersister) CloseResultPersister()

CloseResultPersister closes the badger store

func (*BitCaskResultsPersister) GetResults added in v0.3.3

func (s *BitCaskResultsPersister) GetResults(page, pageSize uint64) ([]byte, error)

GetResults - gets result for the page and pageSize

func (*BitCaskResultsPersister) WriteResult added in v0.3.3

func (s *BitCaskResultsPersister) WriteResult(result []byte) error

WriteResult persists the result

type CloudProvider added in v0.3.3

type CloudProvider struct {
	*BitCaskPreferencePersister

	SaaSTokenName string
	SaaSBaseURL   string

	SessionName   string
	RefCookieName string

	SessionStore        sessions.Store
	LoginCookieDuration time.Duration
	// contains filtered or unexported fields
}

CloudProvider - represents a local provider

func (*CloudProvider) FetchResults added in v0.3.3

func (l *CloudProvider) FetchResults(req *http.Request, page, pageSize, search, order string) ([]byte, error)

FetchResults - fetches results from provider backend

func (*CloudProvider) GetProviderToken added in v0.3.3

func (l *CloudProvider) GetProviderToken(req *http.Request) (string, error)

GetProviderToken - returns provider token

func (*CloudProvider) GetProviderType added in v0.3.3

func (l *CloudProvider) GetProviderType() ProviderType

GetProviderType - Returns ProviderType

func (*CloudProvider) GetSession added in v0.3.3

func (l *CloudProvider) GetSession(req *http.Request) (*sessions.Session, error)

GetSession - returns the session

func (*CloudProvider) GetUserDetails added in v0.3.3

func (l *CloudProvider) GetUserDetails(req *http.Request) (*User, error)

GetUserDetails - returns the user details

func (*CloudProvider) InitiateLogin added in v0.3.3

func (l *CloudProvider) InitiateLogin(w http.ResponseWriter, r *http.Request)

InitiateLogin - initiates login flow and returns a true to indicate the handler to "return" or false to continue

func (*CloudProvider) Logout added in v0.3.3

func (l *CloudProvider) Logout(w http.ResponseWriter, req *http.Request)

Logout - logout from provider backend

func (*CloudProvider) PublishMetrics added in v0.3.3

func (l *CloudProvider) PublishMetrics(tokenVal string, data []byte) error

PublishMetrics - publishes metrics to the provider backend asyncronously

func (*CloudProvider) PublishResults added in v0.3.3

func (l *CloudProvider) PublishResults(req *http.Request, data []byte) (string, error)

PublishResults - publishes results to the provider backend syncronously

func (*CloudProvider) RecordPreferences added in v0.3.3

func (l *CloudProvider) RecordPreferences(req *http.Request, userID string, data *Preference) error

RecordPreferences - records the user preference

func (*CloudProvider) StopSyncPreferences added in v0.3.3

func (l *CloudProvider) StopSyncPreferences()

StopSyncPreferences - used to stop sync preferences

func (*CloudProvider) SyncPreferences added in v0.3.3

func (l *CloudProvider) SyncPreferences()

SyncPreferences - used to sync preferences with the remote provider

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 GrafanaClient added in v0.2.4

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

GrafanaClient represents a client to Grafana in Meshery

func NewGrafanaClient added in v0.2.4

func NewGrafanaClient() *GrafanaClient

NewGrafanaClient returns a new GrafanaClient

func NewGrafanaClientForPrometheusWithHTTPClient added in v0.2.4

func NewGrafanaClientForPrometheusWithHTTPClient(client *http.Client) *GrafanaClient

NewGrafanaClientForPrometheusWithHTTPClient returns a limited GrafanaClient for use with Prometheus with the given HTTP client

func NewGrafanaClientWithHTTPClient added in v0.2.4

func NewGrafanaClientWithHTTPClient(client *http.Client) *GrafanaClient

NewGrafanaClientWithHTTPClient returns a new GrafanaClient with the given HTTP Client

func (*GrafanaClient) Close added in v0.2.4

func (g *GrafanaClient) Close()

Close - closes idle connections

func (*GrafanaClient) GetGrafanaBoards added in v0.2.4

func (g *GrafanaClient) GetGrafanaBoards(ctx context.Context, BaseURL, APIKey, dashboardSearch string) ([]*GrafanaBoard, error)

GetGrafanaBoards retrieves all the Grafana boards matching a search

func (*GrafanaClient) GrafanaQuery added in v0.2.4

func (g *GrafanaClient) GrafanaQuery(ctx context.Context, BaseURL, APIKey string, queryData *url.Values) ([]byte, error)

GrafanaQuery parses the provided query data and queries Grafana and streams response

func (*GrafanaClient) GrafanaQueryRange added in v0.2.4

func (g *GrafanaClient) GrafanaQueryRange(ctx context.Context, BaseURL, APIKey string, queryData *url.Values) ([]byte, error)

GrafanaQueryRange parses the given params and performs Grafana range queries

func (*GrafanaClient) ProcessBoard added in v0.2.4

func (g *GrafanaClient) ProcessBoard(c *sdk.Client, board *sdk.Board, link *sdk.FoundBoard) (*GrafanaBoard, error)

ProcessBoard accepts raw Grafana board and returns a processed GrafanaBoard to be used in Meshery

func (*GrafanaClient) Validate added in v0.2.4

func (g *GrafanaClient) Validate(ctx context.Context, BaseURL, APIKey string) error

Validate - helps validate grafana connection

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 {
	AdapterTracker AdaptersTrackerInterface
	QueryTracker   QueryTrackerInterface

	Queue taskq.Queue

	KubeConfigFolder string

	GrafanaClient         *GrafanaClient
	GrafanaClientForQuery *GrafanaClient

	PrometheusClient         *PrometheusClient
	PrometheusClientForQuery *PrometheusClient

	Provider Provider
}

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, *Preference, *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, prefObj *Preference, user *User)

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

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

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

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

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

	SessionSyncHandler(w http.ResponseWriter, req *http.Request, session *sessions.Session, prefObj *Preference, 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 LoadGenerator added in v0.3.1

type LoadGenerator string

LoadGenerator - represents the load generator type

const (
	// FortioLG - represents the Fortio load generator
	FortioLG LoadGenerator = "fortio"

	// Wrk2LG - represents the wrk2 load generator
	Wrk2LG LoadGenerator = "wrk2"
)

type LoadTestOptions added in v0.0.6

type LoadTestOptions struct {
	Name string
	URL  string

	HTTPQPS float64

	HTTPNumThreads int

	IsInsecure bool
	Duration   time.Duration

	LoadGenerator LoadGenerator

	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 LocalProvider added in v0.3.3

type LocalProvider struct {
	*MapPreferencePersister
	SessionName     string
	SessionStore    sessions.Store
	SaaSBaseURL     string
	ResultPersister *BitCaskResultsPersister
}

LocalProvider - represents a local provider

func (*LocalProvider) FetchResults added in v0.3.3

func (l *LocalProvider) FetchResults(req *http.Request, page, pageSize, search, order string) ([]byte, error)

FetchResults - fetches results from provider backend

func (*LocalProvider) GetProviderToken added in v0.3.3

func (l *LocalProvider) GetProviderToken(req *http.Request) (string, error)

GetProviderToken - returns provider token

func (*LocalProvider) GetProviderType added in v0.3.3

func (l *LocalProvider) GetProviderType() ProviderType

GetProviderType - Returns ProviderType

func (*LocalProvider) GetSession added in v0.3.3

func (l *LocalProvider) GetSession(req *http.Request) (*sessions.Session, error)

GetSession - returns the session

func (*LocalProvider) GetUserDetails added in v0.3.3

func (l *LocalProvider) GetUserDetails(req *http.Request) (*User, error)

GetUserDetails - returns the user details

func (*LocalProvider) InitiateLogin added in v0.3.3

func (l *LocalProvider) InitiateLogin(w http.ResponseWriter, r *http.Request)

InitiateLogin - initiates login flow and returns a true to indicate the handler to "return" or false to continue

func (*LocalProvider) Logout added in v0.3.3

func (l *LocalProvider) Logout(w http.ResponseWriter, req *http.Request)

Logout - logout from provider backend

func (*LocalProvider) PublishMetrics added in v0.3.3

func (l *LocalProvider) PublishMetrics(_ string, data []byte) error

PublishMetrics - publishes metrics to the provider backend asyncronously

func (*LocalProvider) PublishResults added in v0.3.3

func (l *LocalProvider) PublishResults(req *http.Request, data []byte) (string, error)

PublishResults - publishes results to the provider backend syncronously

func (*LocalProvider) RecordPreferences added in v0.3.3

func (l *LocalProvider) RecordPreferences(req *http.Request, userID string, data *Preference) error

RecordPreferences - records the user preference

type MapPreferencePersister added in v0.3.3

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

MapPreferencePersister assists with persisting session in a badger store

func NewMapPreferencePersister added in v0.3.3

func NewMapPreferencePersister() (*MapPreferencePersister, error)

NewMapPreferencePersister creates a new MapPreferencePersister instance

func (*MapPreferencePersister) ClosePersister added in v0.3.3

func (s *MapPreferencePersister) ClosePersister()

ClosePersister closes the DB

func (*MapPreferencePersister) DeleteFromPersister added in v0.3.3

func (s *MapPreferencePersister) DeleteFromPersister(userID string) error

DeleteFromPersister removes the session for the user

func (*MapPreferencePersister) ReadFromPersister added in v0.3.3

func (s *MapPreferencePersister) ReadFromPersister(userID string) (*Preference, error)

ReadFromPersister reads the session data for the given userID

func (*MapPreferencePersister) WriteToPersister added in v0.3.3

func (s *MapPreferencePersister) WriteToPersister(userID string, data *Preference) error

WriteToPersister persists session for the user

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 MesheryResultPage added in v0.3.3

type MesheryResultPage struct {
	Page       uint64           `json:"page"`
	PageSize   uint64           `json:"page_size"`
	TotalCount int              `json:"total_count"`
	Results    []*MesheryResult `json:"results"`
}

MesheryResultPage - represents a page of meshery results

type Preference added in v0.3.3

type Preference 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"`
	UpdatedAt    time.Time   `json:"updated_at,omitempty"`
}

Preference represents the data stored in session / local DB

type PreferencePersister added in v0.3.3

type PreferencePersister interface {
	ReadFromPersister(userID string) (*Preference, error)
	WriteToPersister(userID string, data *Preference) error
	DeleteFromPersister(userID string) error

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

PreferencePersister defines methods for a session persister

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 PrometheusClient added in v0.2.4

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

PrometheusClient represents a prometheus client in Meshery

func NewPrometheusClient added in v0.2.4

func NewPrometheusClient() *PrometheusClient

NewPrometheusClient returns a PrometheusClient

func NewPrometheusClientWithHTTPClient added in v0.2.4

func NewPrometheusClientWithHTTPClient(client *http.Client) *PrometheusClient

NewPrometheusClientWithHTTPClient returns a PrometheusClient with a given http.Client

func (*PrometheusClient) Close added in v0.2.4

func (p *PrometheusClient) Close()

Close - closes idle connections

func (*PrometheusClient) ComputeStep added in v0.2.4

func (p *PrometheusClient) ComputeStep(ctx context.Context, start, end time.Time) time.Duration

ComputeStep computes the step size for a window

func (*PrometheusClient) GetClusterStaticBoard added in v0.2.4

func (p *PrometheusClient) GetClusterStaticBoard(ctx context.Context, promURL string) (*GrafanaBoard, error)

GetClusterStaticBoard retrieves the cluster static board config

func (*PrometheusClient) GetNodesStaticBoard added in v0.2.4

func (p *PrometheusClient) GetNodesStaticBoard(ctx context.Context, promURL string) (*GrafanaBoard, error)

GetNodesStaticBoard retrieves the per node static board config

func (*PrometheusClient) ImportGrafanaBoard added in v0.2.4

func (p *PrometheusClient) ImportGrafanaBoard(ctx context.Context, boardData []byte) (*GrafanaBoard, error)

ImportGrafanaBoard takes raw Grafana board json and returns GrafanaBoard pointer for use in Meshery

func (*PrometheusClient) Query added in v0.2.4

func (p *PrometheusClient) Query(ctx context.Context, promURL string, queryData *url.Values) ([]byte, error)

Query queries prometheus using the GrafanaClient

func (*PrometheusClient) QueryRange added in v0.2.4

func (p *PrometheusClient) QueryRange(ctx context.Context, promURL string, queryData *url.Values) ([]byte, error)

QueryRange queries prometheus using the GrafanaClient

func (*PrometheusClient) QueryRangeUsingClient added in v0.2.4

func (p *PrometheusClient) QueryRangeUsingClient(ctx context.Context, promURL, query string, startTime, endTime time.Time, step time.Duration) (promModel.Value, error)

QueryRangeUsingClient performs a range query within a window

func (*PrometheusClient) Validate added in v0.2.4

func (p *PrometheusClient) Validate(ctx context.Context, promURL string) error

Validate - helps validate the connection

type Provider added in v0.3.3

type Provider interface {
	PreferencePersister
	// Returns ProviderType
	GetProviderType() ProviderType
	// InitiateLogin - does the needed check, returns a true to indicate "return" or false to continue
	InitiateLogin(http.ResponseWriter, *http.Request)
	GetSession(req *http.Request) (*sessions.Session, error)
	GetUserDetails(*http.Request) (*User, error)
	GetProviderToken(req *http.Request) (string, error)
	Logout(http.ResponseWriter, *http.Request)
	FetchResults(req *http.Request, page, pageSize, search, order string) ([]byte, error)
	PublishResults(req *http.Request, data []byte) (string, error)
	PublishMetrics(tokenVal string, data []byte) error

	RecordPreferences(req *http.Request, userID string, data *Preference) error
}

Provider - interface for providers

type ProviderType added in v0.3.3

type ProviderType string

ProviderType - for representing provider types

const (
	// LocalProviderType - represents local providers
	LocalProviderType ProviderType = "local"

	// CloudProviderType - represents cloud providers
	CloudProviderType ProviderType = "cloud"
)

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 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

type UserPref added in v0.3.3

type UserPref struct {
	User
	Preferences *Preference `json:"preferences,omitempty"`
}

UserPref - is just use to separate out the user info from preference

Jump to

Keyboard shortcuts

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