handlers

package
v0.5.0-beta-3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Overview

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers :collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Package handlers : collection of handlers (aka "HTTP middleware")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLatestVersion added in v0.4.16

func CheckLatestVersion(serverVersion string) (*latest.CheckResponse, error)

CheckLatestVersion takes in the current server version compares it with the target and returns the result (latest.CheckResponse)

func GETOAMRegisterHandler added in v0.5.1

func GETOAMRegisterHandler(typ string, rw http.ResponseWriter)

GETOAMRegisterHandler handles the get requests for the OAM objects

func NewHandlerInstance added in v0.0.4

func NewHandlerInstance(
	handlerConfig *models.HandlerConfig,
) models.HandlerInterface

NewHandlerInstance returns a Handler instance

func POSTOAMRegisterHandler added in v0.5.1

func POSTOAMRegisterHandler(typ string, r *http.Request) error

POSTOAMRegisterHandler handles registering OMA objects

func ServeReactComponentFromPackage added in v0.5.1

func ServeReactComponentFromPackage(
	w http.ResponseWriter,
	r *http.Request,
	reqBasePath string,
	provider models.Provider,
)

ServeReactComponentFromPackage serves static assets from the package located at provider.PackageLocation()

func ServeUI added in v0.3.10

func ServeUI(w http.ResponseWriter, r *http.Request, reqBasePath, baseFolderPath string)

ServeUI - helps serve static files for both meshery ui and provider ui

Types

type Handler added in v0.0.4

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

Handler type is the bucket for configs and http handlers

func (*Handler) AdapterPingHandler added in v0.0.6

func (h *Handler) AdapterPingHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

AdapterPingHandler is used to ping a given adapter

func (*Handler) AnonymousStatsHandler added in v0.3.7

func (h *Handler) AnonymousStatsHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

AnonymousStatsHandler updates anonymous stats for user

func (*Handler) AuthMiddleware added in v0.0.4

func (h *Handler) AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware is a middleware to validate if a user is authenticated

func (*Handler) CollectStaticMetrics added in v0.0.6

func (h *Handler) CollectStaticMetrics(config *models.SubmitMetricsConfig) error

CollectStaticMetrics is used for collecting static metrics from prometheus and submitting it to Remote Provider

func (*Handler) DeleteMesheryPatternHandler added in v0.5.1

func (h *Handler) DeleteMesheryPatternHandler(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

DeleteMesheryPatternHandler deletes a pattern with the given id

func (*Handler) EventStreamHandler added in v0.0.6

func (h *Handler) EventStreamHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, p models.Provider)

EventStreamHandler endpoint is used for streaming events to the frontend

func (*Handler) ExportPatternFile added in v0.5.1

