handlers

package
v0.6.0-rc.6a Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Overview

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

Package handlers Meshery API.

the purpose of this application is to provide an application that is using plain go code to define an API

This should demonstrate all the possible comment annotations that are available to turn go code into a fully compliant swagger 2.0 spec

Schemes: http
BasePath: /
Version: 0.4.27
License: Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0.txt

Consumes:
- application/json
- multipart/form-data

Produces:
- application/json

Security:
- token: []

SecurityDefinitions:
token:
     type: apiKey
     name: token
     in: cookie

swagger:meta

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

View Source
const (
	ErrInvalidK8SConfigCode     = "2000"
	ErrNilClientCode            = "2001"
	ErrPrometheusScanCode       = "2002"
	ErrGrafanaScanCode          = "2003"
	ErrRecordPreferencesCode    = "2004"
	ErrGrafanaConfigCode        = "2005"
	ErrPrometheusConfigCode     = "2006"
	ErrGrafanaQueryCode         = "2007"
	ErrPrometheusQueryCode      = "2008"
	ErrGrafanaBoardsCode        = "2009"
	ErrPrometheusBoardsCode     = "2010"
	ErrStaticBoardsCode         = "2011"
	ErrRequestBodyCode          = "2012"
	ErrMarshalCode              = "2013"
	ErrUnmarshalCode            = "2014"
	ErrEncodingCode             = "2015"
	ErrParseBoolCode            = "2016"
	ErrStreamEventsCode         = "2017"
	ErrStreamClientCode         = "2018"
	ErrUnmarshalEventCode       = "2019"
	ErrPublishSmiResultsCode    = "2020"
	ErrMarshalEventCode         = "2021"
	ErrPluginOpenCode           = "2022"
	ErrPluginLookupCode         = "2023"
	ErrPluginRunCode            = "2024"
	ErrParseFormCode            = "2025"
	ErrQueryGetCode             = "2026"
	ErrGetResultCode            = "2027"
	ErrConvertToSpecCode        = "2028"
	ErrFetchSMIResultsCode      = "2029"
	ErrFormFileCode             = "2030"
	ErrReadConfigCode           = "2031"
	ErrLoadConfigCode           = "2032"
	ErrOpenFileCode             = "2033"
	ErrKubeVersionCode          = "2034"
	ErrAddAdapterCode           = "2035"
	ErrRetrieveDataCode         = "2036"
	ErrValidAdapterCode         = "2037"
	ErrOperationIDCode          = "2038"
	ErrMeshClientCode           = "2039"
	ErrApplyChangeCode          = "2040"
	ErrRetrieveMeshDataCode     = "2041"
	ErrApplicationFailureCode   = "2042"
	ErrDecodingCode             = "2043"
	ErrRetrieveUserTokenCode    = "2044"
	ErrFailToSaveCode           = "2045"
	ErrFailToDeleteCode         = "2046"
	ErrWriteResponseCode        = "2202"
	ErrTestConfigsCode          = "2203"
	ErrInvalidGenValueCode      = "2204"
	ErrFailToLoadExtensionsCode = "2205"
	ErrConversionCode           = "2206"
	ErrParseDurationCode        = "2207"
	ErrLoadTestCode             = "2208"
	ErrFetchKubernetesCode      = "2209"
	ErrPanicRecoveryCode        = "2210"
	ErrBlankNameCode            = "2211"
	ErrInvalidLTURLCode         = "2053"
	ErrDataSendCode             = "2137"
	ErrVersionCompareCode       = "2138"
	ErrSaveSessionCode          = "2136"
	ErrKubeClientCode           = "2139"
	ErrWorkloadDefinitionCode   = "2140"
	ErrTraitDefinitionCode      = "2141"
	ErrScopeDefinitionCode      = "2142"
	ErrPatternFileCode          = "2143"
	ErrExecutionPlanCode        = "2144"
	ErrInvalidPatternCode       = "2145"
	ErrCompConfigPairsCode      = "2146"
	ErrCreateDirCode            = "2150"
	ErrInvalidRequestObjectCode = "2151"
	ErrChangeK8sContextCode     = "2152"
	ErrSavingUserPreferenceCode = "2172"
	ErrGetFilterCode            = "2156"
	ErrSaveFilterCode           = "2157"
	ErrDecodeFilterCode         = "2158"
	ErrEncodeFilterCode         = "2159"
	ErrImportFilterCode         = "2160"
	ErrFetchFilterCode          = "2161"
	ErrDeleteFilterCode         = "2162"
	ErrSavePatternCode          = "2163"
	ErrGetPatternCode           = "2164"
	ErrDeletePatternCode        = "2165"
	ErrFetchPatternCode         = "2166"
	ErrImportPatternCode        = "2167"
	ErrEncodePatternCode        = "2168"
	ErrDecodePatternCode        = "2169"
	ErrParsePatternCode         = "2170"
	ErrConvertPatternCode       = "2171"
	ErrMesheryInstanceIDCode    = "2173"
	ErrInvalidKubeConfigCode    = "2174"
	ErrInvalidKubeHandlerCode   = "2175"
	ErrInvalidKubeContextCode   = "2176"
	ErrInvalidKubeCon
	ErrCreatingKubernetesComponentsCode = "2177"
)

