server

package
v0.0.0-...-a385994 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: AGPL-3.0, AGPL-3.0-or-later Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Dir is prefix of the assets in the bindata
	Dir = "../../frontend/build"
	// Default is the default item to load if 404
	Default = "../../frontend/build/index.html"
	// DebugDir is the prefix of the assets in development mode
	DebugDir = "../../../frontend/build"
	// DebugDefault is the default item to load if 404
	DebugDefault = "../../../frontend/build/index.html"
	// DefaultContentType is the content-type to return for the Default file
	DefaultContentType = "text/html; charset=utf-8"
)
View Source
const (
	// DefaultWidth is used if not specified
	DefaultWidth = 4
	// DefaultHeight is used if not specified
	DefaultHeight = 4
)
View Source
const (
	Terminal = iota
	Resize
)

msg flag type.

View Source
const ChunkSize int = 512

ChunkSize is the number of bytes per chunked transfer-encoding

View Source
const (
	ErrNotFlusher = "Expected http.ResponseWriter to be an http.Flusher, but wasn't"
)

ErrNotFlusher

View Source
const (
	// JSONType the mimetype for a json request
	JSONType = "application/json"
)
View Source
const ServerContextKey = serverContextKey("server")

ServerContextKey is the key used to specify that the server is making the requet via context

View Source
const UserContextKey = userContextKey("user")

UserContextKey is the context key for retrieving the user off of context

Variables

View Source
var (
	// EmailKey is used to kapacitor
	// via context.Context to request-scoped
	// functions.
	EmailKey = emailKey("email")

	// BasicProvider is the name of the basic provider
	BasicProvider = "cloudhub"
	// BasicScheme is the name of the basic scheme
	BasicScheme = "basic"
)
View Source
var (
	// SecretKey is the name of password hash key
	SecretKey = "cloudhub"
)

Functions

func AddQueryConfig

func AddQueryConfig(c *cloudhub.DashboardCell)

AddQueryConfig updates a cell by converting InfluxQL into queryconfigs If influxql cannot be represented by a full query config, then, the query config's raw text is set to the command.

func AddQueryConfigs

func AddQueryConfigs(d cloudhub.Dashboard) (newDash cloudhub.Dashboard)

AddQueryConfigs updates all the celsl in the dashboard to have query config objects corresponding to their influxql queries.

func Assets

func Assets(opts AssetsOpts) http.Handler

Assets creates a middleware that will serve a single page app.

func AuthorizedToken

func AuthorizedToken(auth oauth2.Authenticator, logger cloudhub.Logger, next http.Handler) http.HandlerFunc

AuthorizedToken extracts the token and validates; if valid the next handler will be run. The principal will be sent to the next handler via the request's Context. It is up to the next handler to determine if the principal has access. On failure, will return http.StatusForbidden.

func AuthorizedUser

func AuthorizedUser(
	store DataStore,
	useAuth bool,
	role string,
	logger cloudhub.Logger,
	next http.HandlerFunc,
) http.HandlerFunc

AuthorizedUser extracts the user name and provider from context. If the user and provider can be found on the context, we look up the user by their name and provider. If the user is found, we verify that the user has at at least the role supplied.

func BasicAuthAPI

func BasicAuthAPI(opts MuxOpts, router cloudhub.Router) http.Handler

BasicAuthAPI adds the Basic routes if auth is enabled. Copy session information to context when oauth is not used not using it now.

func CorrectWidthHeight

func CorrectWidthHeight(c *cloudhub.DashboardCell)

CorrectWidthHeight changes the cell to have at least the minimum width and height

func DashboardDefaults

func DashboardDefaults(d cloudhub.Dashboard) (newDash cloudhub.Dashboard)

DashboardDefaults updates the dashboard with the default values if none are specified

func Error

func Error(w http.ResponseWriter, code int, msg string, logger cloudhub.Logger)

Error writes an JSON message

func FlushingHandler

func FlushingHandler(next http.Handler) http.Handler

FlushingHandler may not actually do anything, but it was ostensibly implemented to flush response writers that can be flushed for the purposes in the comment above.

func FromSSHtoWsClient

func FromSSHtoWsClient(sh *ssh, ws *websocket.Conn, s *Service, sshReader io.Reader, exitCh chan bool)

FromSSHtoWsClient Send ssh messages to websocket client

func FromWsClientToSSH

func FromWsClientToSSH(sh *ssh, ws *websocket.Conn, s *Service, sshWriter io.WriteCloser, exitCh chan bool)

FromWsClientToSSH Send websocket client message to ssh

func HasAuthorizedToken

func HasAuthorizedToken(auth oauth2.Authenticator, r *http.Request) (oauth2.Principal, error)

HasAuthorizedToken extracts the token from a request and validates it using the authenticator. It is used by routes that need access to the token to populate links request.

func HasCorrectAxes

func HasCorrectAxes(c *cloudhub.DashboardCell) error

HasCorrectAxes verifies that only permitted axes exist within a DashboardCell

func HasCorrectColors

func HasCorrectColors(c *cloudhub.DashboardCell) error

HasCorrectColors verifies that the format of each color is correct

func HasCorrectLegend

func HasCorrectLegend(c *cloudhub.DashboardCell) error

HasCorrectLegend verifies that the format of the legend is correct

func HasCorrectQueryType

func HasCorrectQueryType(c *cloudhub.DashboardCell) error

HasCorrectQueryType ensures that all query types have a non-empty value

func LogRegistration

func LogRegistration(r *http.Request, store DataStore, logger cloudhub.Logger, orgID, action, name, message string, isSuperAdmin bool)

LogRegistration log db insert isSuperAdmin is not used currently inside the function. This is for the future.

func Logger

func Logger(logger cloudhub.Logger, next http.Handler) http.Handler

Logger is middleware that logs the request

func MoveTimeShift

func MoveTimeShift(c *cloudhub.DashboardCell)

MoveTimeShift moves TimeShift from the QueryConfig to the DashboardQuery

func NewMux

func NewMux(opts MuxOpts, service Service) http.Handler

NewMux attaches all the route handlers; handler returned servers cloudhub.

func RawStoreAccess

func RawStoreAccess(logger cloudhub.Logger, next http.HandlerFunc) http.HandlerFunc

RawStoreAccess gives a super admin access to the data store without a facade.

func Redoc

func Redoc(swagger string) http.HandlerFunc

Redoc serves the swagger JSON using the redoc package.

func RouteMatchesPrincipal

func RouteMatchesPrincipal(
	store DataStore,
	useAuth bool,
	logger cloudhub.Logger,
	next http.HandlerFunc,
) http.HandlerFunc

RouteMatchesPrincipal checks that the organization on context matches the organization in the route.

func SetQuit

func SetQuit(ch chan bool)

SetQuit other go routine quit

func Spec

func Spec() http.HandlerFunc

Spec servers the swagger.json file from bindata

func ToQueryConfig

func ToQueryConfig(query string) cloudhub.QueryConfig