func (h *Handler) ExportPatternFile(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

ExportPatternFile converts a patternfile into cytoscapejs notation

func (*Handler) ExtensionsEndpointHandler added in v0.5.1

func (h *Handler) ExtensionsEndpointHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

func (*Handler) FetchResultsHandler added in v0.0.6

func (h *Handler) FetchResultsHandler(w http.ResponseWriter, req *http.Request, _ *models.Preference, user *models.User, p models.Provider)

FetchResultsHandler fetchs pages of results from Remote Provider and presents it to the UI

func (*Handler) FetchSmiResultsHandler added in v0.4.7

func (h *Handler) FetchSmiResultsHandler(w http.ResponseWriter, req *http.Request, _ *models.Preference, user *models.User, p models.Provider)

GetSmiResultsHandler gets the results of all the smi conformance tests

func (*Handler) GetAllAdaptersHandler added in v0.0.6

func (h *Handler) GetAllAdaptersHandler(w http.ResponseWriter, req *http.Request, provider models.Provider)

GetAllAdaptersHandler is used to fetch all the adapters

func (*Handler) GetContextsFromK8SConfig added in v0.0.6

func (h *Handler) GetContextsFromK8SConfig(w http.ResponseWriter, req *http.Request)

GetContextsFromK8SConfig returns the context list for a given k8s config

func (*Handler) GetMesheryPatternHandler added in v0.5.1

func (h *Handler) GetMesheryPatternHandler(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

GetMesheryPatternHandler fetched the patterhn with the given id

func (*Handler) GetMesheryPatternsHandler added in v0.5.1

func (h *Handler) GetMesheryPatternsHandler(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

GetMesheryPatternsHandler returns the list of all the patterns saved by the current user

func (*Handler) GetResultHandler added in v0.3.10

func (h *Handler) GetResultHandler(w http.ResponseWriter, req *http.Request, _ *models.Preference, user *models.User, p models.Provider)

GetResultHandler gets an individual result from provider

func (*Handler) GetSMPServiceMeshes added in v0.5.1

func (h *Handler) GetSMPServiceMeshes(w http.ResponseWriter, r *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

GetSMPServiceMeshes handles the available meshes request

func (*Handler) GrafanaBoardImportForPrometheusHandler added in v0.0.6

func (h *Handler) GrafanaBoardImportForPrometheusHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

GrafanaBoardImportForPrometheusHandler accepts a Grafana board json, parses it and returns the list of panels

func (*Handler) GrafanaBoardsHandler added in v0.0.6

func (h *Handler) GrafanaBoardsHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, p models.Provider)

GrafanaBoardsHandler is used for fetching Grafana boards and panels

func (*Handler) GrafanaConfigHandler added in v0.0.6

func (h *Handler) GrafanaConfigHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, p models.Provider)

GrafanaConfigHandler is used for persisting or removing Grafana configuration

func (*Handler) GrafanaPingHandler added in v0.3.5

func (h *Handler) GrafanaPingHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, p models.Provider)

GrafanaPingHandler - used to initiate a Grafana ping

func (*Handler) GrafanaQueryHandler added in v0.0.6

func (h *Handler) GrafanaQueryHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, p models.Provider)

GrafanaQueryHandler is used for handling Grafana queries

func (*Handler) GrafanaQueryRangeHandler added in v0.0.6

func (h *Handler) GrafanaQueryRangeHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, p models.Provider)

GrafanaQueryRangeHandler is used for handling Grafana Range queries

func (*Handler) ImportPatternFile added in v0.5.1