Variables

View Source
var (
	ErrInvalidK8SConfig  = errors.New(ErrInvalidK8SConfigCode, errors.Alert, []string{"No valid kubernetes config found. Make sure to pass contextIDs in query parameters."}, []string{"Kubernetes config is not initialized with Meshery"}, []string{"Kubernetes config is not accessible to meshery or not valid"}, []string{"Upload your kubernetes config via the settings dashboard. If uploaded, wait for a minute for it to get initialized"})
	ErrNilClient         = errors.New(ErrNilClientCode, errors.Alert, []string{"Kubernetes client not initialized"}, []string{"Kubernetes config is not initialized with Meshery"}, []string{"Kubernetes config is not accessible to meshery or not valid"}, []string{"Upload your kubernetes config via the settings dashboard. If uploaded, wait for a minute for it to get initialized"})
	ErrPrometheusConfig  = errors.New(ErrPrometheusConfigCode, errors.Alert, []string{"Prometheus endpoint not configured"}, []string{"Cannot find valid Prometheus endpoint in user pref"}, []string{"Prometheus endpoint might not be reachable from meshery"}, []string{"Setup your Prometheus Endpoint via the settings dashboard"})
	ErrGrafanaConfig     = errors.New(ErrGrafanaConfigCode, errors.Alert, []string{"Grafana endpoint not configured"}, []string{"Cannot find valid grafana endpoint in user pref"}, []string{"Grafana endpoint might not be reachable from meshery"}, []string{"Setup your Grafana Endpoint via the settings dashboard"})
	ErrStaticBoards      = errors.New(ErrStaticBoardsCode, errors.Alert, []string{"unable to get static board"}, []string{"unable to get static board"}, []string{"No boards could be available in grafana"}, []string{})
	ErrValidAdapter      = errors.New(ErrValidAdapterCode, errors.Alert, []string{"Unable to find valid Adapter URL"}, []string{"unable to find a valid adapter for the given adapter URL"}, []string{"Given adapter URL is not valid"}, []string{"Please provide a valid Adapter URL"})
	ErrAddAdapter        = errors.New(ErrAddAdapterCode, errors.Alert, []string{"meshLocationURL is empty"}, []string{"meshLocationURL is empty to add an adapter"}, []string{"meshLocationURL cannot be empty to add an adapter"}, []string{"please provide the meshLocationURL"})
	ErrMeshClient        = errors.New(ErrMeshClientCode, errors.Alert, []string{"Error creating a mesh client", "Error pinging the mesh adapter"}, []string{"Unable to create a mesh client", "Unable to ping the mesh adapter"}, []string{"Adapter could not be pinged"}, []string{"Unable to connect to the Mesh adapter using the given config, please try again"})
	ErrWriteResponse     = errors.New(ErrWriteResponseCode, errors.Alert, []string{"Error writing response"}, []string{}, []string{}, []string{})
	ErrTestConfigs       = errors.New(ErrTestConfigsCode, errors.Alert, []string{"Error fetching test configs"}, []string{}, []string{}, []string{})
	ErrInvalidGenValue   = errors.New(ErrInvalidGenValueCode, errors.Alert, []string{"Invalid value for gen"}, []string{}, []string{}, []string{"please provide a valid value for gen (load generator)"})
	ErrParseDuration     = errors.New(ErrParseDurationCode, errors.Alert, []string{"error parsing test duration"}, []string{}, []string{"The format of the duration passed could be incorrect"}, []string{"please refer to:  https://docs.meshery.io/guides/mesheryctl#performance-management"})
	ErrMesheryInstanceID = errors.New(ErrMesheryInstanceIDCode, errors.Alert, []string{"Error: Meshery Instance ID is empty or is invalid"}, []string{}, []string{}, []string{})
	ErrPerformanceTest   = errors.New(ErrLoadTestCode, errors.Alert, []string{"load test error"}, []string{}, []string{"Load test endpoint could be not reachable"}, []string{"Make sure load test endpoint is reachable"})
)