ToQueryConfig converts InfluxQL into queryconfigs If influxql cannot be represented by a full query config, then, the query config's raw text is set to the query.

func ValidDashboardCellRequest

func ValidDashboardCellRequest(c *cloudhub.DashboardCell) error

ValidDashboardCellRequest verifies that the dashboard cells have a query and have the correct axes specified

func ValidDashboardRequest

func ValidDashboardRequest(d *cloudhub.Dashboard, defaultOrgID string) error

ValidDashboardRequest verifies that the dashboard cells have a query

func ValidDatabaseRequest

func ValidDatabaseRequest(d *cloudhub.Database) error

ValidDatabaseRequest checks if the database posted is valid

func ValidInfluxRequest

func ValidInfluxRequest(p cloudhub.Query) error

ValidInfluxRequest checks if queries specify a command.

func ValidRetentionPolicyRequest

func ValidRetentionPolicyRequest(rp *cloudhub.RetentionPolicy) error

ValidRetentionPolicyRequest checks if a retention policy is valid on POST

func ValidRuleRequest

func ValidRuleRequest(rule cloudhub.AlertRule) error

ValidRuleRequest checks if the requested rule change is valid

func ValidSourceRequest

func ValidSourceRequest(s *cloudhub.Source, defaultOrgID string) error

ValidSourceRequest checks if name, url, type, and role are valid

func ValidTemplateRequest

func ValidTemplateRequest(template *cloudhub.Template) error

ValidTemplateRequest checks if the request sent to the server is the correct format.

func ValidateNote

func ValidateNote(c *cloudhub.DashboardCell) error

ValidateNote sanitizes note html against XSS attacks and validates note visibility

func ValidateQueryConfig

func ValidateQueryConfig(q *cloudhub.QueryConfig) error

ValidateQueryConfig checks any query config input

Types

type ASTRequest

type ASTRequest struct {
	Body string `json:"body"`
}

ASTRequest ...

type ASTResponse

type ASTResponse struct {
	Valid bool         `json:"valid"`
	AST   *ast.Package `json:"ast"`
	Error string       `json:"error"`
}

ASTResponse ...

type AllRoutes

type AllRoutes struct {
	GetPrincipal           func(r *http.Request) oauth2.Principal // GetPrincipal is used to retrieve the principal on http request.
	AuthRoutes             []AuthRoute                            // Location of all auth routes. If no auth, this can be empty.
	BasicRoute             BasicAuthRoute                         // Location of basic auth routes. If no auth, this can be empty.
	LogoutLink             string                                 // Location of the logout route for all auth routes. If no auth, this can be empty.
	BasicLogoutLink        string                                 // Location of the logout route for basic auth routes. If no auth, this can be empty.
	StatusFeed             string                                 // External link to the JSON Feed for the News Feed on the client's Status Page
	CustomLinks            []CustomLink                           // Custom external links for client's User menu, as passed in via CLI/ENV
	AddonURLs              map[string]string                      // URLs for using in Addon Features, as passed in via CLI/ENV
	AddonTokens            map[string]string                      // Tokens to access to Addon Features API, as passed in via CLI/ENV
	Logger                 cloudhub.Logger
	PasswordPolicy         string // Password validity rules
	PasswordPolicyMessage  string // Password validity rule description
	LoginAuthType          string // Login auth type (mix, oauth, basic)
	BasicPasswordResetType string
}

AllRoutes is a handler that returns all links to resources in CloudHub server, as well as external links for the client to know about, such as for JSON feeds or custom side nav buttons. Optionally, routes for authentication can be returned.

func (*AllRoutes) ServeHTTP

func (a *AllRoutes) ServeHTTP(w http.ResponseWriter, r *http.Request)

serveHTTP returns all top level routes and external links within cloudhub

type AssetsOpts

type AssetsOpts struct {
	// Develop when true serves assets from frontend/build directory directly; false will use internal bindata.
	Develop bool
	// Logger will log the asset served
	Logger cloudhub.Logger
}

AssetsOpts configures the asset middleware

type AuthRoute

type AuthRoute struct {
	Name     string `json:"name"`     // Name uniquely identifies the provider
	Label    string `json:"label"`    // Label is a user-facing string to present in the UI
	Login    string `json:"login"`    // Login is the route to the login redirect path
	Logout   string `json:"logout"`   // Logout is the route to the logout redirect path
	Callback string `json:"callback"` // Callback is the route the provider calls to exchange the code/state
}

AuthRoute are the routes for each type of OAuth2 provider

type AuthRoutes

type AuthRoutes []AuthRoute

AuthRoutes contains all OAuth2 provider routes.

func AuthAPI

func AuthAPI(opts MuxOpts, router cloudhub.Router) (http.Handler, AuthRoutes)

AuthAPI adds the OAuth routes if auth is enabled.

func (*AuthRoutes) Lookup

func (r *AuthRoutes) Lookup(provider string) (AuthRoute, bool)

Lookup searches all the routes for a specific provider

type BasicAuthRoute

type BasicAuthRoute struct {
	Name   string `json:"name"`   // Name uniquely identifies the provider
	Login  string `json:"login"`  // Login is the route to the login redirect path
	Logout string `json:"logout"` // Logout is the route to the logout redirect path
}

BasicAuthRoute are the routes for each type of cloudhub provider

type CustomLink struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

CustomLink is a handler that returns a custom link to be used in server's routes response, within ExternalLinks

func NewCustomLinks(links map[string]string) ([]CustomLink, error)

NewCustomLinks transforms `--custom-link` CLI flag data or `CUSTOM_LINKS` ENV var data into a data structure that the CloudHub client will expect

type DashboardBuilder

type DashboardBuilder interface {
	Build(cloudhub.DashboardsStore) (*multistore.DashboardsStore, error)
}

DashboardBuilder is responsible for building dashboards

type DataStore

DataStore is collection of resources that are used by the Service Abstracting this into an interface was useful for isolated testing

type ErrorMessage

type ErrorMessage struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorMessage is the error response format for all service errors

type InfluxClient

type InfluxClient struct{}

InfluxClient returns a new client to connect to OSS

func (*InfluxClient) New

New creates a client to connect to OSS

type KapacitorBuilder

type KapacitorBuilder interface {
	Build(cloudhub.ServersStore) (*multistore.KapacitorStore, error)
}

KapacitorBuilder builds a KapacitorStore

type KapacitorStatus

type KapacitorStatus struct {
	Status string `json:"status"`
}

KapacitorStatus is the current state of a running task

func (*KapacitorStatus) Valid

func (k *KapacitorStatus) Valid() error

Valid check if the kapacitor status is enabled or disabled

type LayoutBuilder

type LayoutBuilder interface {
	Build() (*multistore.Layouts, error)
}

LayoutBuilder is responsible for building Layouts

type MountableRouter

type MountableRouter struct {
	Prefix   string
	Delegate cloudhub.Router
}

