handlers

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 51 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"
	ErrCreatingKubernetesComponentsCode = "2177"
	ErrValidateCode                     = "2248"
	ErrApplicationContentCode           = "2245"
	ErrRemoteApplicationURL             = "2249"
	ErrClonePatternCode                 = "2246"
	ErrCloneFilterCode                  = "2247"
)

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

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

func ErrApplicationFailure(err error, obj string) error

func ErrApplicationSourceContent

func ErrApplicationSourceContent(err error, obj string) error

func ErrApplyChange

func ErrApplyChange(err error) error

func ErrBlankName

func ErrBlankName(err error) error

func ErrChangeK8sContext

func ErrChangeK8sContext(err error) error

func ErrCloneFilter added in v0.6.4

func ErrCloneFilter(err error) error

func ErrClonePattern added in v0.6.4

func ErrClonePattern(err error) error

func ErrCompConfigPairs

func ErrCompConfigPairs(err error) error

func ErrConversion

func ErrConversion(err error) error

func ErrConvertPattern

func ErrConvertPattern(err error) error

func ErrConvertToSpec

func ErrConvertToSpec(err error) error

func ErrCreateDir

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

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

func ErrEncoding(err error, obj string) error

func ErrExecutionPlan

func ErrExecutionPlan(err error) error

func ErrFailToDelete

func ErrFailToDelete(err error, obj string) error

func ErrFailToLoadExtensions

func ErrFailToLoadExtensions(err error) error

func ErrFailToSave

func ErrFailToSave(err error, obj string) error

func ErrFetchFilter

func ErrFetchFilter(err error) error

func ErrFetchKubernetes

func ErrFetchKubernetes(err error) error

func ErrFetchPattern

func ErrFetchPattern(err error) error

func ErrFetchSMIResults

func ErrFetchSMIResults(err error) error

func ErrFormFile

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

func ErrGetResult(err error) error

func ErrGrafanaBoards

func ErrGrafanaBoards(err error) error

func ErrGrafanaQuery

func ErrGrafanaQuery(err error) error

func ErrGrafanaScan

func ErrGrafanaScan(err error) error

func ErrImportFilter

func ErrImportFilter(err error) error

func ErrImportPattern

func ErrImportPattern(err error) error

func ErrInvalidKubeConfig

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

func ErrInvalidLTURL(url string) error

func ErrInvalidPattern

func ErrInvalidPattern(err error) error

func ErrInvalidRequestObject

func ErrInvalidRequestObject(fields ...string) error

func ErrKubeClient

func ErrKubeClient(err error) error

func ErrKubeVersion

func ErrKubeVersion(err error) error

func ErrLoadConfig

func ErrLoadConfig(err error) error

func ErrLoadTest

func ErrLoadTest(err error, obj string) error

func ErrMarshal

func ErrMarshal(err error, obj string) error

func ErrOpenFile

func ErrOpenFile(file string) error

func ErrOperationID

func ErrOperationID(err error) error

func ErrPanicRecovery

func ErrPanicRecovery(r interface{}) error

func ErrParseBool

func ErrParseBool(err error, obj string) error

func ErrParseForm

func ErrParseForm(err error) error

func ErrParsePattern

func ErrParsePattern(err error) error

func ErrPatternFile

func ErrPatternFile(err error) error

func ErrPluginLookup

func ErrPluginLookup(err error) error

func ErrPluginOpen

func ErrPluginOpen(err error) error

func ErrPluginRun

func ErrPluginRun(err error) error

func ErrPrometheusBoards

func ErrPrometheusBoards(err error) error

func ErrPrometheusQuery

func ErrPrometheusQuery(err error) error

func ErrPrometheusScan

func ErrPrometheusScan(err error) error

func ErrPublishSmiResults

func ErrPublishSmiResults(err error) error

func ErrQueryGet

func ErrQueryGet(obj string) error

func ErrReadConfig

func ErrReadConfig(err error) error

func ErrRecordPreferences

func ErrRecordPreferences(err error) error

func ErrRemoteApplication

func ErrRemoteApplication(err error) error

func ErrRequestBody

func ErrRequestBody(err error) error

func ErrRetrieveData

func ErrRetrieveData(err error) error

func ErrRetrieveMeshData

func ErrRetrieveMeshData(err error) error

func ErrRetrieveUserToken

func ErrRetrieveUserToken(err error) error

func ErrSaveFilter

func ErrSaveFilter(err error) error

func ErrSavePattern

func ErrSavePattern(err error) error

func ErrSaveSession

func ErrSaveSession(err error) error

func ErrSavingUserPreference

func ErrSavingUserPreference(err error) error

func ErrScopeDefinition

func ErrScopeDefinition(err error) error

func ErrStreamClient

func ErrStreamClient(err error) error

func ErrStreamEvents

func ErrStreamEvents(err error) error

func ErrTraitDefinition

func ErrTraitDefinition(err error) error

func ErrUnmarshal

func ErrUnmarshal(err error, obj string) error