Functions

func CheckLatestVersion added in v0.4.16

func CheckLatestVersion(serverVersion string) (*bool, string, error)

CheckLatestVersion takes in the current server version compares it with the target and returns the (isOutdated, latestVersion, error)

func ErrApplicationFailure added in v0.5.30

func ErrApplicationFailure(err error, obj string) error

func ErrApplyChange added in v0.5.30

func ErrApplyChange(err error) error

func ErrBlankName added in v0.5.37

func ErrBlankName(err error) error

func ErrChangeK8sContext added in v0.5.50

func ErrChangeK8sContext(err error) error

func ErrCompConfigPairs added in v0.5.38

func ErrCompConfigPairs(err error) error

func ErrConversion added in v0.5.37

func ErrConversion(err error) error

func ErrConvertPattern

func ErrConvertPattern(err error) error

func ErrConvertToSpec added in v0.5.30

func ErrConvertToSpec(err error) error

func ErrCreateDir added in v0.5.46

func ErrCreateDir(err error, obj string) error

func ErrCreatingKubernetesComponents

func ErrCreatingKubernetesComponents(err error, ctxID string) error

func ErrDecodeFilter

func ErrDecodeFilter(err error) error

func ErrDecodePattern

func ErrDecodePattern(err error) error

func ErrDecoding added in v0.5.30

func ErrDecoding(err error, obj string) error

func ErrDeleteFilter

func ErrDeleteFilter(err error) error

func ErrDeletePattern

func ErrDeletePattern(err error) error

func ErrEncodeFilter

func ErrEncodeFilter(err error) error

func ErrEncodePattern

func ErrEncodePattern(err error) error

func ErrEncoding added in v0.5.30

func ErrEncoding(err error, obj string) error

func ErrExecutionPlan added in v0.5.38

func ErrExecutionPlan(err error) error

func ErrFailToDelete added in v0.5.32

func ErrFailToDelete(err error, obj string) error

func ErrFailToLoadExtensions added in v0.5.37

func ErrFailToLoadExtensions(err error) error

func ErrFailToSave added in v0.5.32

func ErrFailToSave(err error, obj string) error

func ErrFetchFilter

func ErrFetchFilter(err error) error

func ErrFetchKubernetes added in v0.5.37

func ErrFetchKubernetes(err error) error

func ErrFetchPattern

func ErrFetchPattern(err error) error

func ErrFetchSMIResults added in v0.5.30

func ErrFetchSMIResults(err error) error

func ErrFormFile added in v0.5.30

func ErrFormFile(err error) error

func ErrGetFilter

func ErrGetFilter(err error) error

func ErrGetLatestVersion

func ErrGetLatestVersion(err error) error

func ErrGetPattern

func ErrGetPattern(err error) error

func ErrGetResult added in v0.5.30

func ErrGetResult(err error) error

func ErrGrafanaBoards added in v0.5.26

func ErrGrafanaBoards(err error) error

func ErrGrafanaQuery added in v0.5.26

func ErrGrafanaQuery(err error) error

func ErrGrafanaScan added in v0.5.26

func ErrGrafanaScan(err error) error

func ErrImportFilter

func ErrImportFilter(err error) error

func ErrImportPattern

func ErrImportPattern(err error) error

func ErrInvalidKubeConfig added in v0.5.12

func ErrInvalidKubeConfig(err error, content string) error

func ErrInvalidKubeContext

func ErrInvalidKubeContext(err error, content string) error

func ErrInvalidKubeHandler

func ErrInvalidKubeHandler(err error, content string) error

func ErrInvalidLTURL added in v0.5.38

func ErrInvalidLTURL(url string) error

func ErrInvalidPattern added in v0.5.38

func ErrInvalidPattern(err error) error

func ErrInvalidRequestObject added in v0.5.50

func ErrInvalidRequestObject(fields ...string) error

func ErrKubeClient added in v0.5.38

func ErrKubeClient(err error) error

func ErrKubeVersion added in v0.5.30

func ErrKubeVersion(err error) error