MountableRouter is an implementation of a cloudhub.Router which supports prefixing each route of a Delegated cloudhub.Router with a prefix.

func (*MountableRouter) DELETE

func (mr *MountableRouter) DELETE(path string, handler http.HandlerFunc)

DELETE defines a route responding to a DELETE request that will be prefixed with the configured route prefix

func (*MountableRouter) GET

func (mr *MountableRouter) GET(path string, handler http.HandlerFunc)

GET defines a route responding to a GET request that will be prefixed with the configured route prefix

func (*MountableRouter) Handler

func (mr *MountableRouter) Handler(method string, path string, handler http.Handler)

Handler defines a prefixed route responding to a request type specified in the method parameter

func (*MountableRouter) PATCH

func (mr *MountableRouter) PATCH(path string, handler http.HandlerFunc)

PATCH defines a route responding to a PATCH request that will be prefixed with the configured route prefix

func (*MountableRouter) POST

func (mr *MountableRouter) POST(path string, handler http.HandlerFunc)

POST defines a route responding to a POST request that will be prefixed with the configured route prefix

func (*MountableRouter) PUT

func (mr *MountableRouter) PUT(path string, handler http.HandlerFunc)

PUT defines a route responding to a PUT request that will be prefixed with the configured route prefix

func (*MountableRouter) ServeHTTP

func (mr *MountableRouter) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP is an implementation of http.Handler which delegates to the configured Delegate's implementation of http.Handler

type MultiDashboardBuilder

type MultiDashboardBuilder struct {
	Logger cloudhub.Logger
	ID     cloudhub.ID
	Path   string
}

MultiDashboardBuilder builds a DashboardsStore backed by bolt and the filesystem

func (*MultiDashboardBuilder) Build

Build will construct a Dashboard store of filesystem and db-backed dashboards

type MultiKapacitorBuilder

type MultiKapacitorBuilder struct {
	KapacitorURL      string
	KapacitorUsername string
	KapacitorPassword string

	Logger cloudhub.Logger
	ID     cloudhub.ID
	Path   string
}

MultiKapacitorBuilder implements KapacitorBuilder

func (*MultiKapacitorBuilder) Build

Build will return a multistore facade KapacitorStore over memdb and bolt

type MultiLayoutBuilder

type MultiLayoutBuilder struct {
	Logger     cloudhub.Logger
	UUID       cloudhub.ID
	CannedPath string
}

MultiLayoutBuilder implements LayoutBuilder and will return a Layouts

func (*MultiLayoutBuilder) Build

func (builder *MultiLayoutBuilder) Build() (*multistore.Layouts, error)

Build will construct a Layouts of canned personalized layouts.

type MultiOrganizationBuilder

type MultiOrganizationBuilder struct {
	Logger cloudhub.Logger
	Path   string
}

MultiOrganizationBuilder builds a OrganizationsStore backed by bolt and the filesystem

func (*MultiOrganizationBuilder) Build

Build will construct a Organization store of filesystem and db-backed dashboards

type MultiProtoboardsBuilder

type MultiProtoboardsBuilder struct {
	Logger          cloudhub.Logger
	UUID            cloudhub.ID
	ProtoboardsPath string
}

MultiProtoboardsBuilder implements LayoutBuilder and will return a Layouts

func (*MultiProtoboardsBuilder) Build

func (builder *MultiProtoboardsBuilder) Build() (*multistore.Protoboards, error)

Build will construct a Layouts of canned and db-backed personalized layouts

type MultiSourceBuilder

type MultiSourceBuilder struct {
	InfluxDBURL      string
	InfluxDBUsername string
	InfluxDBPassword string

	Logger cloudhub.Logger
	ID     cloudhub.ID
	Path   string
}

MultiSourceBuilder implements SourcesBuilder

func (*MultiSourceBuilder) Build

Build will return a MultiSourceStore

type MuxOpts

type MuxOpts struct {
	Logger                cloudhub.Logger
	Develop               bool                 // Develop loads assets from filesystem instead of bindata
	Basepath              string               // URL path prefix under which all cloudhub routes will be mounted
	UseAuth               bool                 // UseAuth turns on Github OAuth and JWT
	Auth                  oauth2.Authenticator // Auth is used to authenticate and authorize
	ProviderFuncs         []func(func(oauth2.Provider, oauth2.Mux))
	StatusFeedURL         string            // JSON Feed URL for the client Status page News Feed
	CustomLinks           []CustomLink      // Any custom external links for client's User menu
	PprofEnabled          bool              // Mount pprof routes for profiling
	DisableGZip           bool              // Optionally disable gzip.
	AddonURLs             map[string]string // URLs for using in Addon Features, as passed in via CLI/ENV
	AddonTokens           map[string]string // Tokens to access to Addon Features API, as passed in via CLI/ENV
	PasswordPolicy        string            // Password validity rules
	PasswordPolicyMessage string            // Password validity rule description
}

MuxOpts are the options for the router. Mostly related to auth.

type OrganizationBuilder

type OrganizationBuilder interface {
	Build(cloudhub.OrganizationsStore) (*multistore.OrganizationsStore, error)
}

OrganizationBuilder is responsible for building dashboards

type Params

type Params map[string]string

Params are params

type ProtoboardsBuilder

type ProtoboardsBuilder interface {
	Build() (*multistore.Protoboards, error)
}

ProtoboardsBuilder is responsible for building Protoboards

type QueriesRequest

type QueriesRequest struct {
	Queries      []QueryRequest         `json:"queries"`
	TemplateVars []cloudhub.TemplateVar `json:"tempVars,omitempty"`
}

QueriesRequest converts all queries to queryConfigs with the help of the template variables

type QueriesResponse

type QueriesResponse struct {
	Queries []QueryResponse `json:"queries"`
}

QueriesResponse is the response for a QueriesRequest

type QueryRequest

type QueryRequest struct {
	ID    string `json:"id"`
	Query string `json:"query"`
}

QueryRequest is query that will be converted to a queryConfig

type QueryResponse

type QueryResponse struct {
	Duration       int64                    `json:"durationMs"`
	ID             string                   `json:"id"`
	Query          string                   `json:"query"`
	QueryConfig    cloudhub.QueryConfig     `json:"queryConfig"`
	QueryAST       *queries.SelectStatement `json:"queryAST,omitempty"`
	QueryTemplated *string                  `json:"queryTemplated,omitempty"`
}

QueryResponse is the return result of a QueryRequest including the raw query, the templated query, the queryConfig and the queryAST

type Server

