Documentation ¶
Index ¶
- Constants
- Variables
- func Asset(string) ([]byte, error)
- func CheckError(resp *http.Response) (err error)
- func CheckErrorStatus(code int, res *http.Response) error
- func DebugFlush(ctx context.Context, next http.Handler, f Flusher) http.HandlerFunc
- func FormatDuration(d time.Duration) string
- func GetQueryResponse(qr *QueryRequest, addr, org, token string, headers ...string) (*http.Response, error)
- func GetQueryResponseBody(res *http.Response) ([]byte, error)
- func GetToken(r *http.Request) (string, error)
- func HealthHandler(w http.ResponseWriter, r *http.Request)
- func InactiveUserError(ctx context.Context, h platform.HTTPErrorHandler, w http.ResponseWriter)
- func ListenAndServe(log *zap.Logger, addr string, handler http.Handler) error
- func LoggingMW(log *zap.Logger) kithttp.Middleware
- func NewBucketResponse(b *influxdb.Bucket, labels []*influxdb.Label) *bucketResponse
- func NewClient(scheme string, insecure bool) *http.Client
- func NewHTTPClient(addr, token string, insecureSkipVerify bool, opts ...httpc.ClientOptFn) (*httpc.Client, error)
- func NewRouter(h platform.HTTPErrorHandler) *httprouter.Router
- func NewURL(addr, path string) (*url.URL, error)
- func ParseDuration(s string) (time.Duration, error)
- func ProbeAuthScheme(r *http.Request) (string, error)
- func QueryHealthCheck(url string, insecureSkipVerify bool) check.Response
- func ReadyHandler() http.Handler
- func Redoc(swagger string) http.HandlerFunc
- func SetCookieSession(key string, r *http.Request)
- func SetToken(token string, req *http.Request)
- func SimpleQuery(addr, flux, org, token string, headers ...string) ([]byte, error)
- func UnauthorizedError(ctx context.Context, h platform.HTTPErrorHandler, w http.ResponseWriter)
- type APIBackend
- type APIHandler
- type APIHandlerOptFn
- type AssetHandler
- type AuthenticationHandler
- type AuthorizationBackend
- type AuthorizationHandler
- type AuthorizationService
- func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *platform.Authorization) error
- func (s *AuthorizationService) DeleteAuthorization(ctx context.Context, id platform.ID) error
- func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error)
- func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, token string) (*platform.Authorization, error)
- func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, ...) ([]*platform.Authorization, int, error)
- func (s *AuthorizationService) UpdateAuthorization(ctx context.Context, id platform.ID, upd *platform.AuthorizationUpdate) (*platform.Authorization, error)
- type AuthzError
- type BackupBackend
- type BackupHandler
- type BackupService
- type BucketBackend
- type BucketHandler
- type BucketService
- func (s *BucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
- func (s *BucketService) DeleteBucket(ctx context.Context, id influxdb.ID) error
- func (s *BucketService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
- func (s *BucketService) FindBucketByID(ctx context.Context, id influxdb.ID) (*influxdb.Bucket, error)
- func (s *BucketService) FindBucketByName(ctx context.Context, orgID influxdb.ID, name string) (*influxdb.Bucket, error)
- func (s *BucketService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
- func (s *BucketService) UpdateBucket(ctx context.Context, id influxdb.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
- type Check
- type CheckBackend
- type CheckBuilderConfig
- type CheckHandler
- type CheckLinks
- type CheckQuery
- type CheckService
- func (s *CheckService) CreateCheck(ctx context.Context, c *Check) (*Check, error)
- func (s *CheckService) DeleteCheck(ctx context.Context, id influxdb.ID) error
- func (s *CheckService) FindCheck(ctx context.Context, filter influxdb.CheckFilter) (*Check, error)
- func (s *CheckService) FindCheckByID(ctx context.Context, id influxdb.ID) (*Check, error)
- func (s *CheckService) FindChecks(ctx context.Context, filter influxdb.CheckFilter, opt ...influxdb.FindOptions) ([]*Check, int, error)
- func (s *CheckService) PatchCheck(ctx context.Context, id influxdb.ID, u influxdb.CheckUpdate) (*Check, error)
- func (s *CheckService) UpdateCheck(ctx context.Context, id influxdb.ID, u *Check) (*Check, error)
- type CheckThreshold
- type Checks
- type ChronografHandler
- type DashboardBackend
- type DashboardHandler
- type DashboardService
- func (s *DashboardService) AddDashboardCell(ctx context.Context, id influxdb.ID, c *influxdb.Cell, ...) error
- func (s *DashboardService) CreateDashboard(ctx context.Context, d *influxdb.Dashboard) error
- func (s *DashboardService) DeleteDashboard(ctx context.Context, id influxdb.ID) error
- func (s *DashboardService) FindDashboardByID(ctx context.Context, id influxdb.ID) (*influxdb.Dashboard, error)
- func (s *DashboardService) FindDashboards(ctx context.Context, filter influxdb.DashboardFilter, ...) ([]*influxdb.Dashboard, int, error)
- func (s *DashboardService) GetDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID) (*influxdb.View, error)
- func (s *DashboardService) RemoveDashboardCell(ctx context.Context, dashboardID, cellID influxdb.ID) error
- func (s *DashboardService) ReplaceDashboardCells(ctx context.Context, id influxdb.ID, cs []*influxdb.Cell) error
- func (s *DashboardService) UpdateDashboard(ctx context.Context, id influxdb.ID, upd influxdb.DashboardUpdate) (*influxdb.Dashboard, error)
- func (s *DashboardService) UpdateDashboardCell(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.CellUpdate) (*influxdb.Cell, error)
- func (s *DashboardService) UpdateDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.ViewUpdate) (*influxdb.View, error)
- type DeleteBackend
- type DeleteHandler
- type DeleteRequest
- type DeleteService
- type DocumentBackend
- type DocumentHandler
- type DocumentService
- type Flusher
- type FluxBackend
- type FluxHandler
- type FluxQueryService
- type FluxService
- type HTTPDialect
- type Handler
- type HandlerOptFn
- type LabelBackend
- type LabelHandler
- type LabelService
- func (s *LabelService) CreateLabel(ctx context.Context, l *influxdb.Label) error
- func (s *LabelService) CreateLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error
- func (s *LabelService) DeleteLabel(ctx context.Context, id influxdb.ID) error
- func (s *LabelService) DeleteLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error
- func (s *LabelService) FindLabelByID(ctx context.Context, id influxdb.ID) (*influxdb.Label, error)
- func (s *LabelService) FindLabels(ctx context.Context, filter influxdb.LabelFilter, opt ...influxdb.FindOptions) ([]*influxdb.Label, error)
- func (s *LabelService) FindResourceLabels(ctx context.Context, filter influxdb.LabelMappingFilter) ([]*influxdb.Label, error)
- func (s *LabelService) UpdateLabel(ctx context.Context, id influxdb.ID, upd influxdb.LabelUpdate) (*influxdb.Label, error)
- type MemberBackend
- type NotificationEndpointBackend
- type NotificationEndpointHandler
- type NotificationEndpointService
- func (s *NotificationEndpointService) CreateNotificationEndpoint(ctx context.Context, ne influxdb.NotificationEndpoint, userID influxdb.ID) error
- func (s *NotificationEndpointService) DeleteNotificationEndpoint(ctx context.Context, id influxdb.ID) ([]influxdb.SecretField, influxdb.ID, error)
- func (s *NotificationEndpointService) FindNotificationEndpointByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationEndpoint, error)
- func (s *NotificationEndpointService) FindNotificationEndpoints(ctx context.Context, filter influxdb.NotificationEndpointFilter, ...) ([]influxdb.NotificationEndpoint, int, error)
- func (s *NotificationEndpointService) PatchNotificationEndpoint(ctx context.Context, id influxdb.ID, upd influxdb.NotificationEndpointUpdate) (influxdb.NotificationEndpoint, error)
- func (s *NotificationEndpointService) UpdateNotificationEndpoint(ctx context.Context, id influxdb.ID, ne influxdb.NotificationEndpoint, ...) (influxdb.NotificationEndpoint, error)
- type NotificationRuleBackend
- type NotificationRuleHandler
- type NotificationRuleService
- func (s *NotificationRuleService) CreateNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error
- func (s *NotificationRuleService) DeleteNotificationRule(ctx context.Context, id influxdb.ID) error
- func (s *NotificationRuleService) FindNotificationRuleByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationRule, error)
- func (s *NotificationRuleService) FindNotificationRules(ctx context.Context, filter influxdb.NotificationRuleFilter, ...) ([]influxdb.NotificationRule, int, error)
- func (s *NotificationRuleService) PatchNotificationRule(ctx context.Context, id influxdb.ID, upd influxdb.NotificationRuleUpdate) (influxdb.NotificationRule, error)
- func (s *NotificationRuleService) UpdateNotificationRule(ctx context.Context, id influxdb.ID, nr influxdb.NotificationRuleCreate, ...) (influxdb.NotificationRule, error)
- type OrgBackend
- type OrgHandler
- type OrganizationService
- func (s *OrganizationService) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
- func (s *OrganizationService) DeleteOrganization(ctx context.Context, id influxdb.ID) error
- func (s *OrganizationService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
- func (s *OrganizationService) FindOrganizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Organization, error)
- func (s *OrganizationService) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, ...) ([]*influxdb.Organization, int, error)
- func (s *OrganizationService) UpdateOrganization(ctx context.Context, id influxdb.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
- type PasswordService
- func (s *PasswordService) CompareAndSetPassword(ctx context.Context, userID influxdb.ID, old string, new string) error
- func (s *PasswordService) ComparePassword(ctx context.Context, userID influxdb.ID, password string) error
- func (s *PasswordService) SetPassword(ctx context.Context, userID influxdb.ID, password string) error
- type PlatformHandler
- type QueryAnalysis
- type QueryDialect
- type QueryRequest
- type ScraperBackend
- type ScraperHandler
- type ScraperService
- func (s *ScraperService) AddTarget(ctx context.Context, target *influxdb.ScraperTarget, userID influxdb.ID) error
- func (s *ScraperService) GetTargetByID(ctx context.Context, id influxdb.ID) (*influxdb.ScraperTarget, error)
- func (s *ScraperService) ListTargets(ctx context.Context, filter influxdb.ScraperTargetFilter) ([]influxdb.ScraperTarget, error)
- func (s *ScraperService) RemoveTarget(ctx context.Context, id influxdb.ID) error
- func (s *ScraperService) UpdateTarget(ctx context.Context, update *influxdb.ScraperTarget, userID influxdb.ID) (*influxdb.ScraperTarget, error)
- type SecretService
- func (s *SecretService) DeleteSecret(ctx context.Context, orgID influxdb.ID, ks ...string) error
- func (s *SecretService) GetSecretKeys(ctx context.Context, orgID influxdb.ID) ([]string, error)
- func (s *SecretService) LoadSecret(ctx context.Context, orgID influxdb.ID, k string) (string, error)
- func (s *SecretService) PatchSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error
- func (s *SecretService) PutSecret(ctx context.Context, orgID influxdb.ID, k string, v string) error
- func (s *SecretService) PutSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error
- type Server
- type Service
- type SessionBackend
- type SessionHandler
- type SetupBackend
- type SetupHandler
- type SetupService
- func (s *SetupService) IsOnboarding(ctx context.Context) (bool, error)
- func (s *SetupService) OnboardInitialUser(ctx context.Context, or *platform.OnboardingRequest) (*platform.OnboardingResults, error)
- func (s *SetupService) OnboardUser(ctx context.Context, or *platform.OnboardingRequest) (*platform.OnboardingResults, error)
- type SourceBackend
- type SourceHandler
- type SourceProxyQueryService
- type SourceService
- func (s *SourceService) CreateSource(ctx context.Context, b *platform.Source) error
- func (s *SourceService) DeleteSource(ctx context.Context, id platform.ID) error
- func (s *SourceService) FindSourceByID(ctx context.Context, id platform.ID) (*platform.Source, error)
- func (s *SourceService) FindSources(ctx context.Context, opt platform.FindOptions) ([]*platform.Source, int, error)
- func (s *SourceService) UpdateSource(ctx context.Context, id platform.ID, upd platform.SourceUpdate) (*platform.Source, error)
- type SpanTransport
- type Task
- type TaskBackend
- type TaskHandler
- type TaskService
- func (t TaskService) CancelRun(ctx context.Context, taskID, runID influxdb.ID) error
- func (t TaskService) CreateTask(ctx context.Context, tc influxdb.TaskCreate) (*Task, error)
- func (t TaskService) DeleteTask(ctx context.Context, id influxdb.ID) error
- func (t TaskService) FindLogs(ctx context.Context, filter influxdb.LogFilter) ([]*influxdb.Log, int, error)
- func (t TaskService) FindRunByID(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
- func (t TaskService) FindRuns(ctx context.Context, filter influxdb.RunFilter) ([]*influxdb.Run, int, error)
- func (t TaskService) FindTaskByID(ctx context.Context, id influxdb.ID) (*Task, error)
- func (t TaskService) FindTasks(ctx context.Context, filter influxdb.TaskFilter) ([]Task, int, error)
- func (t TaskService) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error)
- func (t TaskService) RetryRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
- func (t TaskService) UpdateTask(ctx context.Context, id influxdb.ID, upd influxdb.TaskUpdate) (*Task, error)
- type TelegrafBackend
- type TelegrafHandler
- type TelegrafService
- func (s *TelegrafService) CreateTelegrafConfig(ctx context.Context, tc *platform.TelegrafConfig, userID platform.ID) error
- func (s *TelegrafService) DeleteTelegrafConfig(ctx context.Context, id platform.ID) error
- func (s *TelegrafService) FindTelegrafConfigByID(ctx context.Context, id platform.ID) (*platform.TelegrafConfig, error)
- func (s *TelegrafService) FindTelegrafConfigs(ctx context.Context, f platform.TelegrafConfigFilter, ...) ([]*platform.TelegrafConfig, int, error)
- func (s *TelegrafService) UpdateTelegrafConfig(ctx context.Context, id platform.ID, tc *platform.TelegrafConfig, ...) (*platform.TelegrafConfig, error)
- type UsageHandler
- type UserBackend
- type UserHandler
- type UserResourceMappingService
- func (s *UserResourceMappingService) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
- func (s *UserResourceMappingService) DeleteUserResourceMapping(ctx context.Context, resourceID influxdb.ID, userID influxdb.ID) error
- func (s *UserResourceMappingService) FindUserResourceMappings(ctx context.Context, f influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, int, error)
- type UserResponse
- type UserService
- func (s *UserService) CreateUser(ctx context.Context, u *influxdb.User) error
- func (s *UserService) DeleteUser(ctx context.Context, id influxdb.ID) error
- func (s *UserService) FindMe(ctx context.Context, id influxdb.ID) (*influxdb.User, error)
- func (s *UserService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
- func (s *UserService) FindUserByID(ctx context.Context, id influxdb.ID) (*influxdb.User, error)
- func (s *UserService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
- func (s *UserService) UpdateUser(ctx context.Context, id influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
- type VariableBackend
- type VariableHandler
- type VariableService
- func (s *VariableService) CreateVariable(ctx context.Context, m *influxdb.Variable) error
- func (s *VariableService) DeleteVariable(ctx context.Context, id influxdb.ID) error
- func (s *VariableService) FindVariableByID(ctx context.Context, id influxdb.ID) (*influxdb.Variable, error)
- func (s *VariableService) FindVariables(ctx context.Context, filter influxdb.VariableFilter, ...) ([]*influxdb.Variable, error)
- func (s *VariableService) ReplaceVariable(ctx context.Context, variable *influxdb.Variable) error
- func (s *VariableService) UpdateVariable(ctx context.Context, id influxdb.ID, update *influxdb.VariableUpdate) (*influxdb.Variable, error)
- type WriteBackend
- type WriteHandler
- type WriteHandlerOption
- type WriteService
Constants ¶
const ( // Dir is prefix of the assets in the bindata Dir = "../../ui/build" // Default is the default item to load if 404 Default = "../../ui/build/index.html" // DebugDefault is the default item to load if 404 DebugDefault = "index.html" // DefaultContentType is the content-type to return for the Default file DefaultContentType = "text/html; charset=utf-8" )
const ( // MetricsPath exposes the prometheus metrics over /metrics. MetricsPath = "/metrics" // ReadyPath exposes the readiness of the service over /ready. ReadyPath = "/ready" // HealthPath exposes the health of the service over /health. HealthPath = "/health" // DebugPath exposes /debug/pprof for go debugging. DebugPath = "/debug" )
const ( // OrgID is the http query parameter to specify an organization by ID. OrgID = "orgID" // Org is the http query parameter that take either the ID or Name interchangeably Org = "org" // BucketID is the http query parameter to specify an bucket by ID. BucketID = "bucketID" // Bucket is the http query parameter take either the ID or Name interchangably Bucket = "bucket" )
const DefaultConfigsFile = "configs"
DefaultConfigsFile stores cli credentials and hosts.
const DefaultShutdownTimeout = 20 * time.Second
DefaultShutdownTimeout is the default timeout for shutting down the http server.
const DefaultTokenFile = "credentials"
DefaultTokenFile is deprecated, and will be only used for migration.
Variables ¶
var ( ErrAuthHeaderMissing = errors.New("authorization Header is missing") ErrAuthBadScheme = errors.New("authorization Header Scheme is invalid") )
errors
var ErrInvalidDuration = &influxdb.Error{
Code: influxdb.EInvalid,
Msg: "invalid duration",
}
ErrInvalidDuration is returned when parsing a malformatted duration.
var ( // ErrMaxBatchSizeExceeded is returned when a points batch exceeds // the defined upper limit in bytes. This pertains to the size of the // batch after inflation from any compression (i.e. ungzipped). ErrMaxBatchSizeExceeded = errors.New("points batch is too large") )
Functions ¶
func CheckError ¶
CheckError reads the http.Response and returns an error if one exists. It will automatically recognize the errors returned by Influx services and decode the error into an internal error type. If the error cannot be determined in that way, it will create a generic error message.
If there is no error, then this returns nil.
func CheckErrorStatus ¶
CheckErrorStatus for status and any error in the response.
func DebugFlush ¶
DebugFlush clears all services for testing.
func FormatDuration ¶
FormatDuration formats a duration to a string.
func GetQueryResponse ¶
func GetQueryResponse(qr *QueryRequest, addr, org, token string, headers ...string) (*http.Response, error)
GetQueryResponse runs a flux query with common parameters and returns the response from the query service.
func GetQueryResponseBody ¶
GetQueryResponseBody reads the body of a response from some query service. It also checks for errors in the response.
func HealthHandler ¶
func HealthHandler(w http.ResponseWriter, r *http.Request)
HealthHandler returns the status of the process.
func InactiveUserError ¶
func InactiveUserError(ctx context.Context, h platform.HTTPErrorHandler, w http.ResponseWriter)
InactiveUserError encode a error message and status code for inactive users.
func ListenAndServe ¶
ListenAndServe is a convenience method for opening a listener using the address and then serving the handler on that address. This method sets up the typical signal handlers.
func LoggingMW ¶
func LoggingMW(log *zap.Logger) kithttp.Middleware
LoggingMW middleware for logging inflight http requests.
func NewBucketResponse ¶
func NewBucketResponse(b *influxdb.Bucket, labels []*influxdb.Label) *bucketResponse
func NewHTTPClient ¶
func NewHTTPClient(addr, token string, insecureSkipVerify bool, opts ...httpc.ClientOptFn) (*httpc.Client, error)
NewHTTPClient creates a new httpc.Client type. This call sets all the options that are important to the http pkg on the httpc client. The default status fn and so forth will all be set for the caller. In addition, some options can be specified. Those will be added to the defaults.
func NewRouter ¶
func NewRouter(h platform.HTTPErrorHandler) *httprouter.Router
NewRouter returns a new router with a 404 handler, a 405 handler, and a panic handler.
func ParseDuration ¶
ParseDuration parses a time duration from a string. This is needed instead of time.ParseDuration because this will support the full syntax that InfluxQL supports for specifying durations including weeks and days.
func ProbeAuthScheme ¶
ProbeAuthScheme probes the http request for the requests for token or cookie session.
func ReadyHandler ¶
ReadyHandler is a default readiness handler. The default behaviour is always ready.
func Redoc ¶
func Redoc(swagger string) http.HandlerFunc
Redoc servers the swagger JSON using the redoc package.
func SetCookieSession ¶
SetCookieSession adds a cookie for the session to an http request
func SimpleQuery ¶
SimpleQuery runs a flux query with common parameters and returns CSV results.
func UnauthorizedError ¶
func UnauthorizedError(ctx context.Context, h platform.HTTPErrorHandler, w http.ResponseWriter)
UnauthorizedError encodes a error message and status code for unauthorized access.
Types ¶
type APIBackend ¶
type APIBackend struct { AssetsPath string // if empty then assets are served from bindata. Logger *zap.Logger influxdb.HTTPErrorHandler SessionRenewDisabled bool // MaxBatchSizeBytes is the maximum number of bytes which can be written // in a single points batch MaxBatchSizeBytes int64 // WriteParserMaxBytes specifies the maximum number of bytes that may be allocated when processing a single // write request. A value of zero specifies there is no limit. WriteParserMaxBytes int // WriteParserMaxLines specifies the maximum number of lines that may be parsed when processing a single // write request. A value of zero specifies there is no limit. WriteParserMaxLines int // WriteParserMaxValues specifies the maximum number of values that may be parsed when processing a single // write request. A value of zero specifies there is no limit. WriteParserMaxValues int NewBucketService func(*influxdb.Source) (influxdb.BucketService, error) NewQueryService func(*influxdb.Source) (query.ProxyQueryService, error) WriteEventRecorder metric.EventRecorder QueryEventRecorder metric.EventRecorder PointsWriter storage.PointsWriter DeleteService influxdb.DeleteService BackupService influxdb.BackupService KVBackupService influxdb.KVBackupService AuthorizationService influxdb.AuthorizationService BucketService influxdb.BucketService SessionService influxdb.SessionService UserService influxdb.UserService OrganizationService influxdb.OrganizationService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService DashboardService influxdb.DashboardService DashboardOperationLogService influxdb.DashboardOperationLogService BucketOperationLogService influxdb.BucketOperationLogService UserOperationLogService influxdb.UserOperationLogService OrganizationOperationLogService influxdb.OrganizationOperationLogService SourceService influxdb.SourceService VariableService influxdb.VariableService PasswordsService influxdb.PasswordsService InfluxQLService query.ProxyQueryService FluxService query.ProxyQueryService TaskService influxdb.TaskService CheckService influxdb.CheckService TelegrafService influxdb.TelegrafConfigStore ScraperTargetStoreService influxdb.ScraperTargetStoreService SecretService influxdb.SecretService LookupService influxdb.LookupService ChronografService *server.Service OrgLookupService authorizer.OrganizationService DocumentService influxdb.DocumentService NotificationRuleStore influxdb.NotificationRuleStore NotificationEndpointService influxdb.NotificationEndpointService }
APIBackend is all services and associated parameters required to construct an APIHandler.
func (*APIBackend) PrometheusCollectors ¶
func (b *APIBackend) PrometheusCollectors() []prometheus.Collector
PrometheusCollectors exposes the prometheus collectors associated with an APIBackend.
type APIHandler ¶
APIHandler is a collection of all the service handlers.
func NewAPIHandler ¶
func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler
NewAPIHandler constructs all api handlers beneath it and returns an APIHandler
type APIHandlerOptFn ¶
APIHandlerOptFn is a functional input param to set parameters on the APIHandler.
func WithResourceHandler ¶
func WithResourceHandler(resHandler kithttp.ResourceHandler) APIHandlerOptFn
WithResourceHandler registers a resource handler on the APIHandler.
type AssetHandler ¶
type AssetHandler struct {
Path string
}
AssetHandler is an http handler for serving chronograf assets.
func NewAssetHandler ¶
func NewAssetHandler() *AssetHandler
NewAssetHandler is the constructor an asset handler.
func (*AssetHandler) ServeHTTP ¶
func (h *AssetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http handler interface for serving assets.
type AuthenticationHandler ¶
type AuthenticationHandler struct { platform.HTTPErrorHandler AuthorizationService platform.AuthorizationService SessionService platform.SessionService UserService platform.UserService TokenParser *jsonweb.TokenParser SessionRenewDisabled bool Handler http.Handler // contains filtered or unexported fields }
AuthenticationHandler is a middleware for authenticating incoming requests.
func NewAuthenticationHandler ¶
func NewAuthenticationHandler(log *zap.Logger, h platform.HTTPErrorHandler) *AuthenticationHandler
NewAuthenticationHandler creates an authentication handler.
func (*AuthenticationHandler) RegisterNoAuthRoute ¶
func (h *AuthenticationHandler) RegisterNoAuthRoute(method, path string)
RegisterNoAuthRoute excludes routes from needing authentication.
func (*AuthenticationHandler) ServeHTTP ¶
func (h *AuthenticationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP extracts the session or token from the http request and places the resulting authorizer on the request context.
type AuthorizationBackend ¶
type AuthorizationBackend struct { platform.HTTPErrorHandler AuthorizationService platform.AuthorizationService OrganizationService platform.OrganizationService UserService platform.UserService LookupService platform.LookupService // contains filtered or unexported fields }
AuthorizationBackend is all services and associated parameters required to construct the AuthorizationHandler.
func NewAuthorizationBackend ¶
func NewAuthorizationBackend(log *zap.Logger, b *APIBackend) *AuthorizationBackend
NewAuthorizationBackend returns a new instance of AuthorizationBackend.
type AuthorizationHandler ¶
type AuthorizationHandler struct { *httprouter.Router platform.HTTPErrorHandler OrganizationService platform.OrganizationService UserService platform.UserService AuthorizationService platform.AuthorizationService LookupService platform.LookupService // contains filtered or unexported fields }
AuthorizationHandler represents an HTTP API handler for authorizations.
func NewAuthorizationHandler ¶
func NewAuthorizationHandler(log *zap.Logger, b *AuthorizationBackend) *AuthorizationHandler
NewAuthorizationHandler returns a new instance of AuthorizationHandler.
type AuthorizationService ¶
AuthorizationService connects to Influx via HTTP using tokens to manage authorizations
func (*AuthorizationService) CreateAuthorization ¶
func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *platform.Authorization) error
CreateAuthorization creates a new authorization and sets b.ID with the new identifier.
func (*AuthorizationService) DeleteAuthorization ¶
DeleteAuthorization removes a authorization by id.
func (*AuthorizationService) FindAuthorizationByID ¶
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error)
FindAuthorizationByID finds the authorization against a remote influx server.
func (*AuthorizationService) FindAuthorizationByToken ¶
func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, token string) (*platform.Authorization, error)
FindAuthorizationByToken returns a single authorization by Token.
func (*AuthorizationService) FindAuthorizations ¶
func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) ([]*platform.Authorization, int, error)
FindAuthorizations returns a list of authorizations that match filter and the total count of matching authorizations. Additional options provide pagination & sorting.
func (*AuthorizationService) UpdateAuthorization ¶
func (s *AuthorizationService) UpdateAuthorization(ctx context.Context, id platform.ID, upd *platform.AuthorizationUpdate) (*platform.Authorization, error)
UpdateAuthorization updates the status and description if available.
type AuthzError ¶
AuthzError is returned for authorization errors. When this error type is returned, the user can be presented with a generic "authorization failed" error, but the system can log the underlying AuthzError() so that operators have insight into what actually failed with authorization.
type BackupBackend ¶
type BackupBackend struct { Logger *zap.Logger influxdb.HTTPErrorHandler BackupService influxdb.BackupService KVBackupService influxdb.KVBackupService }
BackupBackend is all services and associated parameters required to construct the BackupHandler.
func NewBackupBackend ¶
func NewBackupBackend(b *APIBackend) *BackupBackend
NewBackupBackend returns a new instance of BackupBackend.
type BackupHandler ¶
type BackupHandler struct { *httprouter.Router influxdb.HTTPErrorHandler Logger *zap.Logger BackupService influxdb.BackupService KVBackupService influxdb.KVBackupService }
BackupHandler is http handler for backup service.
func NewBackupHandler ¶
func NewBackupHandler(b *BackupBackend) *BackupHandler
NewBackupHandler creates a new handler at /api/v2/backup to receive backup requests.
type BackupService ¶
BackupService is the client implementation of influxdb.BackupService.
func (*BackupService) CreateBackup ¶
func (*BackupService) FetchBackupFile ¶
func (*BackupService) InternalBackupPath ¶
func (s *BackupService) InternalBackupPath(backupID int) string
type BucketBackend ¶
type BucketBackend struct { influxdb.HTTPErrorHandler BucketService influxdb.BucketService BucketOperationLogService influxdb.BucketOperationLogService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
BucketBackend is all services and associated parameters required to construct the BucketHandler.
func NewBucketBackend ¶
func NewBucketBackend(log *zap.Logger, b *APIBackend) *BucketBackend
NewBucketBackend returns a new instance of BucketBackend.
type BucketHandler ¶
type BucketHandler struct { *httprouter.Router BucketService influxdb.BucketService BucketOperationLogService influxdb.BucketOperationLogService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
BucketHandler represents an HTTP API handler for buckets.
func NewBucketHandler ¶
func NewBucketHandler(log *zap.Logger, b *BucketBackend) *BucketHandler
NewBucketHandler returns a new instance of BucketHandler.
type BucketService ¶
type BucketService struct { Client *httpc.Client // OpPrefix is an additional property for error // find bucket service, when finds nothing. OpPrefix string }
BucketService connects to Influx via HTTP using tokens to manage buckets
func (*BucketService) CreateBucket ¶
func (s *BucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
CreateBucket creates a new bucket and sets b.ID with the new identifier.
func (*BucketService) DeleteBucket ¶
func (s *BucketService) DeleteBucket(ctx context.Context, id influxdb.ID) error
DeleteBucket removes a bucket by ID.
func (*BucketService) FindBucket ¶
func (s *BucketService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
FindBucket returns the first bucket that matches filter.
func (*BucketService) FindBucketByID ¶
func (s *BucketService) FindBucketByID(ctx context.Context, id influxdb.ID) (*influxdb.Bucket, error)
FindBucketByID returns a single bucket by ID.
func (*BucketService) FindBucketByName ¶
func (s *BucketService) FindBucketByName(ctx context.Context, orgID influxdb.ID, name string) (*influxdb.Bucket, error)
FindBucketByName returns a single bucket by name
func (*BucketService) FindBuckets ¶
func (s *BucketService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
FindBuckets returns a list of buckets that match filter and the total count of matching buckets. Additional options provide pagination & sorting.
func (*BucketService) UpdateBucket ¶
func (s *BucketService) UpdateBucket(ctx context.Context, id influxdb.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
UpdateBucket updates a single bucket with changeset. Returns the new bucket state after update.
type Check ¶
type Check struct { ID influxdb.ID `json:"id,omitempty"` Name string `json:"name"` OrgID influxdb.ID `json:"orgID,omitempty"` OwnerID influxdb.ID `json:"ownerID,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` Query *CheckQuery `json:"query"` Status influxdb.Status `json:"status"` Description string `json:"description"` LatestCompleted time.Time `json:"latestCompleted"` LastRunStatus string `json:"lastRunStatus"` LastRunError string `json:"lastRunError"` Labels []*influxdb.Label `json:"labels"` Links *CheckLinks `json:"links"` Type string `json:"type"` TimeSince string `json:"timeSince"` StaleTime string `json:"staleTime"` ReportZero bool `json:"reportZero"` Level string `json:"level"` Every string `json:"every"` Offset string `json:"offset"` Tags []*influxdb.Tag `json:"tags"` StatusMessageTemplate string `json:"statusMessageTemplate"` Thresholds []*CheckThreshold `json:"thresholds"` }
type CheckBackend ¶
type CheckBackend struct { influxdb.HTTPErrorHandler TaskService influxdb.TaskService CheckService influxdb.CheckService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
CheckBackend is all services and associated parameters required to construct the CheckBackendHandler.
func NewCheckBackend ¶
func NewCheckBackend(log *zap.Logger, b *APIBackend) *CheckBackend
NewCheckBackend returns a new instance of CheckBackend.
type CheckBuilderConfig ¶
type CheckBuilderConfig struct { Buckets []string `json:"buckets"` Tags []struct { Key string `json:"key"` Values []string `json:"values"` AggregateFunctionType string `json:"aggregateFunctionType"` } `json:"tags"` Functions []struct { Name string `json:"name"` } `json:"functions"` AggregateWindow struct { Period string `json:"period"` } `json:"aggregateWindow"` }
type CheckHandler ¶
type CheckHandler struct { *httprouter.Router influxdb.HTTPErrorHandler TaskService influxdb.TaskService CheckService influxdb.CheckService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
CheckHandler is the handler for the check service
func NewCheckHandler ¶
func NewCheckHandler(log *zap.Logger, b *CheckBackend) *CheckHandler
NewCheckHandler returns a new instance of CheckHandler.
type CheckLinks ¶
type CheckQuery ¶
type CheckQuery struct { Text string `json:"text"` EditMode string `json:"editMode"` Name string `json:"name"` BuilderConfig *CheckBuilderConfig `json:"builderConfig"` }
type CheckService ¶
CheckService is a client to interact with the handlers in this package over HTTP. It does not implement influxdb.CheckService because it returns a concrete representation of the API response and influxdb.Check as returned by that interface is not appropriate for this use case.
func (*CheckService) CreateCheck ¶
CreateCheck creates a new check.
func (*CheckService) DeleteCheck ¶
func (s *CheckService) DeleteCheck(ctx context.Context, id influxdb.ID) error
DeleteCheck removes a check.
func (*CheckService) FindCheck ¶
func (s *CheckService) FindCheck(ctx context.Context, filter influxdb.CheckFilter) (*Check, error)
FindCheck returns the first check matching the filter.
func (*CheckService) FindCheckByID ¶
func (s *CheckService) FindCheckByID(ctx context.Context, id influxdb.ID) (*Check, error)
FindCheckByID returns the Check matching the ID.
func (*CheckService) FindChecks ¶
func (s *CheckService) FindChecks(ctx context.Context, filter influxdb.CheckFilter, opt ...influxdb.FindOptions) ([]*Check, int, error)
FindChecks returns a list of checks that match filter and the total count of matching checks. Additional options provide pagination & sorting.
func (*CheckService) PatchCheck ¶
func (s *CheckService) PatchCheck(ctx context.Context, id influxdb.ID, u influxdb.CheckUpdate) (*Check, error)
PatchCheck changes the status, description or name of a check.
func (*CheckService) UpdateCheck ¶
UpdateCheck updates a check.
type CheckThreshold ¶
type Checks ¶
type Checks struct { Checks []*Check `json:"checks"` Links *influxdb.PagingLinks `json:"links"` }
TODO(gavincabbage): These structures should be in a common place, like other models,
but the common influxdb.Check is an interface that is not appropriate for an API client.
type ChronografHandler ¶
type ChronografHandler struct { *httprouter.Router Service *server.Service }
ChronografHandler is an http handler for serving chronograf chronografs.
func NewChronografHandler ¶
func NewChronografHandler(s *server.Service, he influxdb.HTTPErrorHandler) *ChronografHandler
NewChronografHandler is the constructor an chronograf handler.
type DashboardBackend ¶
type DashboardBackend struct { influxdb.HTTPErrorHandler DashboardService influxdb.DashboardService DashboardOperationLogService influxdb.DashboardOperationLogService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService // contains filtered or unexported fields }
DashboardBackend is all services and associated parameters required to construct the DashboardHandler.
func NewDashboardBackend ¶
func NewDashboardBackend(log *zap.Logger, b *APIBackend) *DashboardBackend
NewDashboardBackend creates a backend used by the dashboard handler.
type DashboardHandler ¶
type DashboardHandler struct { *httprouter.Router influxdb.HTTPErrorHandler DashboardService influxdb.DashboardService DashboardOperationLogService influxdb.DashboardOperationLogService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService // contains filtered or unexported fields }
DashboardHandler is the handler for the dashboard service
func NewDashboardHandler ¶
func NewDashboardHandler(log *zap.Logger, b *DashboardBackend) *DashboardHandler
NewDashboardHandler returns a new instance of DashboardHandler.
type DashboardService ¶
DashboardService is a dashboard service over HTTP to the influxdb server.
func (*DashboardService) AddDashboardCell ¶
func (s *DashboardService) AddDashboardCell(ctx context.Context, id influxdb.ID, c *influxdb.Cell, opts influxdb.AddDashboardCellOptions) error
AddDashboardCell adds a cell to a dashboard.
func (*DashboardService) CreateDashboard ¶
func (s *DashboardService) CreateDashboard(ctx context.Context, d *influxdb.Dashboard) error
CreateDashboard creates a new dashboard and sets b.ID with the new identifier.
func (*DashboardService) DeleteDashboard ¶
func (s *DashboardService) DeleteDashboard(ctx context.Context, id influxdb.ID) error
DeleteDashboard removes a dashboard by ID.
func (*DashboardService) FindDashboardByID ¶
func (s *DashboardService) FindDashboardByID(ctx context.Context, id influxdb.ID) (*influxdb.Dashboard, error)
FindDashboardByID returns a single dashboard by ID.
func (*DashboardService) FindDashboards ¶
func (s *DashboardService) FindDashboards(ctx context.Context, filter influxdb.DashboardFilter, opts influxdb.FindOptions) ([]*influxdb.Dashboard, int, error)
FindDashboards returns a list of dashboards that match filter and the total count of matching dashboards. Additional options provide pagination & sorting.
func (*DashboardService) GetDashboardCellView ¶
func (s *DashboardService) GetDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID) (*influxdb.View, error)
GetDashboardCellView retrieves the view for a dashboard cell.
func (*DashboardService) RemoveDashboardCell ¶
func (s *DashboardService) RemoveDashboardCell(ctx context.Context, dashboardID, cellID influxdb.ID) error
RemoveDashboardCell removes a dashboard.
func (*DashboardService) ReplaceDashboardCells ¶
func (s *DashboardService) ReplaceDashboardCells(ctx context.Context, id influxdb.ID, cs []*influxdb.Cell) error
ReplaceDashboardCells replaces all cells in a dashboard
func (*DashboardService) UpdateDashboard ¶
func (s *DashboardService) UpdateDashboard(ctx context.Context, id influxdb.ID, upd influxdb.DashboardUpdate) (*influxdb.Dashboard, error)
UpdateDashboard updates a single dashboard with changeset. Returns the new dashboard state after update.
func (*DashboardService) UpdateDashboardCell ¶
func (s *DashboardService) UpdateDashboardCell(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.CellUpdate) (*influxdb.Cell, error)
UpdateDashboardCell replaces the dashboard cell with the provided ID.
func (*DashboardService) UpdateDashboardCellView ¶
func (s *DashboardService) UpdateDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.ViewUpdate) (*influxdb.View, error)
UpdateDashboardCellView updates the view for a dashboard cell.
type DeleteBackend ¶
type DeleteBackend struct { influxdb.HTTPErrorHandler DeleteService influxdb.DeleteService BucketService influxdb.BucketService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
DeleteBackend is all services and associated parameters required to construct the DeleteHandler.
func NewDeleteBackend ¶
func NewDeleteBackend(log *zap.Logger, b *APIBackend) *DeleteBackend
NewDeleteBackend returns a new instance of DeleteBackend
type DeleteHandler ¶
type DeleteHandler struct { influxdb.HTTPErrorHandler *httprouter.Router DeleteService influxdb.DeleteService BucketService influxdb.BucketService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
DeleteHandler receives a delete request with a predicate and sends it to storage.
func NewDeleteHandler ¶
func NewDeleteHandler(log *zap.Logger, b *DeleteBackend) *DeleteHandler
NewDeleteHandler creates a new handler at /api/v2/delete to recieve delete requests.
type DeleteRequest ¶
type DeleteRequest struct { OrgID string `json:"-"` Org string `json:"-"` // org name BucketID string `json:"-"` Bucket string `json:"-"` Start string `json:"start"` Stop string `json:"stop"` Predicate string `json:"predicate"` }
DeleteRequest is the request send over http to delete points.
type DeleteService ¶
DeleteService sends data over HTTP to delete points.
func (*DeleteService) DeleteBucketRangePredicate ¶
func (s *DeleteService) DeleteBucketRangePredicate(ctx context.Context, dr DeleteRequest) error
DeleteBucketRangePredicate send delete request over http to delete points.
type DocumentBackend ¶
type DocumentBackend struct { influxdb.HTTPErrorHandler DocumentService influxdb.DocumentService LabelService influxdb.LabelService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
DocumentBackend is all services and associated parameters required to construct the DocumentHandler.
func NewDocumentBackend ¶
func NewDocumentBackend(log *zap.Logger, b *APIBackend) *DocumentBackend
NewDocumentBackend returns a new instance of DocumentBackend.
type DocumentHandler ¶
type DocumentHandler struct { *httprouter.Router influxdb.HTTPErrorHandler DocumentService influxdb.DocumentService LabelService influxdb.LabelService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
DocumentHandler represents an HTTP API handler for documents.
func NewDocumentHandler ¶
func NewDocumentHandler(b *DocumentBackend) *DocumentHandler
NewDocumentHandler returns a new instance of DocumentHandler. TODO(desa): this should probably take a namespace
type DocumentService ¶
type DocumentService interface { CreateDocument(ctx context.Context, namespace string, orgID influxdb.ID, d *influxdb.Document) error GetDocuments(ctx context.Context, namespace string, orgID influxdb.ID) ([]*influxdb.Document, error) GetDocument(ctx context.Context, namespace string, id influxdb.ID) (*influxdb.Document, error) UpdateDocument(ctx context.Context, namespace string, d *influxdb.Document) error DeleteDocument(ctx context.Context, namespace string, id influxdb.ID) error GetDocumentLabels(ctx context.Context, namespace string, id influxdb.ID) ([]*influxdb.Label, error) AddDocumentLabel(ctx context.Context, namespace string, did influxdb.ID, lid influxdb.ID) (*influxdb.Label, error) DeleteDocumentLabel(ctx context.Context, namespace string, did influxdb.ID, lid influxdb.ID) error }
DocumentService is an interface HTTP-exposed portion of the document service.
func NewDocumentService ¶
func NewDocumentService(client *httpc.Client) DocumentService
NewDocumentService creates a client to connect to Influx via HTTP to manage documents.
type FluxBackend ¶
type FluxBackend struct { influxdb.HTTPErrorHandler QueryEventRecorder metric.EventRecorder OrganizationService influxdb.OrganizationService ProxyQueryService query.ProxyQueryService // contains filtered or unexported fields }
FluxBackend is all services and associated parameters required to construct the FluxHandler.
func NewFluxBackend ¶
func NewFluxBackend(log *zap.Logger, b *APIBackend) *FluxBackend
NewFluxBackend returns a new instance of FluxBackend.
type FluxHandler ¶
type FluxHandler struct { *httprouter.Router influxdb.HTTPErrorHandler Now func() time.Time OrganizationService influxdb.OrganizationService ProxyQueryService query.ProxyQueryService EventRecorder metric.EventRecorder // contains filtered or unexported fields }
FluxHandler implements handling flux queries.
func NewFluxHandler ¶
func NewFluxHandler(log *zap.Logger, b *FluxBackend) *FluxHandler
NewFluxHandler returns a new handler at /api/v2/query for flux queries.
func (*FluxHandler) PrometheusCollectors ¶
func (h *FluxHandler) PrometheusCollectors() []prom.Collector
PrometheusCollectors satisifies the prom.PrometheusCollector interface.
type FluxQueryService ¶
FluxQueryService implements query.QueryService by making HTTP requests to the /api/v2/query API endpoint.
func (*FluxQueryService) Query ¶
func (s *FluxQueryService) Query(ctx context.Context, r *query.Request) (flux.ResultIterator, error)
Query runs a flux query against a influx server and decodes the result
type FluxService ¶
FluxService connects to Influx via HTTP using tokens to run queries.
func (*FluxService) Query ¶
func (s *FluxService) Query(ctx context.Context, w io.Writer, r *query.ProxyRequest) (flux.Statistics, error)
Query runs a flux query against a influx server and sends the results to the io.Writer. Will use the token from the context over the token within the service struct.
type HTTPDialect ¶
type HTTPDialect interface {
SetHeaders(w http.ResponseWriter)
}
HTTPDialect is an encoding dialect that can write metadata to HTTP headers
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides basic handling of metrics, health and debug endpoints. All other requests are passed down to the sub handler.
func NewHandlerFromRegistry ¶
func NewHandlerFromRegistry(name string, reg *prom.Registry, opts ...HandlerOptFn) *Handler
NewHandlerFromRegistry creates a new handler with the given name, and sets the /metrics endpoint to use the metrics from the given registry, after self-registering h's metrics.
func (*Handler) PrometheusCollectors ¶
func (h *Handler) PrometheusCollectors() []prometheus.Collector
PrometheusCollectors satisifies prom.PrometheusCollector.
type HandlerOptFn ¶
type HandlerOptFn func(opts *handlerOpts)
func WithAPIHandler ¶
func WithAPIHandler(h http.Handler) HandlerOptFn
func WithDebugHandler ¶
func WithDebugHandler(h http.Handler) HandlerOptFn
func WithHealthHandler ¶
func WithHealthHandler(h http.Handler) HandlerOptFn
func WithLog ¶
func WithLog(l *zap.Logger) HandlerOptFn
func WithMetricsHandler ¶
func WithMetricsHandler(h http.Handler) HandlerOptFn
func WithReadyHandler ¶
func WithReadyHandler(h http.Handler) HandlerOptFn
type LabelBackend ¶
type LabelBackend struct { influxdb.HTTPErrorHandler LabelService influxdb.LabelService ResourceType influxdb.ResourceType // contains filtered or unexported fields }
LabelBackend is all services and associated parameters required to construct label handlers.
type LabelHandler ¶
type LabelHandler struct { *httprouter.Router influxdb.HTTPErrorHandler LabelService influxdb.LabelService // contains filtered or unexported fields }
LabelHandler represents an HTTP API handler for labels
func NewLabelHandler ¶
func NewLabelHandler(log *zap.Logger, s influxdb.LabelService, he influxdb.HTTPErrorHandler) *LabelHandler
NewLabelHandler returns a new instance of LabelHandler
type LabelService ¶
LabelService connects to Influx via HTTP using tokens to manage labels
func (*LabelService) CreateLabel ¶
func (s *LabelService) CreateLabel(ctx context.Context, l *influxdb.Label) error
CreateLabel creates a new label.
func (*LabelService) CreateLabelMapping ¶
func (s *LabelService) CreateLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error
CreateLabelMapping will create a labbel mapping
func (*LabelService) DeleteLabel ¶
func (s *LabelService) DeleteLabel(ctx context.Context, id influxdb.ID) error
DeleteLabel removes a label by ID.
func (*LabelService) DeleteLabelMapping ¶
func (s *LabelService) DeleteLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error
func (*LabelService) FindLabelByID ¶
func (s *LabelService) FindLabelByID(ctx context.Context, id influxdb.ID) (*influxdb.Label, error)
FindLabelByID returns a single label by ID.
func (*LabelService) FindLabels ¶
func (s *LabelService) FindLabels(ctx context.Context, filter influxdb.LabelFilter, opt ...influxdb.FindOptions) ([]*influxdb.Label, error)
FindLabels is a client for the find labels response from the server.
func (*LabelService) FindResourceLabels ¶
func (s *LabelService) FindResourceLabels(ctx context.Context, filter influxdb.LabelMappingFilter) ([]*influxdb.Label, error)
FindResourceLabels returns a list of labels, derived from a label mapping filter.
func (*LabelService) UpdateLabel ¶
func (s *LabelService) UpdateLabel(ctx context.Context, id influxdb.ID, upd influxdb.LabelUpdate) (*influxdb.Label, error)
UpdateLabel updates a label and returns the updated label.
type MemberBackend ¶
type MemberBackend struct { influxdb.HTTPErrorHandler ResourceType influxdb.ResourceType UserType influxdb.UserType UserResourceMappingService influxdb.UserResourceMappingService UserService influxdb.UserService // contains filtered or unexported fields }
MemberBackend is all services and associated parameters required to construct member handler.
type NotificationEndpointBackend ¶
type NotificationEndpointBackend struct { influxdb.HTTPErrorHandler NotificationEndpointService influxdb.NotificationEndpointService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
NotificationEndpointBackend is all services and associated parameters required to construct the NotificationEndpointBackendHandler.
func NewNotificationEndpointBackend ¶
func NewNotificationEndpointBackend(log *zap.Logger, b *APIBackend) *NotificationEndpointBackend
NewNotificationEndpointBackend returns a new instance of NotificationEndpointBackend.
func (*NotificationEndpointBackend) Logger ¶
func (b *NotificationEndpointBackend) Logger() *zap.Logger
type NotificationEndpointHandler ¶
type NotificationEndpointHandler struct { *httprouter.Router influxdb.HTTPErrorHandler NotificationEndpointService influxdb.NotificationEndpointService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
NotificationEndpointHandler is the handler for the notificationEndpoint service
func NewNotificationEndpointHandler ¶
func NewNotificationEndpointHandler(log *zap.Logger, b *NotificationEndpointBackend) *NotificationEndpointHandler
NewNotificationEndpointHandler returns a new instance of NotificationEndpointHandler.
type NotificationEndpointService ¶
type NotificationEndpointService struct { Client *httpc.Client *UserResourceMappingService *OrganizationService }
NotificationEndpointService is an http client for the influxdb.NotificationEndpointService server implementation.
func NewNotificationEndpointService ¶
func NewNotificationEndpointService(client *httpc.Client) *NotificationEndpointService
NewNotificationEndpointService constructs a new http NotificationEndpointService.
func (*NotificationEndpointService) CreateNotificationEndpoint ¶
func (s *NotificationEndpointService) CreateNotificationEndpoint(ctx context.Context, ne influxdb.NotificationEndpoint, userID influxdb.ID) error
CreateNotificationEndpoint creates a new notification endpoint and sets b.ID with the new identifier. TODO(@jsteenb2): this is unsatisfactory, we have no way of grabbing the new notification endpoint without
serious hacky hackertoning. Put it on the list...
func (*NotificationEndpointService) DeleteNotificationEndpoint ¶
func (s *NotificationEndpointService) DeleteNotificationEndpoint(ctx context.Context, id influxdb.ID) ([]influxdb.SecretField, influxdb.ID, error)
DeleteNotificationEndpoint removes a notification endpoint by ID, returns secret fields, orgID for further deletion. TODO: axe this delete design, makes little sense in how its currently being done. Right now, as an http client,
I am forced to know how the store handles this and then figure out what the server does in between me and that store, then see what falls out :flushed... for now returning nothing for secrets, orgID, and only returning an error. This makes the code/design smell super obvious imo
func (*NotificationEndpointService) FindNotificationEndpointByID ¶
func (s *NotificationEndpointService) FindNotificationEndpointByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationEndpoint, error)
FindNotificationEndpointByID returns a single notification endpoint by ID.
func (*NotificationEndpointService) FindNotificationEndpoints ¶
func (s *NotificationEndpointService) FindNotificationEndpoints(ctx context.Context, filter influxdb.NotificationEndpointFilter, opt ...influxdb.FindOptions) ([]influxdb.NotificationEndpoint, int, error)
FindNotificationEndpoints returns a list of notification endpoints that match filter and the total count of matching notification endpoints. Additional options provide pagination & sorting.
func (*NotificationEndpointService) PatchNotificationEndpoint ¶
func (s *NotificationEndpointService) PatchNotificationEndpoint(ctx context.Context, id influxdb.ID, upd influxdb.NotificationEndpointUpdate) (influxdb.NotificationEndpoint, error)
PatchNotificationEndpoint updates a single notification endpoint with changeset. Returns the new notification endpoint state after update.
func (*NotificationEndpointService) UpdateNotificationEndpoint ¶
func (s *NotificationEndpointService) UpdateNotificationEndpoint(ctx context.Context, id influxdb.ID, ne influxdb.NotificationEndpoint, userID influxdb.ID) (influxdb.NotificationEndpoint, error)
UpdateNotificationEndpoint updates a single notification endpoint. Returns the new notification endpoint after update.
type NotificationRuleBackend ¶
type NotificationRuleBackend struct { influxdb.HTTPErrorHandler NotificationRuleStore influxdb.NotificationRuleStore NotificationEndpointService influxdb.NotificationEndpointService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService TaskService influxdb.TaskService // contains filtered or unexported fields }
NotificationRuleBackend is all services and associated parameters required to construct the NotificationRuleBackendHandler.
func NewNotificationRuleBackend ¶
func NewNotificationRuleBackend(log *zap.Logger, b *APIBackend) *NotificationRuleBackend
NewNotificationRuleBackend returns a new instance of NotificationRuleBackend.
type NotificationRuleHandler ¶
type NotificationRuleHandler struct { *httprouter.Router influxdb.HTTPErrorHandler NotificationRuleStore influxdb.NotificationRuleStore NotificationEndpointService influxdb.NotificationEndpointService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService OrganizationService influxdb.OrganizationService TaskService influxdb.TaskService // contains filtered or unexported fields }
NotificationRuleHandler is the handler for the notification rule service
func NewNotificationRuleHandler ¶
func NewNotificationRuleHandler(log *zap.Logger, b *NotificationRuleBackend) *NotificationRuleHandler
NewNotificationRuleHandler returns a new instance of NotificationRuleHandler.
type NotificationRuleService ¶
type NotificationRuleService struct { Client *httpc.Client *UserResourceMappingService *OrganizationService }
NotificationRuleService is an http client that implements the NotificationRuleStore interface
func NewNotificationRuleService ¶
func NewNotificationRuleService(client *httpc.Client) *NotificationRuleService
NewNotificationRuleService wraps an httpc.Client in a NotificationRuleService
func (*NotificationRuleService) CreateNotificationRule ¶
func (s *NotificationRuleService) CreateNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error
CreateNotificationRule creates a new NotificationRule from a NotificationRuleCreate the Status on the NotificationRuleCreate is used to determine the status (active/inactive) of the associated Task
func (*NotificationRuleService) DeleteNotificationRule ¶
func (s *NotificationRuleService) DeleteNotificationRule(ctx context.Context, id influxdb.ID) error
DeleteNotificationRule removes a notification rule by ID.
func (*NotificationRuleService) FindNotificationRuleByID ¶
func (s *NotificationRuleService) FindNotificationRuleByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationRule, error)
FindNotificationRuleByID finds and returns one Notification Rule with a matching ID
func (*NotificationRuleService) FindNotificationRules ¶
func (s *NotificationRuleService) FindNotificationRules(ctx context.Context, filter influxdb.NotificationRuleFilter, opt ...influxdb.FindOptions) ([]influxdb.NotificationRule, int, error)
FindNotificationRules returns a list of notification rules that match filter and the total count of matching notification rules. Additional options provide pagination & sorting.
func (*NotificationRuleService) PatchNotificationRule ¶
func (s *NotificationRuleService) PatchNotificationRule(ctx context.Context, id influxdb.ID, upd influxdb.NotificationRuleUpdate) (influxdb.NotificationRule, error)
PatchNotificationRule updates a single notification rule with changeset. Returns the new notification rule state after update.
func (*NotificationRuleService) UpdateNotificationRule ¶
func (s *NotificationRuleService) UpdateNotificationRule(ctx context.Context, id influxdb.ID, nr influxdb.NotificationRuleCreate, userID influxdb.ID) (influxdb.NotificationRule, error)
UpdateNotificationRule updates a single notification rule. Returns the new notification rule after update.
type OrgBackend ¶
type OrgBackend struct { influxdb.HTTPErrorHandler OrganizationService influxdb.OrganizationService OrganizationOperationLogService influxdb.OrganizationOperationLogService UserResourceMappingService influxdb.UserResourceMappingService SecretService influxdb.SecretService LabelService influxdb.LabelService UserService influxdb.UserService // contains filtered or unexported fields }
OrgBackend is all services and associated parameters required to construct the OrgHandler.
func NewOrgBackend ¶
func NewOrgBackend(log *zap.Logger, b *APIBackend) *OrgBackend
NewOrgBackend is a datasource used by the org handler.
type OrgHandler ¶
type OrgHandler struct { *httprouter.Router *kithttp.API OrgSVC influxdb.OrganizationService OrganizationOperationLogService influxdb.OrganizationOperationLogService UserResourceMappingService influxdb.UserResourceMappingService SecretService influxdb.SecretService LabelService influxdb.LabelService UserService influxdb.UserService // contains filtered or unexported fields }
OrgHandler represents an HTTP API handler for orgs.
func NewOrgHandler ¶
func NewOrgHandler(log *zap.Logger, b *OrgBackend) *OrgHandler
NewOrgHandler returns a new instance of OrgHandler.
type OrganizationService ¶
type OrganizationService struct { Client *httpc.Client // OpPrefix is for not found errors. OpPrefix string }
OrganizationService connects to Influx via HTTP using tokens to manage organizations.
func (*OrganizationService) CreateOrganization ¶
func (s *OrganizationService) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
CreateOrganization creates an organization.
func (*OrganizationService) DeleteOrganization ¶
func (s *OrganizationService) DeleteOrganization(ctx context.Context, id influxdb.ID) error
DeleteOrganization removes organization id over HTTP.
func (*OrganizationService) FindOrganization ¶
func (s *OrganizationService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
FindOrganization gets a single organization matching the filter using HTTP.
func (*OrganizationService) FindOrganizationByID ¶
func (s *OrganizationService) FindOrganizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Organization, error)
FindOrganizationByID gets a single organization with a given id using HTTP.
func (*OrganizationService) FindOrganizations ¶
func (s *OrganizationService) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Organization, int, error)
FindOrganizations returns all organizations that match the filter via HTTP.
func (*OrganizationService) UpdateOrganization ¶
func (s *OrganizationService) UpdateOrganization(ctx context.Context, id influxdb.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
UpdateOrganization updates the organization over HTTP.
type PasswordService ¶
PasswordService is an http client to speak to the password service.
func (*PasswordService) CompareAndSetPassword ¶
func (s *PasswordService) CompareAndSetPassword(ctx context.Context, userID influxdb.ID, old string, new string) error
CompareAndSetPassword compares the old and new password and submits the new password if possoble. Note: is not implemented.
func (*PasswordService) ComparePassword ¶
func (s *PasswordService) ComparePassword(ctx context.Context, userID influxdb.ID, password string) error
ComparePassword compares the user new password with existing. Note: is not implemented.
func (*PasswordService) SetPassword ¶
func (s *PasswordService) SetPassword(ctx context.Context, userID influxdb.ID, password string) error
SetPassword sets the user's password.
type PlatformHandler ¶
type PlatformHandler struct { AssetHandler *AssetHandler DocsHandler http.HandlerFunc APIHandler http.Handler }
PlatformHandler is a collection of all the service handlers.
func NewPlatformHandler ¶
func NewPlatformHandler(b *APIBackend, us influxdb.UserService, opts ...APIHandlerOptFn) *PlatformHandler
NewPlatformHandler returns a platform handler that serves the API and associated assets.
func (*PlatformHandler) ServeHTTP ¶
func (h *PlatformHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP delegates a request to the appropriate subhandler.
type QueryAnalysis ¶
type QueryAnalysis struct {
Errors []queryParseError `json:"errors"`
}
QueryAnalysis is a structured response of errors.
type QueryDialect ¶
type QueryDialect struct { Header *bool `json:"header"` Delimiter string `json:"delimiter"` CommentPrefix string `json:"commentPrefix"` DateTimeFormat string `json:"dateTimeFormat"` Annotations []string `json:"annotations"` }
QueryDialect is the formatting options for the query response.
type QueryRequest ¶
type QueryRequest struct { Type string `json:"type"` Query string `json:"query"` // Flux fields Extern *ast.File `json:"extern,omitempty"` Spec *flux.Spec `json:"spec,omitempty"` AST *ast.Package `json:"ast,omitempty"` Dialect QueryDialect `json:"dialect"` Now time.Time `json:"now"` // InfluxQL fields Bucket string `json:"bucket,omitempty"` Org *influxdb.Organization `json:"-"` // PreferNoContent specifies if the Response to this request should // contain any result. This is done for avoiding unnecessary // bandwidth consumption in certain cases. For example, when the // query produces side effects and the results do not matter. E.g.: // from(...) |> ... |> to() // For example, tasks do not use the results of queries, but only // care about their side effects. // To obtain a QueryRequest with no result, add the header // `Prefer: return-no-content` to the HTTP request. PreferNoContent bool // PreferNoContentWithError is the same as above, but it forces the // Response to contain an error if that is a Flux runtime error encoded // in the response body. // To obtain a QueryRequest with no result but runtime errors, // add the header `Prefer: return-no-content-with-error` to the HTTP request. PreferNoContentWithError bool }
QueryRequest is a flux query request.
func QueryRequestFromProxyRequest ¶
func QueryRequestFromProxyRequest(req *query.ProxyRequest) (*QueryRequest, error)
QueryRequestFromProxyRequest converts a query.ProxyRequest into a QueryRequest. The ProxyRequest must contain supported compilers and dialects otherwise an error occurs.
func (QueryRequest) Analyze ¶
func (r QueryRequest) Analyze() (*QueryAnalysis, error)
Analyze attempts to parse the query request and returns any errors encountered in a structured way.
func (QueryRequest) ProxyRequest ¶
func (r QueryRequest) ProxyRequest() (*query.ProxyRequest, error)
ProxyRequest returns a request to proxy from the flux.
func (QueryRequest) Validate ¶
func (r QueryRequest) Validate() error
Validate checks the query request and returns an error if the request is invalid.
func (QueryRequest) WithDefaults ¶
func (r QueryRequest) WithDefaults() QueryRequest
WithDefaults adds default values to the request.
type ScraperBackend ¶
type ScraperBackend struct { influxdb.HTTPErrorHandler ScraperStorageService influxdb.ScraperTargetStoreService BucketService influxdb.BucketService OrganizationService influxdb.OrganizationService UserService influxdb.UserService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService // contains filtered or unexported fields }
ScraperBackend is all services and associated parameters required to construct the ScraperHandler.
func NewScraperBackend ¶
func NewScraperBackend(log *zap.Logger, b *APIBackend) *ScraperBackend
NewScraperBackend returns a new instance of ScraperBackend.
type ScraperHandler ¶
type ScraperHandler struct { *httprouter.Router influxdb.HTTPErrorHandler UserService influxdb.UserService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService ScraperStorageService influxdb.ScraperTargetStoreService BucketService influxdb.BucketService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
ScraperHandler represents an HTTP API handler for scraper targets.
func NewScraperHandler ¶
func NewScraperHandler(log *zap.Logger, b *ScraperBackend) *ScraperHandler
NewScraperHandler returns a new instance of ScraperHandler.
type ScraperService ¶
type ScraperService struct { Addr string Token string InsecureSkipVerify bool // OpPrefix is for update invalid ops OpPrefix string }
ScraperService connects to Influx via HTTP using tokens to manage scraper targets.
func (*ScraperService) AddTarget ¶
func (s *ScraperService) AddTarget(ctx context.Context, target *influxdb.ScraperTarget, userID influxdb.ID) error
AddTarget creates a new scraper target and sets target.ID with the new identifier.
func (*ScraperService) GetTargetByID ¶
func (s *ScraperService) GetTargetByID(ctx context.Context, id influxdb.ID) (*influxdb.ScraperTarget, error)
GetTargetByID returns a single target by ID.
func (*ScraperService) ListTargets ¶
func (s *ScraperService) ListTargets(ctx context.Context, filter influxdb.ScraperTargetFilter) ([]influxdb.ScraperTarget, error)
ListTargets returns a list of all scraper targets.
func (*ScraperService) RemoveTarget ¶
func (s *ScraperService) RemoveTarget(ctx context.Context, id influxdb.ID) error
RemoveTarget removes a scraper target by ID.
func (*ScraperService) UpdateTarget ¶
func (s *ScraperService) UpdateTarget(ctx context.Context, update *influxdb.ScraperTarget, userID influxdb.ID) (*influxdb.ScraperTarget, error)
UpdateTarget updates a single scraper target with changeset. Returns the new target state after update.
type SecretService ¶
SecretService connects to Influx via HTTP using tokens to manage secrets.
func (*SecretService) DeleteSecret ¶
func (s *SecretService) DeleteSecret(ctx context.Context, orgID influxdb.ID, ks ...string) error
DeleteSecret removes a single secret via HTTP.
func (*SecretService) GetSecretKeys ¶
func (s *SecretService) GetSecretKeys(ctx context.Context, orgID influxdb.ID) ([]string, error)
GetSecretKeys get all secret keys mathing an org ID via HTTP.
func (*SecretService) LoadSecret ¶
func (s *SecretService) LoadSecret(ctx context.Context, orgID influxdb.ID, k string) (string, error)
LoadSecret is not implemented for http
func (*SecretService) PatchSecrets ¶
func (s *SecretService) PatchSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error
PatchSecrets will update the existing secret with new via http.
func (*SecretService) PutSecrets ¶
func (s *SecretService) PutSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error
PutSecrets is not implemented for http.
type Server ¶
Server is an abstraction around the http.Server that handles a server process. It manages the full lifecycle of a server by serving a handler on a socket. If signals have been registered, it will attempt to terminate the server using Shutdown if a signal is received and will force a shutdown if a second signal is received.
func (*Server) ListenForSignals ¶
ListenForSignals registers the the server to listen for the given signals to shutdown the server. The signals are not captured until Serve is called.
type Service ¶
type Service struct { Addr string Token string InsecureSkipVerify bool *AuthorizationService *BackupService *BucketService *TaskService *DashboardService *OrganizationService *NotificationRuleService *UserService *VariableService *WriteService DocumentService *CheckService *NotificationEndpointService *UserResourceMappingService *TelegrafService *LabelService *SecretService }
Service connects to an InfluxDB via HTTP.
func NewService ¶
NewService returns a service that is an HTTP client to a remote. Address and token are needed for those services that do not use httpc.Client, but use those for configuring. Usually one would do:
``` c := NewHTTPClient(addr, token, insecureSkipVerify) s := NewService(c, addr token) ```
So one should provide the same `addr` and `token` to both calls to ensure consistency in the behavior of the returned service.
type SessionBackend ¶
type SessionBackend struct { platform.HTTPErrorHandler PasswordsService platform.PasswordsService SessionService platform.SessionService UserService platform.UserService // contains filtered or unexported fields }
SessionBackend is all services and associated parameters required to construct the SessionHandler.
type SessionHandler ¶
type SessionHandler struct { *httprouter.Router platform.HTTPErrorHandler PasswordsService platform.PasswordsService SessionService platform.SessionService UserService platform.UserService // contains filtered or unexported fields }
SessionHandler represents an HTTP API handler for authorizations.
func NewSessionHandler ¶
func NewSessionHandler(log *zap.Logger, b *SessionBackend) *SessionHandler
NewSessionHandler returns a new instance of SessionHandler.
type SetupBackend ¶
type SetupBackend struct { platform.HTTPErrorHandler OnboardingService platform.OnboardingService // contains filtered or unexported fields }
SetupBackend is all services and associated parameters required to construct the SetupHandler.
func NewSetupBackend ¶
func NewSetupBackend(log *zap.Logger, b *APIBackend) *SetupBackend
NewSetupBackend returns a new instance of SetupBackend.
type SetupHandler ¶
type SetupHandler struct { *httprouter.Router platform.HTTPErrorHandler OnboardingService platform.OnboardingService // contains filtered or unexported fields }
SetupHandler represents an HTTP API handler for onboarding setup.
func NewSetupHandler ¶
func NewSetupHandler(log *zap.Logger, b *SetupBackend) *SetupHandler
NewSetupHandler returns a new instance of SetupHandler.
type SetupService ¶
SetupService connects to Influx via HTTP to perform onboarding operations
func (*SetupService) IsOnboarding ¶
func (s *SetupService) IsOnboarding(ctx context.Context) (bool, error)
IsOnboarding determine if onboarding request is allowed.
func (*SetupService) OnboardInitialUser ¶
func (s *SetupService) OnboardInitialUser(ctx context.Context, or *platform.OnboardingRequest) (*platform.OnboardingResults, error)
OnboardInitialUser OnboardingResults.
func (*SetupService) OnboardUser ¶
func (s *SetupService) OnboardUser(ctx context.Context, or *platform.OnboardingRequest) (*platform.OnboardingResults, error)
type SourceBackend ¶
type SourceBackend struct { platform.HTTPErrorHandler SourceService platform.SourceService LabelService platform.LabelService BucketService platform.BucketService NewQueryService func(s *platform.Source) (query.ProxyQueryService, error) // contains filtered or unexported fields }
SourceBackend is all services and associated parameters required to construct the SourceHandler.
func NewSourceBackend ¶
func NewSourceBackend(log *zap.Logger, b *APIBackend) *SourceBackend
NewSourceBackend returns a new instance of SourceBackend.
type SourceHandler ¶
type SourceHandler struct { *httprouter.Router platform.HTTPErrorHandler SourceService platform.SourceService LabelService platform.LabelService BucketService platform.BucketService // TODO(desa): this was done so in order to remove an import cycle and to allow // for http mocking. NewQueryService func(s *platform.Source) (query.ProxyQueryService, error) // contains filtered or unexported fields }
SourceHandler is a handler for sources
func NewSourceHandler ¶
func NewSourceHandler(log *zap.Logger, b *SourceBackend) *SourceHandler
NewSourceHandler returns a new instance of SourceHandler.
type SourceProxyQueryService ¶
type SourceProxyQueryService struct { Addr string InsecureSkipVerify bool platform.SourceFields }
func (*SourceProxyQueryService) Check ¶
func (s *SourceProxyQueryService) Check(context.Context) check.Response
func (*SourceProxyQueryService) Query ¶
func (s *SourceProxyQueryService) Query(ctx context.Context, w io.Writer, req *query.ProxyRequest) (flux.Statistics, error)
type SourceService ¶
SourceService connects to Influx via HTTP using tokens to manage sources
func (*SourceService) CreateSource ¶
CreateSource creates a new source and sets b.ID with the new identifier.
func (*SourceService) DeleteSource ¶
DeleteSource removes a source by ID.
func (*SourceService) FindSourceByID ¶
func (s *SourceService) FindSourceByID(ctx context.Context, id platform.ID) (*platform.Source, error)
FindSourceByID returns a single source by ID.
func (*SourceService) FindSources ¶
func (s *SourceService) FindSources(ctx context.Context, opt platform.FindOptions) ([]*platform.Source, int, error)
FindSources returns a list of sources that match filter and the total count of matching sources. Additional options provide pagination & sorting.
func (*SourceService) UpdateSource ¶
func (s *SourceService) UpdateSource(ctx context.Context, id platform.ID, upd platform.SourceUpdate) (*platform.Source, error)
UpdateSource updates a single source with changeset. Returns the new source state after update.
type SpanTransport ¶
type SpanTransport struct {
// contains filtered or unexported fields
}
SpanTransport injects the http.RoundTripper.RoundTrip() request with a span.
type Task ¶
type Task struct { ID influxdb.ID `json:"id"` OrganizationID influxdb.ID `json:"orgID"` Organization string `json:"org"` OwnerID influxdb.ID `json:"ownerID"` Name string `json:"name"` Description string `json:"description,omitempty"` Status string `json:"status"` Flux string `json:"flux"` Every string `json:"every,omitempty"` Cron string `json:"cron,omitempty"` Offset string `json:"offset,omitempty"` LatestCompleted string `json:"latestCompleted,omitempty"` LastRunStatus string `json:"lastRunStatus,omitempty"` LastRunError string `json:"lastRunError,omitempty"` CreatedAt string `json:"createdAt,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Task is a package-specific Task format that preserves the expected format for the API, where time values are represented as strings
func NewFrontEndTask ¶
func NewFrontEndTask(t influxdb.Task) Task
NewFrontEndTask converts a internal task type to a task that we want to display to users
type TaskBackend ¶
type TaskBackend struct { influxdb.HTTPErrorHandler TaskService influxdb.TaskService AuthorizationService influxdb.AuthorizationService OrganizationService influxdb.OrganizationService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService BucketService influxdb.BucketService // contains filtered or unexported fields }
TaskBackend is all services and associated parameters required to construct the TaskHandler.
func NewTaskBackend ¶
func NewTaskBackend(log *zap.Logger, b *APIBackend) *TaskBackend
NewTaskBackend returns a new instance of TaskBackend.
type TaskHandler ¶
type TaskHandler struct { *httprouter.Router influxdb.HTTPErrorHandler TaskService influxdb.TaskService AuthorizationService influxdb.AuthorizationService OrganizationService influxdb.OrganizationService UserResourceMappingService influxdb.UserResourceMappingService LabelService influxdb.LabelService UserService influxdb.UserService BucketService influxdb.BucketService // contains filtered or unexported fields }
TaskHandler represents an HTTP API handler for tasks.
func NewTaskHandler ¶
func NewTaskHandler(log *zap.Logger, b *TaskBackend) *TaskHandler
NewTaskHandler returns a new instance of TaskHandler.
type TaskService ¶
TaskService connects to Influx via HTTP using tokens to manage tasks.
func (TaskService) CancelRun ¶
func (t TaskService) CancelRun(ctx context.Context, taskID, runID influxdb.ID) error
CancelRun stops a longer running run.
func (TaskService) CreateTask ¶
func (t TaskService) CreateTask(ctx context.Context, tc influxdb.TaskCreate) (*Task, error)
CreateTask creates a new task.
func (TaskService) DeleteTask ¶
func (t TaskService) DeleteTask(ctx context.Context, id influxdb.ID) error
DeleteTask removes a task by ID and purges all associated data and scheduled runs.
func (TaskService) FindLogs ¶
func (t TaskService) FindLogs(ctx context.Context, filter influxdb.LogFilter) ([]*influxdb.Log, int, error)
FindLogs returns logs for a run.
func (TaskService) FindRunByID ¶
func (t TaskService) FindRunByID(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
FindRunByID returns a single run of a specific task.
func (TaskService) FindRuns ¶
func (t TaskService) FindRuns(ctx context.Context, filter influxdb.RunFilter) ([]*influxdb.Run, int, error)
FindRuns returns a list of runs that match a filter and the total count of returned runs.
func (TaskService) FindTaskByID ¶
func (t TaskService) FindTaskByID(ctx context.Context, id influxdb.ID) (*Task, error)
FindTaskByID returns a single task
func (TaskService) FindTasks ¶
func (t TaskService) FindTasks(ctx context.Context, filter influxdb.TaskFilter) ([]Task, int, error)
FindTasks returns a list of tasks that match a filter (limit 100) and the total count of matching tasks.
func (TaskService) ForceRun ¶
func (t TaskService) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error)
ForceRun starts a run manually right now.
func (TaskService) RetryRun ¶
func (t TaskService) RetryRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
RetryRun creates and returns a new run (which is a retry of another run).
func (TaskService) UpdateTask ¶
func (t TaskService) UpdateTask(ctx context.Context, id influxdb.ID, upd influxdb.TaskUpdate) (*Task, error)
UpdateTask updates a single task with changeset.
type TelegrafBackend ¶
type TelegrafBackend struct { platform.HTTPErrorHandler TelegrafService platform.TelegrafConfigStore UserResourceMappingService platform.UserResourceMappingService LabelService platform.LabelService UserService platform.UserService OrganizationService platform.OrganizationService // contains filtered or unexported fields }
TelegrafBackend is all services and associated parameters required to construct the TelegrafHandler.
func NewTelegrafBackend ¶
func NewTelegrafBackend(log *zap.Logger, b *APIBackend) *TelegrafBackend
NewTelegrafBackend returns a new instance of TelegrafBackend.
type TelegrafHandler ¶
type TelegrafHandler struct { *httprouter.Router platform.HTTPErrorHandler TelegrafService platform.TelegrafConfigStore UserResourceMappingService platform.UserResourceMappingService LabelService platform.LabelService UserService platform.UserService OrganizationService platform.OrganizationService // contains filtered or unexported fields }
TelegrafHandler is the handler for the telegraf service
func NewTelegrafHandler ¶
func NewTelegrafHandler(log *zap.Logger, b *TelegrafBackend) *TelegrafHandler
NewTelegrafHandler returns a new instance of TelegrafHandler.
type TelegrafService ¶
type TelegrafService struct { *UserResourceMappingService // contains filtered or unexported fields }
TelegrafService is an http client that speaks to the telegraf service via HTTP.
func NewTelegrafService ¶
func NewTelegrafService(httpClient *httpc.Client) *TelegrafService
NewTelegrafService is a constructor for a telegraf service.
func (*TelegrafService) CreateTelegrafConfig ¶
func (s *TelegrafService) CreateTelegrafConfig(ctx context.Context, tc *platform.TelegrafConfig, userID platform.ID) error
CreateTelegrafConfig creates a new telegraf config and sets b.ID with the new identifier.
func (*TelegrafService) DeleteTelegrafConfig ¶
DeleteTelegrafConfig removes a telegraf config by ID.
func (*TelegrafService) FindTelegrafConfigByID ¶
func (s *TelegrafService) FindTelegrafConfigByID(ctx context.Context, id platform.ID) (*platform.TelegrafConfig, error)
FindTelegrafConfigByID returns a single telegraf config by ID.
func (*TelegrafService) FindTelegrafConfigs ¶
func (s *TelegrafService) FindTelegrafConfigs(ctx context.Context, f platform.TelegrafConfigFilter, opt ...platform.FindOptions) ([]*platform.TelegrafConfig, int, error)
FindTelegrafConfigs returns a list of telegraf configs that match filter and the total count of matching telegraf configs. Additional options provide pagination & sorting.
func (*TelegrafService) UpdateTelegrafConfig ¶
func (s *TelegrafService) UpdateTelegrafConfig(ctx context.Context, id platform.ID, tc *platform.TelegrafConfig, userID platform.ID) (*platform.TelegrafConfig, error)
UpdateTelegrafConfig updates a single telegraf config. Returns the new telegraf config after update.
type UsageHandler ¶
type UsageHandler struct { *httprouter.Router platform.HTTPErrorHandler UsageService platform.UsageService // contains filtered or unexported fields }
UsageHandler represents an HTTP API handler for usages.
func NewUsageHandler ¶
func NewUsageHandler(log *zap.Logger, he platform.HTTPErrorHandler) *UsageHandler
NewUsageHandler returns a new instance of UsageHandler.
type UserBackend ¶
type UserBackend struct { influxdb.HTTPErrorHandler UserService influxdb.UserService UserOperationLogService influxdb.UserOperationLogService PasswordsService influxdb.PasswordsService // contains filtered or unexported fields }
UserBackend is all services and associated parameters required to construct the UserHandler.
func NewUserBackend ¶
func NewUserBackend(log *zap.Logger, b *APIBackend) *UserBackend
NewUserBackend creates a UserBackend using information in the APIBackend.
type UserHandler ¶
type UserHandler struct { *httprouter.Router influxdb.HTTPErrorHandler UserService influxdb.UserService UserOperationLogService influxdb.UserOperationLogService PasswordsService influxdb.PasswordsService // contains filtered or unexported fields }
UserHandler represents an HTTP API handler for users.
func NewUserHandler ¶
func NewUserHandler(log *zap.Logger, b *UserBackend) *UserHandler
NewUserHandler returns a new instance of UserHandler.
type UserResourceMappingService ¶
UserResourceMappingService is the struct of urm service
func (*UserResourceMappingService) CreateUserResourceMapping ¶
func (s *UserResourceMappingService) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
CreateUserResourceMapping will create a user resource mapping
func (*UserResourceMappingService) DeleteUserResourceMapping ¶
func (s *UserResourceMappingService) DeleteUserResourceMapping(ctx context.Context, resourceID influxdb.ID, userID influxdb.ID) error
DeleteUserResourceMapping will delete user resource mapping based in criteria.
func (*UserResourceMappingService) FindUserResourceMappings ¶
func (s *UserResourceMappingService) FindUserResourceMappings(ctx context.Context, f influxdb.UserResourceMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.UserResourceMapping, int, error)
FindUserResourceMappings returns the user resource mappings
type UserResponse ¶
UserResponse is the response of user
type UserService ¶
type UserService struct { Client *httpc.Client // OpPrefix is the ops of not found error. OpPrefix string }
UserService connects to Influx via HTTP using tokens to manage users
func (*UserService) CreateUser ¶
func (s *UserService) CreateUser(ctx context.Context, u *influxdb.User) error
CreateUser creates a new user and sets u.ID with the new identifier.
func (*UserService) DeleteUser ¶
func (s *UserService) DeleteUser(ctx context.Context, id influxdb.ID) error
DeleteUser removes a user by ID.
func (*UserService) FindMe ¶
func (s *UserService) FindMe(ctx context.Context, id influxdb.ID) (*influxdb.User, error)
FindMe returns user information about the owner of the token
func (*UserService) FindUser ¶
func (s *UserService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
FindUser returns the first user that matches filter.
func (*UserService) FindUserByID ¶
func (s *UserService) FindUserByID(ctx context.Context, id influxdb.ID) (*influxdb.User, error)
FindUserByID returns a single user by ID.
func (*UserService) FindUsers ¶
func (s *UserService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
FindUsers returns a list of users that match filter and the total count of matching users. Additional options provide pagination & sorting.
func (*UserService) UpdateUser ¶
func (s *UserService) UpdateUser(ctx context.Context, id influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
UpdateUser updates a single user with changeset. Returns the new user state after update.
type VariableBackend ¶
type VariableBackend struct { influxdb.HTTPErrorHandler VariableService influxdb.VariableService LabelService influxdb.LabelService // contains filtered or unexported fields }
VariableBackend is all services and associated parameters required to construct the VariableHandler.
func NewVariableBackend ¶
func NewVariableBackend(log *zap.Logger, b *APIBackend) *VariableBackend
NewVariableBackend creates a backend used by the variable handler.
type VariableHandler ¶
type VariableHandler struct { *httprouter.Router influxdb.HTTPErrorHandler VariableService influxdb.VariableService LabelService influxdb.LabelService // contains filtered or unexported fields }
VariableHandler is the handler for the variable service
func NewVariableHandler ¶
func NewVariableHandler(log *zap.Logger, b *VariableBackend) *VariableHandler
NewVariableHandler creates a new VariableHandler
type VariableService ¶
VariableService is a variable service over HTTP to the influxdb server
func (*VariableService) CreateVariable ¶
func (s *VariableService) CreateVariable(ctx context.Context, m *influxdb.Variable) error
CreateVariable creates a new variable and assigns it an influxdb.ID
func (*VariableService) DeleteVariable ¶
func (s *VariableService) DeleteVariable(ctx context.Context, id influxdb.ID) error
DeleteVariable removes a variable from the store
func (*VariableService) FindVariableByID ¶
func (s *VariableService) FindVariableByID(ctx context.Context, id influxdb.ID) (*influxdb.Variable, error)
FindVariableByID finds a single variable from the store by its ID
func (*VariableService) FindVariables ¶
func (s *VariableService) FindVariables(ctx context.Context, filter influxdb.VariableFilter, opts ...influxdb.FindOptions) ([]*influxdb.Variable, error)
FindVariables returns a list of variables that match filter. Additional options provide pagination & sorting.
func (*VariableService) ReplaceVariable ¶
func (s *VariableService) ReplaceVariable(ctx context.Context, variable *influxdb.Variable) error
ReplaceVariable replaces a single variable
func (*VariableService) UpdateVariable ¶
func (s *VariableService) UpdateVariable(ctx context.Context, id influxdb.ID, update *influxdb.VariableUpdate) (*influxdb.Variable, error)
UpdateVariable updates a single variable with a changeset
type WriteBackend ¶
type WriteBackend struct { influxdb.HTTPErrorHandler WriteEventRecorder metric.EventRecorder PointsWriter storage.PointsWriter BucketService influxdb.BucketService OrganizationService influxdb.OrganizationService // contains filtered or unexported fields }
WriteBackend is all services and associated parameters required to construct the WriteHandler.
func NewWriteBackend ¶
func NewWriteBackend(log *zap.Logger, b *APIBackend) *WriteBackend
NewWriteBackend returns a new instance of WriteBackend.
type WriteHandler ¶
type WriteHandler struct { *httprouter.Router influxdb.HTTPErrorHandler BucketService influxdb.BucketService OrganizationService influxdb.OrganizationService PointsWriter storage.PointsWriter EventRecorder metric.EventRecorder // contains filtered or unexported fields }
WriteHandler receives line protocol and sends to a publish function.
func NewWriteHandler ¶
func NewWriteHandler(log *zap.Logger, b *WriteBackend, opts ...WriteHandlerOption) *WriteHandler
NewWriteHandler creates a new handler at /api/v2/write to receive line protocol.
func (*WriteHandler) Prefix ¶
func (*WriteHandler) Prefix() string
Prefix provides the route prefix.
type WriteHandlerOption ¶
type WriteHandlerOption func(*WriteHandler)
WriteHandlerOption is a functional option for a *WriteHandler
func WithMaxBatchSizeBytes ¶
func WithMaxBatchSizeBytes(n int64) WriteHandlerOption
WithMaxBatchSizeBytes configures the maximum size for a (decompressed) points batch allowed by the write handler
func WithParserMaxBytes ¶
func WithParserMaxBytes(n int) WriteHandlerOption
WithParserMaxBytes specifies the maximum number of bytes that may be allocated when processing a single write request. When n is zero, there is no limit.
func WithParserMaxLines ¶
func WithParserMaxLines(n int) WriteHandlerOption
WithParserMaxLines specifies the maximum number of lines that may be parsed when processing a single write request. When n is zero, there is no limit.
func WithParserMaxValues ¶
func WithParserMaxValues(n int) WriteHandlerOption
WithParserMaxValues specifies the maximum number of values that may be parsed when processing a single write request. When n is zero, there is no limit.
type WriteService ¶
WriteService sends data over HTTP to influxdb via line protocol.
Source Files ¶
- api_handler.go
- assets.go
- auth_service.go
- authentication_middleware.go
- backup_service.go
- bucket_service.go
- check_service.go
- chronograf_handler.go
- client.go
- dashboard_service.go
- debug.go
- delete_handler.go
- document_service.go
- duration.go
- errors.go
- handler.go
- health.go
- helpers.go
- label_service.go
- middleware.go
- no_assets.go
- notification_endpoint.go
- notification_rule.go
- onboarding.go
- org_service.go
- paging.go
- platform_handler.go
- query.go
- query_handler.go
- ready.go
- redoc.go
- requests.go
- router.go
- scraper_service.go
- server.go
- session_handler.go
- source_proxy_service.go
- source_service.go
- swagger.go
- swagger_noassets.go
- task_service.go
- telegraf.go
- tokens.go
- ua.go
- usage_service.go
- user_resource_mapping_service.go
- user_service.go
- variable_service.go
- write_handler.go