func ErrLoadConfig added in v0.5.30

func ErrLoadConfig(err error) error

func ErrLoadTest added in v0.5.37

func ErrLoadTest(err error, obj string) error

func ErrMarshal added in v0.5.26

func ErrMarshal(err error, obj string) error

func ErrOpenFile added in v0.5.30

func ErrOpenFile(file string) error

func ErrOperationID added in v0.5.30

func ErrOperationID(err error) error

func ErrPanicRecovery added in v0.5.37

func ErrPanicRecovery(r interface{}) error

func ErrParseBool added in v0.5.30

func ErrParseBool(err error, obj string) error

func ErrParseForm added in v0.5.30

func ErrParseForm(err error) error

func ErrParsePattern

func ErrParsePattern(err error) error

func ErrPatternFile added in v0.5.38

func ErrPatternFile(err error) error

func ErrPluginLookup added in v0.5.30

func ErrPluginLookup(err error) error

func ErrPluginOpen added in v0.5.30

func ErrPluginOpen(err error) error

func ErrPluginRun added in v0.5.30

func ErrPluginRun(err error) error

func ErrPrometheusBoards added in v0.5.26

func ErrPrometheusBoards(err error) error

func ErrPrometheusQuery added in v0.5.26

func ErrPrometheusQuery(err error) error

func ErrPrometheusScan added in v0.5.26

func ErrPrometheusScan(err error) error

func ErrPublishSmiResults added in v0.5.30

func ErrPublishSmiResults(err error) error

func ErrQueryGet added in v0.5.30

func ErrQueryGet(obj string) error

func ErrReadConfig added in v0.5.30

func ErrReadConfig(err error) error

func ErrRecordPreferences added in v0.5.26

func ErrRecordPreferences(err error) error

func ErrRequestBody added in v0.5.26

func ErrRequestBody(err error) error

func ErrRetrieveData added in v0.5.30

func ErrRetrieveData(err error) error

func ErrRetrieveMeshData added in v0.5.30

func ErrRetrieveMeshData(err error) error

func ErrRetrieveUserToken added in v0.5.30

func ErrRetrieveUserToken(err error) error

func ErrSaveFilter

func ErrSaveFilter(err error) error

func ErrSavePattern

func ErrSavePattern(err error) error

func ErrSaveSession added in v0.5.38

func ErrSaveSession(err error) error

func ErrSavingUserPreference

func ErrSavingUserPreference(err error) error

func ErrScopeDefinition added in v0.5.38

func ErrScopeDefinition(err error) error

func ErrStreamClient added in v0.5.30

func ErrStreamClient(err error) error

func ErrStreamEvents added in v0.5.30

func ErrStreamEvents(err error) error

func ErrTraitDefinition added in v0.5.38

func ErrTraitDefinition(err error) error

func ErrUnmarshal added in v0.5.26

func ErrUnmarshal(err error, obj string) error

func ErrVersionCompare added in v0.5.38

func ErrVersionCompare(err error) error

func ErrWorkloadDefinition added in v0.5.38

func ErrWorkloadDefinition(err error) error

func NewHandlerInstance added in v0.0.4

func NewHandlerInstance(
	handlerConfig *models.HandlerConfig,
	meshSyncCh chan struct{},
	logger logger.Handler,
	brokerConn broker.Handler,
	compRegHelper *models.ComponentsRegistrationHelper,
	mctrlHelper *models.MesheryControllersHelper,
	dbHandler *database.Handler,
) models.HandlerInterface

NewHandlerInstance returns a Handler instance

func RegisterK8sComponents

func RegisterK8sComponents(ctxt context.Context, config []byte, ctxID string) (err error)

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 ContentModifier

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

To be used while adding metadata to patterns,filters and applicationss

func NewContentModifier

func NewContentModifier(token string,
	provider models.Provider,
	prefObj *models.Preference,
	userID string) *ContentModifier

func (*ContentModifier) AddMetadataForPatterns

func (mc *ContentModifier) AddMetadataForPatterns(ctx context.Context, contentBytes *[]byte) error

TODO: Similar mechanisms for filters and applications Takes in response bytes, and add metadata to it based on some checks

type ExtensionVersion added in v0.5.68

type ExtensionVersion struct {
	Version string `json:"version,omitempty"`
}

Defines the version metadata for the extension

type Handler added in v0.0.4