type Server struct {
	Host        string `long:"host" description:"The IP to listen on" default:"0.0.0.0" env:"HOST"`
	Port        int    `` /* 126-byte string literal not displayed */
	DisableGZip bool   `` /* 145-byte string literal not displayed */

	PprofEnabled bool `long:"pprof-enabled" description:"Enable the /debug/pprof/* HTTP routes" env:"PPROF_ENABLED"`

	Cert flags.Filename `long:"cert" description:"Path to PEM encoded public key certificate. " env:"TLS_CERTIFICATE"`
	Key  flags.Filename `long:"key" description:"Path to private key associated with given certificate. " env:"TLS_PRIVATE_KEY"`

	InfluxDBURL      string `long:"influxdb-url" description:"Location of your InfluxDB instance" env:"INFLUXDB_URL"`
	InfluxDBUsername string `long:"influxdb-username" description:"Username for your InfluxDB instance" env:"INFLUXDB_USERNAME"`
	InfluxDBPassword string `long:"influxdb-password" description:"Password for your InfluxDB instance" env:"INFLUXDB_PASSWORD"`

	KapacitorURL      string `long:"kapacitor-url" description:"Location of your Kapacitor instance" env:"KAPACITOR_URL"`
	KapacitorUsername string `long:"kapacitor-username" description:"Username of your Kapacitor instance" env:"KAPACITOR_USERNAME"`
	KapacitorPassword string `long:"kapacitor-password" description:"Password of your Kapacitor instance" env:"KAPACITOR_PASSWORD"`

	AddonURLs   map[string]string `` /* 480-byte string literal not displayed */
	AddonTokens map[string]string `` /* 505-byte string literal not displayed */

	Develop         bool          `short:"d" long:"develop" description:"Run server in develop mode."`
	BoltPath        string        `` /* 132-byte string literal not displayed */
	CannedPath      string        `` /* 158-byte string literal not displayed */
	ProtoboardsPath string        `` /* 149-byte string literal not displayed */
	ResourcesPath   string        `` /* 188-byte string literal not displayed */
	TokenSecret     string        `short:"t" long:"token-secret" description:"Secret to sign tokens" env:"TOKEN_SECRET"`
	JwksURL         string        `long:"jwks-url" description:"URL that returns OpenID Key Discovery JWKS document." env:"JWKS_URL"`
	UseIDToken      bool          `long:"use-id-token" description:"Enable id_token processing." env:"USE_ID_TOKEN"`
	LoginHint       string        `` /* 131-byte string literal not displayed */
	AuthDuration    time.Duration `` /* 179-byte string literal not displayed */

	GithubClientID     string   `short:"i" long:"github-client-id" description:"Github Client ID for OAuth 2 support" env:"GH_CLIENT_ID"`
	GithubClientSecret string   `short:"s" long:"github-client-secret" description:"Github Client Secret for OAuth 2 support" env:"GH_CLIENT_SECRET"`
	GithubOrgs         []string `` /* 163-byte string literal not displayed */

	EtcdEndpoints      []string      `short:"e" long:"etcd-endpoints" description:"List of etcd endpoints" env:"ETCD_ENDPOINTS" env-delim:","`
	EtcdUsername       string        `long:"etcd-username" description:"Username to log into etcd." env:"ETCD_USERNAME"`
	EtcdPassword       string        `long:"etcd-password" description:"Password to log into etcd." env:"ETCD_PASSWORD"`
	EtcdDialTimeout    time.Duration `` /* 170-byte string literal not displayed */
	EtcdRequestTimeout time.Duration `` /* 164-byte string literal not displayed */

	GoogleClientID     string   `long:"google-client-id" description:"Google Client ID for OAuth 2 support" env:"GOOGLE_CLIENT_ID"`
	GoogleClientSecret string   `long:"google-client-secret" description:"Google Client Secret for OAuth 2 support" env:"GOOGLE_CLIENT_SECRET"`
	GoogleDomains      []string `` /* 155-byte string literal not displayed */
	PublicURL          string   `` /* 164-byte string literal not displayed */

	HerokuClientID      string   `long:"heroku-client-id" description:"Heroku Client ID for OAuth 2 support" env:"HEROKU_CLIENT_ID"`
	HerokuSecret        string   `long:"heroku-secret" description:"Heroku Secret for OAuth 2 support" env:"HEROKU_SECRET"`
	HerokuOrganizations []string `` /* 176-byte string literal not displayed */

	GenericName         string         `long:"generic-name" description:"Generic OAuth2 name presented on the login page"  env:"GENERIC_NAME"`
	GenericClientID     string         `long:"generic-client-id" description:"Generic OAuth2 Client ID. Can be used own OAuth2 service."  env:"GENERIC_CLIENT_ID"`
	GenericClientSecret string         `long:"generic-client-secret" description:"Generic OAuth2 Client Secret" env:"GENERIC_CLIENT_SECRET"`
	GenericScopes       []string       `` /* 157-byte string literal not displayed */
	GenericDomains      []string       `` /* 150-byte string literal not displayed */
	GenericAuthURL      string         `long:"generic-auth-url" description:"OAuth 2.0 provider's authorization endpoint URL" env:"GENERIC_AUTH_URL"`
	GenericTokenURL     string         `long:"generic-token-url" description:"OAuth 2.0 provider's token endpoint URL" env:"GENERIC_TOKEN_URL"`
	GenericAPIURL       string         `long:"generic-api-url" description:"URL that returns OpenID UserInfo compatible information." env:"GENERIC_API_URL"`
	GenericAPIKey       string         `` /* 148-byte string literal not displayed */
	GenericInsecure     bool           `long:"generic-insecure" description:"Whether or not to verify auth-url's tls certificates." env:"GENERIC_INSECURE"`
	GenericRootCA       flags.Filename `long:"generic-root-ca" description:"File location of root ca cert for generic oauth tls verification." env:"GENERIC_ROOT_CA"`

	Auth0Domain        string   `long:"auth0-domain" description:"Subdomain of auth0.com used for Auth0 OAuth2 authentication" env:"AUTH0_DOMAIN"`
	Auth0ClientID      string   `long:"auth0-client-id" description:"Auth0 Client ID for OAuth2 support" env:"AUTH0_CLIENT_ID"`
	Auth0ClientSecret  string   `long:"auth0-client-secret" description:"Auth0 Client Secret for OAuth2 support" env:"AUTH0_CLIENT_SECRET"`
	Auth0Organizations []string `` /* 142-byte string literal not displayed */
	Auth0SuperAdminOrg string   `` /* 148-byte string literal not displayed */

	LoginAuthType string `long:"login-auth-type" description:"Login auth type (mix, oauth, basic)" env:"LOGIN_AUTH_TYPE" default:"oauth"`

	PasswordPolicy        string `long:"password-policy" description:"Password validity rules" env:"PASSWORD_POLICY"`
	PasswordPolicyMessage string `long:"password-policy-message" description:"Password validity rule description" env:"PASSWORD_POLICY_MESSAGE"`

	MailSubject     string `long:"mail-subject" description:"Mail subject" env:"MAIL_SUBJECT"`
	MailBodyMessage string `long:"mail-body-message" description:"Mail body message" env:"MAIL_BODY_MESSAGE"`

	ExternaExec     string `long:"external-exec" description:"External program path" env:"EXTERNAL_EXEC"`
	ExternaExecArgs string `long:"external-exec-args" description:"Arguments of external program" env:"EXTERNAL_EXEC_ARGS"`

	StatusFeedURL          string            `` /* 168-byte string literal not displayed */
	CustomLinks            map[string]string `` /* 559-byte string literal not displayed */
	TelegrafSystemInterval time.Duration     `` /* 152-byte string literal not displayed */

	ReportingDisabled bool   `` /* 159-byte string literal not displayed */
	LogLevel          string `` /* 157-byte string literal not displayed */
	Basepath          string `` /* 227-byte string literal not displayed */
	ShowVersion       bool   `short:"v" long:"version" description:"Show CloudHub version info"`
	BuildInfo         cloudhub.BuildInfo
	// contains filtered or unexported fields
}