func (h *Handler) ImportPatternFile(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

ImportPatternFile converts a cytoscapeJS JSON into a PatternFile

func (*Handler) InstalledMeshesHandler added in v0.2.0

func (h *Handler) InstalledMeshesHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

InstalledMeshesHandler - scans and tries to find out the installed meshes

func (*Handler) K8SConfigHandler added in v0.0.4

func (h *Handler) K8SConfigHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

K8SConfigHandler is used for persisting kubernetes config and context info

func (*Handler) KubernetesPingHandler added in v0.1.6

func (h *Handler) KubernetesPingHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

KubernetesPingHandler - fetches server version to simulate ping

func (*Handler) LoadExtensionFromPackage added in v0.5.1

func (h *Handler) LoadExtensionFromPackage(w http.ResponseWriter, req *http.Request, provider models.Provider) error

func (*Handler) LoadTestHandler added in v0.0.4

func (h *Handler) LoadTestHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

LoadTestHandler runs the load test with the given parameters

func (*Handler) LoadTestPrefencesHandler added in v0.3.7

func (h *Handler) LoadTestPrefencesHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

LoadTestPrefencesHandler is used for persisting load test preferences

func (*Handler) LoadTestUsingSMPHandler added in v0.4.7

func (h *Handler) LoadTestUsingSMPHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

LoadTestUsingSMPHandler runs the load test with the given parameters and SMP

func (*Handler) LoginHandler added in v0.0.4

func (h *Handler) LoginHandler(w http.ResponseWriter, r *http.Request, p models.Provider, fromMiddleWare bool)

LoginHandler redirects user for auth or issues session

func (*Handler) LogoutHandler added in v0.0.4

func (h *Handler) LogoutHandler(w http.ResponseWriter, req *http.Request, p models.Provider)

LogoutHandler destroys the session and redirects to home.

func (*Handler) MeshAdapterConfigHandler added in v0.0.6

func (h *Handler) MeshAdapterConfigHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

MeshAdapterConfigHandler is used to persist adapter config

func (*Handler) MeshOpsHandler added in v0.0.4

func (h *Handler) MeshOpsHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

MeshOpsHandler is used to send operations to the adapters

func (*Handler) MeshSyncDataHandler added in v0.5.1

func (h *Handler) MeshSyncDataHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

func (*Handler) OAMRegisterHandler added in v0.5.1

func (h *Handler) OAMRegisterHandler(rw http.ResponseWriter, r *http.Request)

OAMRegisterHandler handles OAM registry related operations

These operations can be: 1. Adding a workload/trait/scope 2. Getting list of workloads/traits/scopes

func (*Handler) OperatorHandler added in v0.5.1

func (h *Handler) OperatorHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

func (*Handler) OperatorStatusHandler added in v0.5.1

func (h *Handler) OperatorStatusHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

func (*Handler) PatternFileHandler added in v0.5.1

func (h *Handler) PatternFileHandler(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

PatternFileHandler handles the requested related to pattern files

func (*Handler) PatternFileRequestHandler added in v0.5.1

func (h *Handler) PatternFileRequestHandler(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

PatternFileRequestHandler will handle requests of both type GET and POST on the route /api/experimental/patterns

func (*Handler) PrometheusConfigHandler added in v0.0.6

func (h *Handler) PrometheusConfigHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

PrometheusConfigHandler is used for persisting prometheus configuration

func (*Handler) PrometheusPingHandler added in v0.3.7

func (h *Handler) PrometheusPingHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

PrometheusPingHandler - fetches server version to simulate ping

func (*Handler) PrometheusQueryHandler added in v0.0.6

func (h *Handler) PrometheusQueryHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

PrometheusQueryHandler handles prometheus queries

func (*Handler) PrometheusQueryRangeHandler added in v0.0.6

func (h *Handler) PrometheusQueryRangeHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

PrometheusQueryRangeHandler handles prometheus range queries

func (*Handler) PrometheusStaticBoardHandler added in v0.0.6

func (h *Handler) PrometheusStaticBoardHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

PrometheusStaticBoardHandler returns the static board

func (*Handler) ProviderCapabilityHandler added in v0.5.1

func (h *Handler) ProviderCapabilityHandler(
	w http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

ProviderCapabilityHandler returns the capabilities.json for the provider

func (*Handler) ProviderComponentsHandler added in v0.5.1

func (h *Handler) ProviderComponentsHandler(
	w http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

ProviderComponentsHandler handlers the requests to serve react components from the provider package

func (*Handler) ProviderHandler added in v0.3.10

func (h *Handler) ProviderHandler(w http.ResponseWriter, r *http.Request)

ProviderHandler - handles the choice of provider

func (*Handler) ProviderMiddleware added in v0.3.10

func (h *Handler) ProviderMiddleware(next http.Handler) http.Handler

ProviderMiddleware is a middleware to validate if a provider is set

func (*Handler) ProviderUIHandler added in v0.3.10

func (h *Handler) ProviderUIHandler(w http.ResponseWriter, r *http.Request)

ProviderUIHandler - serves providers UI

func (*Handler) ProvidersHandler added in v0.3.10

func (h *Handler) ProvidersHandler(w http.ResponseWriter, r *http.Request)

ProvidersHandler returns a list of providers

func (*Handler) SavePatternFile added in v0.5.1

func (h *Handler) SavePatternFile(
	rw http.ResponseWriter,
	r *http.Request,
	prefObj *models.Preference,
	user *models.User,
	provider models.Provider,
)

SavePatternFile is the http handler for saving the given pattern file to the provider

func (*Handler) SaveSelectedGrafanaBoardsHandler added in v0.0.6

func (h *Handler) SaveSelectedGrafanaBoardsHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, p models.Provider)

SaveSelectedGrafanaBoardsHandler is used to persist board and panel selection

func (*Handler) SaveSelectedPrometheusBoardsHandler added in v0.0.6

func (h *Handler) SaveSelectedPrometheusBoardsHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

SaveSelectedPrometheusBoardsHandler persists selected board and panels

func (*Handler) ScanGrafanaHandler added in v0.3.13

func (h *Handler) ScanGrafanaHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

ScanGrafanaHandler - fetches Grafana

func (*Handler) ScanPromGrafanaHandler added in v0.3.13

func (h *Handler) ScanPromGrafanaHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

ScanPromGrafanaHandler - fetches Prometheus and Grafana

func (*Handler) ScanPrometheusHandler added in v0.4.4

func (h *Handler) ScanPrometheusHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

ScanPrometheusHandler - fetches Prometheus

func (*Handler) ServerVersionHandler added in v0.3.18

func (h *Handler) ServerVersionHandler(w http.ResponseWriter, r *http.Request)

ServerVersionHandler handles the version api request for the server

func (*Handler) SessionInjectorMiddleware added in v0.2.0

func (h *Handler) SessionInjectorMiddleware(next func(http.ResponseWriter, *http.Request, *models.Preference, *models.User, models.Provider)) http.Handler

SessionInjectorMiddleware - is a middleware which injects user and session object

func (*Handler) SessionSyncHandler added in v0.0.6

func (h *Handler) SessionSyncHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

SessionSyncHandler is used to send session data to the UI for initial sync

func (*Handler) TokenHandler added in v0.3.15

func (h *Handler) TokenHandler(w http.ResponseWriter, r *http.Request, p models.Provider, fromMiddleWare bool)

TokenHandler Receives token from the actual provider

func (*Handler) UserHandler added in v0.0.4

func (h *Handler) UserHandler(w http.ResponseWriter, req *http.Request, _ *models.Preference, user *models.User, provider models.Provider)

UserHandler returns info about the logged in user

func (*Handler) UserTestPreferenceDelete added in v0.4.2

func (h *Handler) UserTestPreferenceDelete(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

UserTestPreferenceDelete deletes the PerformanceTestConfig object

func (*Handler) UserTestPreferenceGet added in v0.4.2

func (h *Handler) UserTestPreferenceGet(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

UserTestPreferenceGet gets the PerformanceTestConfig object

func (*Handler) UserTestPreferenceHandler added in v0.4.2

func (h *Handler) UserTestPreferenceHandler(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

UserTestPreferenceHandler is used for persisting load test preferences

func (*Handler) UserTestPreferenceStore added in v0.4.2

func (h *Handler) UserTestPreferenceStore(w http.ResponseWriter, req *http.Request, prefObj *models.Preference, user *models.User, provider models.Provider)

UserTestPreferenceStore is used for persisting load test preferences

type SMPMeshes added in v0.5.1

type SMPMeshes struct {
	AvailableMeshes []string `json:"available_meshes,omitempty"`
}

SMPMeshes defines the JSON payload structure for available meshes api

type Status added in v0.5.1

type Status struct {
	OperatorInstalled   string `json:"operator-installed,omitempty"`
	BrokerInstalled     string `json:"broker-installed,omitempty"`
	MeshsyncInstalled   string `json:"meshsync-installed,omitempty"`
	SubscriptionStarted string `json:"subscription-started,omitempty"`
	EventHandlerStarted string `json:"event-handler-started,omitempty"`
	Error               string `json:"error,omitempty"`
}

type Version added in v0.3.18

type Version struct {
	Build          string `json:"build,omitempty"`
	Latest         string `json:"latest,omitempty"`
	Outdated       *bool  `json:"outdated,omitempty"`
	CommitSHA      string `json:"commitsha,omitempty"`
	ReleaseChannel string `json:"release_channel,omitempty"`
}

Version defines the Json payload structure for version api\

Jump to

Keyboard shortcuts

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