type Handler struct {
	K8sCompRegHelper   *models.ComponentsRegistrationHelper
	MesheryCtrlsHelper *models.MesheryControllersHelper
	// 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) AdaptersHandler added in v0.5.46

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

AdaptersHandler is used to fetch all the adapters

func (*Handler) ApplicationFileHandler added in v0.5.30

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

ApplicationFileHandler handles the requested related to application files

func (*Handler) ApplicationFileRequestHandler added in v0.5.26

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

ApplicationFileRequestHandler will handle requests of both type GET and POST on the route /api/application

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

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

func (*Handler) DeleteMesheryApplicationHandler added in v0.5.26

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

DeleteMesheryApplicationHandler deletes a application with the given id

func (*Handler) DeleteMesheryFilterHandler added in v0.5.4

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

swagger:route DELETE /api/filter/{id} FiltersAPI idDeleteMesheryFilter Handle Delete for a Meshery Filter

Deletes a meshery filter with ID: id responses:

200: noContentWrapper

DeleteMesheryFilterHandler deletes a filter with the given id

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

swagger:route DELETE /api/pattern/{id} PatternsAPI idDeleteMesheryPattern Handle Delete for a Meshery Pattern

Deletes a meshery pattern with ID: id responses:

200: noContentWrapper

DeleteMesheryPatternHandler deletes a pattern with the given id

func (*Handler) DeleteMultiMesheryPatternsHandler

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

swagger:route DELETE /api/patterns PatternsAPI idDeleteMesheryPattern Handle Delete for multiple Meshery Patterns

DeleteMultiMesheryPatternsHandler deletes patterns with the given ids

func (*Handler) DeletePerformanceProfileHandler added in v0.5.2

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

DeletePerformanceProfileHandler deletes a performance profile with the given id

func (*Handler) DeleteScheduleHandler added in v0.5.2

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

DeleteScheduleHandler deletes a schedule 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) 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) ExtensionsHandler

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

* ExtensionsHandler is a handler function which works as a proxy to resolve the * request of any extension point to its remote provider

func (*Handler) ExtensionsVersionHandler added in v0.5.68

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

func (*Handler) FetchAllResultsHandler added in v0.5.2

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

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

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

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

FetchSingleSmiResultHandler gets the result of single smi conformance test

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) FilterFileHandler added in v0.5.59

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

FilterFileHandler handles the requested related to filter files

func (*Handler) FilterFileRequestHandler added in v0.5.4

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

swagger:route GET /api/filter FiltersAPI idGetFilterFile Handle GET request for all filters

Returns all the Meshery Filters saved by the current user responses:

200: mesheryFiltersResponseWrapper

FilterFileRequestHandler will handle requests of both type GET and POST on the route /api/filter

func (*Handler) GETOAMRegisterHandler added in v0.5.38

func (h *Handler) GETOAMRegisterHandler(typ string, rw http.ResponseWriter, trim bool)

GETOAMRegisterHandler handles the get requests for the OAM objects

func (*Handler) GetAllContexts

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

func (*Handler) GetContext

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

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) GetMesheryApplicationHandler added in v0.5.26

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

GetMesheryApplicationHandler fetched the application with the given id

func (*Handler) GetMesheryApplicationsHandler added in v0.5.26

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

GetMesheryApplicationsHandler returns the list of all the applications saved by the current user

func (*Handler) GetMesheryFilterFileHandler added in v0.5.37

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

swagger:route GET /api/filter/file/{id} FiltersAPI idGetFilterFiles Handle GET request for filter file with given id

Returns the Meshery Filter file saved by the current user with the given id responses:

200: mesheryFilterResponseWrapper

func (*Handler) GetMesheryFilterHandler added in v0.5.4

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

GetMesheryFilterHandler fetched the filter with the given id

func (*Handler) GetMesheryFiltersHandler added in v0.5.4

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

GetMesheryFiltersHandler returns the list of all the filters saved by the current user

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 pattern 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) GetPerformanceProfileHandler added in v0.5.2

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

swagger:route GET /api/user/performance/profiles/{id} PerformanceAPI idGetSinglePerformanceProfile Handle GET requests for performance results of a profile

Returns single performance profile with the given id responses:

200: performanceProfileResponseWrapper

GetPerformanceProfileHandler fetched the performance profile with the given id

func (*Handler) GetPerformanceProfilesHandler added in v0.5.2

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

GetPerformanceProfilesHandler returns the list of all the performance profiles 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) GetScheduleHandler added in v0.5.2

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