Server for the CloudHub API

func (*Server) NewListener

func (s *Server) NewListener() (net.Listener, error)

NewListener will return an http or https listener depending useTLS().

func (*Server) Serve

func (s *Server) Serve(ctx context.Context)

Serve starts and runs the CloudHub server

func (*Server) UseAuth0

func (s *Server) UseAuth0() error

UseAuth0 validates the CLI parameters to enable Auth0 oauth support

func (*Server) UseGenericOAuth2

func (s *Server) UseGenericOAuth2() error

UseGenericOAuth2 validates the CLI parameters to enable generic oauth support

func (*Server) UseGithub

func (s *Server) UseGithub() error

UseGithub validates the CLI parameters to enable github oauth support

func (*Server) UseGoogle

func (s *Server) UseGoogle() error

UseGoogle validates the CLI parameters to enable google oauth support

func (*Server) UseHeroku

func (s *Server) UseHeroku() error

UseHeroku validates the CLI parameters to enable heroku oauth support

type Service

type Service struct {
	Store                    DataStore
	TimeSeriesClient         TimeSeriesClient
	Logger                   cloudhub.Logger
	UseAuth                  bool
	SuperAdminProviderGroups superAdminProviderGroups
	Env                      cloudhub.Environment
	Databases                cloudhub.Databases
	AddonURLs                map[string]string
	MailSubject              string
	MailBody                 string
	ExternalExec             string
	ExternalExecArgs         string
	LoginAuthType            string
	BasicPasswordResetType   string
}

Service handles REST calls to the persistence

func (*Service) Annotation

func (s *Service) Annotation(w http.ResponseWriter, r *http.Request)

Annotation returns a specified annotation id within the annotations store

func (*Service) Annotations

func (s *Service) Annotations(w http.ResponseWriter, r *http.Request)

Annotations returns all annotations within the annotations store

func (*Service) AuthConfig

func (s *Service) AuthConfig(w http.ResponseWriter, r *http.Request)

AuthConfig retrieves the auth section of the global application configuration

func (*Service) Config

func (s *Service) Config(w http.ResponseWriter, r *http.Request)

Config retrieves the global application configuration

func (*Service) DashboardCellID

func (s *Service) DashboardCellID(w http.ResponseWriter, r *http.Request)

DashboardCellID gets a specific cell from an existing dashboard

func (*Service) DashboardCells

func (s *Service) DashboardCells(w http.ResponseWriter, r *http.Request)

DashboardCells returns all cells from a dashboard within the store

func (*Service) DashboardID

func (s *Service) DashboardID(w http.ResponseWriter, r *http.Request)

DashboardID returns a single specified dashboard

func (*Service) Dashboards

func (s *Service) Dashboards(w http.ResponseWriter, r *http.Request)

Dashboards returns all dashboards within the store

func (*Service) DefaultRP

func (s *Service) DefaultRP(ctx context.Context, qc *cloudhub.QueryConfig, src *cloudhub.Source) error

DefaultRP will add the default retention policy to the QC if one has not been specified

func (*Service) DropDatabase

func (s *Service) DropDatabase(w http.ResponseWriter, r *http.Request)

DropDatabase removes a database from a data source

func (*Service) DropRetentionPolicy

func (s *Service) DropRetentionPolicy(w http.ResponseWriter, r *http.Request)

DropRetentionPolicy removes a retention policy from a database

func (*Service) Environment

func (s *Service) Environment(w http.ResponseWriter, r *http.Request)

Environment retrieves the global application configuration

func (*Service) Flux

func (s *Service) Flux(w http.ResponseWriter, r *http.Request)

Flux returns a list of links for the Flux API

func (*Service) FluxAST

func (s *Service) FluxAST(w http.ResponseWriter, r *http.Request)

FluxAST ...

func (*Service) FluxSuggestion

func (s *Service) FluxSuggestion(w http.ResponseWriter, r *http.Request)

FluxSuggestion returns the function parameters for the requested function

func (*Service) FluxSuggestions

func (s *Service) FluxSuggestions(w http.ResponseWriter, r *http.Request)

FluxSuggestions returns a list of available Flux functions for the Flux Builder

func (*Service) GetDatabases

func (s *Service) GetDatabases(w http.ResponseWriter, r *http.Request)

GetDatabases queries the list of all databases for a source

func (*Service) Influx

func (s *Service) Influx(w http.ResponseWriter, r *http.Request)

Influx proxies requests to influxdb.

func (*Service) KapacitorProxy

func (s *Service) KapacitorProxy(w http.ResponseWriter, r *http.Request)

KapacitorProxy proxies requests to services using the path query parameter.

func (*Service) KapacitorProxyPost

func (s *Service) KapacitorProxyPost(w http.ResponseWriter, r *http.Request)

KapacitorProxyPost proxies POST to service

func (*Service) KapacitorRulesDelete

func (s *Service) KapacitorRulesDelete(w http.ResponseWriter, r *http.Request)

KapacitorRulesDelete proxies DELETE to kapacitor

func (*Service) KapacitorRulesGet

func (s *Service) KapacitorRulesGet(w http.ResponseWriter, r *http.Request)

KapacitorRulesGet retrieves all rules

func (*Service) KapacitorRulesID

func (s *Service) KapacitorRulesID(w http.ResponseWriter, r *http.Request)

KapacitorRulesID retrieves specific task

func (*Service) KapacitorRulesPost

func (s *Service) KapacitorRulesPost(w http.ResponseWriter, r *http.Request)

KapacitorRulesPost proxies POST to kapacitor

func (*Service) KapacitorRulesPut

func (s *Service) KapacitorRulesPut(w http.ResponseWriter, r *http.Request)

KapacitorRulesPut proxies PATCH to kapacitor

func (*Service) KapacitorRulesStatus

func (s *Service) KapacitorRulesStatus(w http.ResponseWriter, r *http.Request)

KapacitorRulesStatus proxies PATCH to kapacitor to enable/disable tasks

func (*Service) Kapacitors

func (s *Service) Kapacitors(w http.ResponseWriter, r *http.Request)

Kapacitors retrieves all kapacitors from store.

func (*Service) KapacitorsID

func (s *Service) KapacitorsID(w http.ResponseWriter, r *http.Request)

KapacitorsID retrieves a kapacitor with ID from store.