func ErrValidate

func ErrValidate(err error) error

func ErrVersionCompare

func ErrVersionCompare(err error) error

func ErrWorkloadDefinition

func ErrWorkloadDefinition(err error) error

func NewHandlerInstance

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

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

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

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

Defines the version metadata for the extension

type Handler

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

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

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

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

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

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

AuthMiddleware is a middleware to validate if a user is authenticated

func (*Handler) CloneMesheryFilterHandler added in v0.6.4

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

swagger:route POST /api/filter/clone/{id} FiltersAPI idCloneMesheryFilter Handle Clone for a Meshery Filter

Creates a local copy of a public filter with id: id responses:

200: noContentWrapper

CloneMesheryFilterHandler clones a filter with the given id

func (*Handler) CloneMesheryPatternHandler added in v0.6.4

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

swagger:route POST /api/pattern/clone/{id} PatternsAPI idCloneMesheryPattern Handle Clone for a Meshery Pattern

Creates a local copy of a public pattern with id: id responses:

200: noContentWrapper

CloneMesheryPatternHandler clones a pattern with the given id

func (*Handler) CollectStaticMetrics

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

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

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

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

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

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

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

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

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

func (*Handler) FetchAllResultsHandler

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

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

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

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

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

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) GetCatalogMesheryFiltersHandler added in v0.6.4

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

swagger:route POST /api/filter/catalog FiltersAPI idGetCatalogMesheryFiltersHandler Handle GET request for catalog filters

Used to get catalog filters responses:

200: mesheryFilterResponseWrapper

func (*Handler) GetCatalogMesheryPatternsHandler added in v0.6.4

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

swagger:route POST /api/pattern/catalog PatternsAPI idGetCatalogMesheryPatternsHandler Handle GET request for catalog patterns

Used to get catalog patterns responses:

200: mesheryPatternResponseWrapper

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

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

GetContextsFromK8SConfig returns the context list for a given k8s config

func (*Handler) GetMesheryApplicationHandler

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

func (h *Handler) GetMesheryApplicationSourceHandler(
	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) GetMesheryApplicationTypesHandler

func (h *Handler) GetMesheryApplicationTypesHandler(
	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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

GrafanaQueryRangeHandler is used for handling Grafana Range queries

func (*Handler) GraphqlMiddleware

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

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

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

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

func (*Handler) LoadTestHandler

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

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

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

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

LogoutHandler destroys the session and redirects to home.

func (*Handler) MeshAdapterConfigHandler

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

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

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

func (*Handler) OAMComponentDetailsHandler

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

func (*Handler) OAMRegisterHandler

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

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

POSTOAMRegisterHandler handles registering OMA objects

func (*Handler) PatternFileHandler

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

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

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

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

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

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

PrometheusQueryRangeHandler handles prometheus range queries

func (*Handler) PrometheusStaticBoardHandler

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

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

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

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

ProviderHandler - handles the choice of provider

func (*Handler) ProviderMiddleware

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

ProviderMiddleware is a middleware to validate if a provider is set

func (*Handler) ProviderUIHandler

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

ProviderUIHandler - serves providers UI

func (*Handler) ProvidersHandler

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

ProvidersHandler returns a list of providers

func (*Handler) SavePerformanceProfileHandler

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

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

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

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

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

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

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

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

ServerVersionHandler handles the version api request for the server

func (*Handler) SessionInjectorMiddleware

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

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

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

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

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

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

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

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

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

func (*Handler) ValidationHandler

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

request body should be json request body should be of format - {validationItems: {[id]:{schema: string, value: string, valueType: "JSON"|"YAML"|"CUE"}}} response format - {[id]: {isValid: bool, error: string}}

type IDParameterWrapper

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

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

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

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:"K8sManifest,omitempty"`
}

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

type SMPMeshes

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

SMPMeshes defines the JSON payload structure for available meshes api

type SaveK8sContextResponse

type SaveK8sContextResponse struct {
	InsertedContexts []models.K8sContext `json:"inserted_contexts"`
	UpdatedContexts  []models.K8sContext `json:"updated_contexts"`
	ErroredContexts  []models.K8sContext `json:"errored_contexts"`
}

SaveK8sContextResponse - struct used as (json marshaled) response to requests for saving k8s contexts

type SessionSyncData

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

type SessionSyncDataK8sConfig

type SessionSyncDataK8sConfig struct {
	ContextID         string     `json:"id,omitempty"`
	ContextName       string     `json:"name,omitempty"`
	ClusterConfigured bool       `json:"clusterConfigured,omitempty"`
	ConfiguredServer  string     `json:"server,omitempty"`
	ClusterID         string     `json:"clusterID,omitempty"`
	CreatedAt         *time.Time `json:"created_at,omitempty"`
	UpdatedAt         *time.Time `json:"updated_at,omitempty"`
}

type UUIDParamsWrapper

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

Parameter swagger:parameters idDeleteLoadPreferences idGetLoadPreferences

type Version

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