GetScheduleHandler fetches the schedule with the given id

func (*Handler) GetSchedulesHandler added in v0.5.2

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

GetSchedulesHandler returns the list of all the schedules saved by the current user

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 fetching or 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)

GrafanaQueryRangeHandler is used for handling Grafana Range queries

func (*Handler) GraphqlMiddleware added in v0.5.38

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

GraphqlSessionInjectorMiddleware - is a middleware which injects user and session object

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

KubernetesMiddleware is a middleware that is responsible for handling kubernetes related stuff such as setting contexts, component generation etc.

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

func (h *Handler) LoadContextsAndPersist(token string, prov models.Provider) ([]*models.K8sContext, error)

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

MesheryControllersMiddleware is a middleware that is responsible for handling meshery controllers(operator, meshsync and broker) related stuff such as getting status, reconciling their deployments etc.

func (*Handler) OAMComponentDetailByIDHandler added in v0.5.65

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

func (*Handler) OAMComponentDetailsHandler added in v0.5.65

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

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) POSTOAMRegisterHandler added in v0.5.38

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

POSTOAMRegisterHandler handles registering OMA objects

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

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)

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) SavePerformanceProfileHandler added in v0.5.2

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

SavePerformanceProfileHandler will save performance profile using the current provider's persistence mechanism

func (*Handler) SaveScheduleHandler added in v0.5.2

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

SaveScheduleHandler will save schedule using the current provider's persistence mechanism

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) UserPrefsHandler added in v0.5.39

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

UserPrefsHandler updates anonymous stats for user or for persisting load test preferences

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 IDParameterWrapper added in v0.5.18

type IDParameterWrapper struct {
	// id for a specific
	// in: path
	// required: true
	ID strfmt.UUID `json:"id"`
}

swagger:parameters idGetMesheryPattern idDeleteMesheryPattern idGetSinglePerformanceProfile idDeletePerformanceProfile idGETProfileResults idDeleteSchedules idGetSingleSchedule idDeleteMesheryApplicationFile idGetMesheryApplication idDeleteMesheryFilter idGetMesheryFilter

type MesheryApplicationRequestBody added in v0.5.26

type MesheryApplicationRequestBody struct {
	URL             string                     `json:"url,omitempty"`
	Path            string                     `json:"path,omitempty"`
	Save            bool                       `json:"save,omitempty"`
	ApplicationData *models.MesheryApplication `json:"application_data,omitempty"`
}

MesheryApplicationRequestBody refers to the type of request body that SaveMesheryApplication would receive

type MesheryFilterRequestBody added in v0.5.12

type MesheryFilterRequestBody struct {
	URL        string                `json:"url,omitempty"`
	Path       string                `json:"path,omitempty"`
	Save       bool                  `json:"save,omitempty"`
	FilterData *models.MesheryFilter `json:"filter_data,omitempty"`
}

MesheryFilterRequestBody refers to the type of request body that SaveMesheryFilter would receive

type MesheryPatternRequestBody added in v0.5.6

type MesheryPatternRequestBody struct {
	Name          string                 `json:"name,omitempty"`
	URL           string                 `json:"url,omitempty"`
	Path          string                 `json:"path,omitempty"`
	Save          bool                   `json:"save,omitempty"`
	PatternData   *models.MesheryPattern `json:"pattern_data,omitempty"`
	CytoscapeJSON string                 `json:"cytoscape_json,omitempty"`
	K8sManifest   string                 `json:"k8s_manifest,omitempty"`
}

MesheryPatternRequestBody refers to the type of request body that SaveMesheryPattern would receive

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 SessionSyncData

type SessionSyncData struct {
	*models.Preference `json:",inline"`
	K8sConfigs         []SessionSyncDataK8sConfig `json:"k8sConfig,omitempty"`
}

type SessionSyncDataK8sConfig

type SessionSyncDataK8sConfig struct {
	ContextID         string `json:"contextID,omitempty"`
	ContextName       string `json:"contextName,omitempty"`
	ClusterConfigured bool   `json:"clusterConfigured,omitempty"`
	ConfiguredServer  string `json:"configuredServer,omitempty"`
	ClusterID         string `json:"clusterID,omitempty"`
}

type UUIDParamsWrapper added in v0.5.30

type UUIDParamsWrapper struct {
	// in: query
	UUID strfmt.UUID `json:"uuid"`
}

Parameter swagger:parameters idDeleteLoadPreferences idGetLoadPreferences

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