func (*Service) Layouts

func (s *Service) Layouts(w http.ResponseWriter, r *http.Request)

Layouts retrieves all layouts from store

func (*Service) LayoutsID

func (s *Service) LayoutsID(w http.ResponseWriter, r *http.Request)

LayoutsID retrieves layout with ID from store

func (*Service) Login

func (s *Service) Login(auth oauth2.Authenticator, basePath string) http.HandlerFunc

Login provider=cloudhub

func (*Service) Logout

func (s *Service) Logout(auth oauth2.Authenticator, basePath string) http.HandlerFunc

Logout provider=cloudhub

func (*Service) Mappings

func (s *Service) Mappings(w http.ResponseWriter, r *http.Request)

Mappings retrives all mappings

func (*Service) Me

func (s *Service) Me(w http.ResponseWriter, r *http.Request)

Me does a findOrCreate based on the username in the context

func (*Service) Measurements

func (s *Service) Measurements(w http.ResponseWriter, r *http.Request)

Measurements lists measurements within a database

func (*Service) NewAnnotation

func (s *Service) NewAnnotation(w http.ResponseWriter, r *http.Request)

NewAnnotation adds the annotation from a POST body to the annotations store

func (*Service) NewBasicUser

func (s *Service) NewBasicUser(w http.ResponseWriter, r *http.Request)

NewBasicUser adds a new CloudHub basic user to store

func (*Service) NewDashboard

func (s *Service) NewDashboard(w http.ResponseWriter, r *http.Request)

NewDashboard creates and returns a new dashboard object

func (*Service) NewDashboardCell

func (s *Service) NewDashboardCell(w http.ResponseWriter, r *http.Request)

NewDashboardCell adds a cell to an existing dashboard

func (*Service) NewDatabase

func (s *Service) NewDatabase(w http.ResponseWriter, r *http.Request)

NewDatabase creates a new database within the datastore

func (*Service) NewKapacitor

func (s *Service) NewKapacitor(w http.ResponseWriter, r *http.Request)

NewKapacitor adds valid kapacitor store store.

func (*Service) NewMapping

func (s *Service) NewMapping(w http.ResponseWriter, r *http.Request)

NewMapping adds a new mapping

func (*Service) NewOrganization

func (s *Service) NewOrganization(w http.ResponseWriter, r *http.Request)

NewOrganization adds a new organization to store

func (*Service) NewRetentionPolicy

func (s *Service) NewRetentionPolicy(w http.ResponseWriter, r *http.Request)

NewRetentionPolicy creates a new retention policy for a database

func (*Service) NewService

func (s *Service) NewService(w http.ResponseWriter, r *http.Request)

NewService adds valid service store store.

func (*Service) NewSource

func (s *Service) NewSource(w http.ResponseWriter, r *http.Request)

NewSource adds a new valid source to the store

func (*Service) NewSourceRole

func (s *Service) NewSourceRole(w http.ResponseWriter, r *http.Request)

NewSourceRole adds role to source

func (*Service) NewSourceUser

func (s *Service) NewSourceUser(w http.ResponseWriter, r *http.Request)

NewSourceUser adds user to source

func (*Service) NewTemplate

func (s *Service) NewTemplate(w http.ResponseWriter, r *http.Request)

NewTemplate adds a template to an existing dashboard

func (*Service) NewUser

func (s *Service) NewUser(w http.ResponseWriter, r *http.Request)

NewUser adds a new CloudHub user to store

func (*Service) NewVsphere

func (s *Service) NewVsphere(w http.ResponseWriter, r *http.Request)

NewVsphere creates and returns a new vsphere object

func (*Service) OrganizationConfig

func (s *Service) OrganizationConfig(w http.ResponseWriter, r *http.Request)

OrganizationConfig retrieves the organization-wide config settings

func (*Service) OrganizationID

func (s *Service) OrganizationID(w http.ResponseWriter, r *http.Request)

OrganizationID retrieves a organization with ID from store

func (*Service) OrganizationLogViewerConfig

func (s *Service) OrganizationLogViewerConfig(w http.ResponseWriter, r *http.Request)

OrganizationLogViewerConfig retrieves the log viewer UI section of the organization config This uses a FindOrCreate function to ensure that any new organizations have default organization config values, without having to associate organization creation with organization config creation.

func (*Service) Organizations

func (s *Service) Organizations(w http.ResponseWriter, r *http.Request)

Organizations retrieves all organizations from store

func (*Service) Permissions

func (s *Service) Permissions(w http.ResponseWriter, r *http.Request)

Permissions returns all possible permissions for this source.

func (*Service) Protoboards

func (s *Service) Protoboards(w http.ResponseWriter, r *http.Request)

Protoboards retrieves all protoboards from store

func (*Service) ProtoboardsID

func (s *Service) ProtoboardsID(w http.ResponseWriter, r *http.Request)

ProtoboardsID retrieves protoboard with ID from store

func (*Service) Proxy

func (s *Service) Proxy(w http.ResponseWriter, r *http.Request)

Proxy proxies requests to services using the path query parameter.

func (*Service) ProxyDelete

func (s *Service) ProxyDelete(w http.ResponseWriter, r *http.Request)

ProxyDelete proxies DELETE to service

func (*Service) ProxyFlux

func (s *Service) ProxyFlux(w http.ResponseWriter, r *http.Request)

ProxyFlux proxies requests to influxdb using the path query parameter.

func (*Service) ProxyGet

func (s *Service) ProxyGet(w http.ResponseWriter, r *http.Request)

ProxyGet proxies GET to service

func (*Service) ProxyPatch

func (s *Service) ProxyPatch(w http.ResponseWriter, r *http.Request)

ProxyPatch proxies PATCH to Service

func (*Service) ProxyPost

func (s *Service) ProxyPost(w http.ResponseWriter, r *http.Request)

ProxyPost proxies POST to service

func (*Service) Queries

func (s *Service) Queries(w http.ResponseWriter, r *http.Request)

Queries analyzes InfluxQL to produce front-end friendly QueryConfig

func (*Service) RemoveAnnotation

func (s *Service) RemoveAnnotation(w http.ResponseWriter, r *http.Request)

RemoveAnnotation removes the annotation from the time series source

func (*Service) RemoveDashboard

func (s *Service) RemoveDashboard(w http.ResponseWriter, r *http.Request)

RemoveDashboard deletes a dashboard

func (*Service) RemoveDashboardCell

func (s *Service) RemoveDashboardCell(w http.ResponseWriter, r *http.Request)

RemoveDashboardCell removes a specific cell from an existing dashboard

func (*Service) RemoveKapacitor

func (s *Service) RemoveKapacitor(w http.ResponseWriter, r *http.Request)

RemoveKapacitor deletes kapacitor from store.

func (*Service) RemoveMapping

func (s *Service) RemoveMapping(w http.ResponseWriter, r *http.Request)

RemoveMapping removes a mapping

func (*Service) RemoveOrganization

func (s *Service) RemoveOrganization(w http.ResponseWriter, r *http.Request)

RemoveOrganization removes an organization in the organizations store

func (*Service) RemoveService

func (s *Service) RemoveService(w http.ResponseWriter, r *http.Request)

RemoveService deletes service from store.

func (*Service) RemoveSource

func (s *Service) RemoveSource(w http.ResponseWriter, r *http.Request)

RemoveSource deletes the source from the store

func (*Service) RemoveSourceRole

func (s *Service) RemoveSourceRole(w http.ResponseWriter, r *http.Request)

RemoveSourceRole removes role from data source.

func (*Service) RemoveSourceUser

func (s *Service) RemoveSourceUser(w http.ResponseWriter, r *http.Request)

RemoveSourceUser removes the user from the InfluxDB source

func (*Service) RemoveTemplate

func (s *Service) RemoveTemplate(w http.ResponseWriter, r *http.Request)

RemoveTemplate removes a specific template from an existing dashboard

func (*Service) RemoveUser

func (s *Service) RemoveUser(w http.ResponseWriter, r *http.Request)

RemoveUser deletes a CloudHub user from store

func (*Service) RemoveVsphere

func (s *Service) RemoveVsphere(w http.ResponseWriter, r *http.Request)

RemoveVsphere deletes a vsphere

func (*Service) ReplaceAuthConfig

func (s *Service) ReplaceAuthConfig(w http.ResponseWriter, r *http.Request)

ReplaceAuthConfig replaces the auth section of the global application configuration

func (*Service) ReplaceDashboard

func (s *Service) ReplaceDashboard(w http.ResponseWriter, r *http.Request)

ReplaceDashboard completely replaces a dashboard

func (*Service) ReplaceDashboardCell

func (s *Service) ReplaceDashboardCell(w http.ResponseWriter, r *http.Request)

ReplaceDashboardCell replaces a cell entirely within an existing dashboard

func (*Service) ReplaceOrganizationLogViewerConfig

func (s *Service) ReplaceOrganizationLogViewerConfig(w http.ResponseWriter, r *http.Request)

ReplaceOrganizationLogViewerConfig replaces the log viewer UI section of the organization config

func (*Service) ReplaceTemplate

func (s *Service) ReplaceTemplate(w http.ResponseWriter, r *http.Request)

ReplaceTemplate replaces a template entirely within an existing dashboard

func (*Service) RetentionPolicies

func (s *Service) RetentionPolicies(w http.ResponseWriter, r *http.Request)

RetentionPolicies lists retention policies within a database

func (*Service) SaltProxy

func (s *Service) SaltProxy(w http.ResponseWriter, r *http.Request)

SaltProxy proxies requests to services using the path query parameter.

func (*Service) SaltProxyPost

func (s *Service) SaltProxyPost(w http.ResponseWriter, r *http.Request)

SaltProxyPost proxies POST to service

func (*Service) ServiceID

func (s *Service) ServiceID(w http.ResponseWriter, r *http.Request)

ServiceID retrieves a service with ID from store.

func (*Service) Services

func (s *Service) Services(w http.ResponseWriter, r *http.Request)

Services retrieves all services from store.

func (*Service) SourceHealth

func (s *Service) SourceHealth(w http.ResponseWriter, r *http.Request)

SourceHealth determines if the tsdb is running

func (*Service) SourceRoleID

func (s *Service) SourceRoleID(w http.ResponseWriter, r *http.Request)

SourceRoleID retrieves a role with ID from store.

func (*Service) SourceRoles

func (s *Service) SourceRoles(w http.ResponseWriter, r *http.Request)

SourceRoles retrieves all roles from the store

func (*Service) SourceUserID

func (s *Service) SourceUserID(w http.ResponseWriter, r *http.Request)

SourceUserID retrieves a user with ID from store. In InfluxDB, a User's Name is their UID, hence the semantic below.

func (*Service) SourceUsers

func (s *Service) SourceUsers(w http.ResponseWriter, r *http.Request)

SourceUsers retrieves all users from source.

func (*Service) Sources

func (s *Service) Sources(w http.ResponseWriter, r *http.Request)

Sources returns all sources from the store.

func (*Service) SourcesID

func (s *Service) SourcesID(w http.ResponseWriter, r *http.Request)

SourcesID retrieves a source from the store

func (*Service) TemplateID

func (s *Service) TemplateID(w http.ResponseWriter, r *http.Request)

TemplateID retrieves a specific template from a dashboard

func (*Service) Templates

func (s *Service) Templates(w http.ResponseWriter, r *http.Request)

Templates returns all templates from a dashboard within the store

func (*Service) TimeSeries

func (s *Service) TimeSeries(src cloudhub.Source) (cloudhub.TimeSeries, error)

TimeSeries returns a new client connected to a time series database

func (*Service) UpdateAnnotation

func (s *Service) UpdateAnnotation(w http.ResponseWriter, r *http.Request)

UpdateAnnotation overwrite an existing annotation

func (*Service) UpdateDashboard

func (s *Service) UpdateDashboard(w http.ResponseWriter, r *http.Request)

UpdateDashboard completely updates either the dashboard name or the cells

func (*Service) UpdateKapacitor

func (s *Service) UpdateKapacitor(w http.ResponseWriter, r *http.Request)

UpdateKapacitor incrementally updates a kapacitor definition in the store

func (*Service) UpdateMapping

func (s *Service) UpdateMapping(w http.ResponseWriter, r *http.Request)

UpdateMapping updates a mapping

func (*Service) UpdateMe

func (s *Service) UpdateMe(auth oauth2.Authenticator) func(http.ResponseWriter, *http.Request)

UpdateMe changes the user's current organization on the JWT and responds with the same semantics as Me

func (*Service) UpdateOrganization

func (s *Service) UpdateOrganization(w http.ResponseWriter, r *http.Request)

UpdateOrganization updates an organization in the organizations store

func (*Service) UpdateRetentionPolicy

func (s *Service) UpdateRetentionPolicy(w http.ResponseWriter, r *http.Request)

UpdateRetentionPolicy modifies an existing retention policy for a database

func (*Service) UpdateService

func (s *Service) UpdateService(w http.ResponseWriter, r *http.Request)

UpdateService incrementally updates a service definition in the store

func (*Service) UpdateSource

func (s *Service) UpdateSource(w http.ResponseWriter, r *http.Request)

UpdateSource handles incremental updates of a data source

func (*Service) UpdateSourceRole

func (s *Service) UpdateSourceRole(w http.ResponseWriter, r *http.Request)

UpdateSourceRole changes the permissions or users of a role

func (*Service) UpdateSourceUser

func (s *Service) UpdateSourceUser(w http.ResponseWriter, r *http.Request)

UpdateSourceUser changes the password or permissions of a source user

func (*Service) UpdateUser

func (s *Service) UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser updates a CloudHub user in store

func (*Service) UpdateVsphere

func (s *Service) UpdateVsphere(w http.ResponseWriter, r *http.Request)

UpdateVsphere updates a vsphere

func (*Service) UserID

func (s *Service) UserID(w http.ResponseWriter, r *http.Request)

UserID retrieves a CloudHub user with ID from store

func (*Service) UserPassword

func (s *Service) UserPassword(w http.ResponseWriter, r *http.Request)

UserPassword User password change

func (*Service) UserPwdAdminReset

func (s *Service) UserPwdAdminReset(w http.ResponseWriter, r *http.Request)

UserPwdAdminReset User password admin reset

func (*Service) UserPwdReset

func (s *Service) UserPwdReset(w http.ResponseWriter, r *http.Request)

UserPwdReset User password reset

func (*Service) Users

func (s *Service) Users(w http.ResponseWriter, r *http.Request)

Users retrieves all CloudHub users from store

func (*Service) ValidateTextTemplate

func (s *Service) ValidateTextTemplate(w http.ResponseWriter, r *http.Request)

ValidateTextTemplate will validate the template string

func (*Service) VsphereID

func (s *Service) VsphereID(w http.ResponseWriter, r *http.Request)

VsphereID returns a single specified vsphere

func (*Service) Vspheres

func (s *Service) Vspheres(w http.ResponseWriter, r *http.Request)

Vspheres returns all vspheres within the store

func (*Service) WebTerminalHandler

func (s *Service) WebTerminalHandler(w http.ResponseWriter, r *http.Request)

WebTerminalHandler connects websocket and remote ssh

func (*Service) Write

func (s *Service) Write(w http.ResponseWriter, r *http.Request)

type SourcesBuilder

type SourcesBuilder interface {
	Build(cloudhub.SourcesStore) (*multistore.SourcesStore, error)
}

SourcesBuilder builds a MultiSourceStore

type Store

type Store struct {
	SourcesStore            cloudhub.SourcesStore
	ServersStore            cloudhub.ServersStore
	LayoutsStore            cloudhub.LayoutsStore
	ProtoboardsStore        cloudhub.ProtoboardsStore
	UsersStore              cloudhub.UsersStore
	DashboardsStore         cloudhub.DashboardsStore
	MappingsStore           cloudhub.MappingsStore
	OrganizationsStore      cloudhub.OrganizationsStore
	ConfigStore             cloudhub.ConfigStore
	OrganizationConfigStore cloudhub.OrganizationConfigStore
	VspheresStore           cloudhub.VspheresStore
}

Store implements the DataStore interface

func (*Store) Config

func (s *Store) Config(ctx context.Context) cloudhub.ConfigStore

Config returns the underlying ConfigStore.

func (*Store) Dashboards

func (s *Store) Dashboards(ctx context.Context) cloudhub.DashboardsStore

Dashboards returns a noop.DashboardsStore if the context has no organization specified and an organization.DashboardsStore otherwise.

func (*Store) Layouts

func (s *Store) Layouts(ctx context.Context) cloudhub.LayoutsStore

Layouts returns all layouts in the underlying layouts store.

func (*Store) Mappings

func (s *Store) Mappings(ctx context.Context) cloudhub.MappingsStore

Mappings returns the underlying MappingsStore.

func (*Store) OrganizationConfig

func (s *Store) OrganizationConfig(ctx context.Context) cloudhub.OrganizationConfigStore

OrganizationConfig returns a noop.OrganizationConfigStore if the context has no organization specified and an organization.OrganizationConfigStore otherwise.

func (*Store) Organizations

func (s *Store) Organizations(ctx context.Context) cloudhub.OrganizationsStore

Organizations returns the underlying OrganizationsStore.

func (*Store) Protoboards

func (s *Store) Protoboards(ctx context.Context) cloudhub.ProtoboardsStore

Protoboards returns all protoboards in the underlying protoboards store.

func (*Store) Servers

func (s *Store) Servers(ctx context.Context) cloudhub.ServersStore

Servers returns a noop.ServersStore if the context has no organization specified and an organization.ServersStore otherwise.

func (*Store) Sources

func (s *Store) Sources(ctx context.Context) cloudhub.SourcesStore

Sources returns a noop.SourcesStore if the context has no organization specified and an organization.SourcesStore otherwise.

func (*Store) Users

func (s *Store) Users(ctx context.Context) cloudhub.UsersStore

Users returns a cloudhub.UsersStore. If the context is a server context, then the underlying cloudhub.UsersStore is returned. If there is an organization specified on context, then an organizations.UsersStore is returned. If niether are specified, a noop.UsersStore is returned.

func (*Store) Vspheres

func (s *Store) Vspheres(ctx context.Context) cloudhub.VspheresStore

Vspheres returns a noop.VspheresStore if the context has no organization specified and an organization.VspheresStore otherwise.

type SuggestionResponse

type SuggestionResponse struct {
	Name   string `json:"name"`
	Params Params `json:"params"`
}

SuggestionResponse provides the parameters available for a given Flux function

type SuggestionsResponse

type SuggestionsResponse struct {
	Functions []SuggestionResponse `json:"funcs"`
}

SuggestionsResponse provides a list of available Flux functions

type TimeSeriesClient

type TimeSeriesClient interface {
	New(cloudhub.Source, cloudhub.Logger) (cloudhub.TimeSeries, error)
}

TimeSeriesClient returns the correct client for a time series database. todo(glinton): should this be always reconnecting?

type URLPrefixer

type URLPrefixer struct {
	Prefix string          // the prefix to be appended after any detected Attrs
	Next   http.Handler    // the http.Handler which will generate the content to be modified by this handler
	Attrs  [][]byte        // a list of attrs that should have their URLs prefixed. For example `src="` or `href="` would be valid
	Logger cloudhub.Logger // The logger where prefixing errors will be dispatched to
}

URLPrefixer is a wrapper for an http.Handler that will prefix all occurrences of a relative URL with the configured Prefix

func NewDefaultURLPrefixer

func NewDefaultURLPrefixer(prefix string, next http.Handler, lg cloudhub.Logger) *URLPrefixer

NewDefaultURLPrefixer returns a URLPrefixer that will prefix any src and href attributes found in HTML as well as any url() directives found in CSS with the provided prefix. Additionally, it will prefix any `data-basepath` attributes as well for informing front end logic about any prefixes. `next` is the next http.Handler that will have its output prefixed

func (*URLPrefixer) ServeHTTP

func (up *URLPrefixer) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP implements an http.Handler that prefixes relative URLs from the Next handler with the configured prefix. It does this by examining the stream through the ResponseWriter, and appending the Prefix after any of the Attrs detected in the stream.

type ValidTextTemplateRequest

type ValidTextTemplateRequest struct {
	Template string `json:"template"`
}

ValidTextTemplateRequest is the request json for validation

type WindowResize

type WindowResize struct {
	Cols int `json:"cols"`
	Rows int `json:"rows"`
}

WindowResize ssh terminal

Jump to

Keyboard shortcuts

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