Documentation ¶
Index ¶
- Constants
- Variables
- func CreateMeasurement(org, bucket []byte) ([]byte, error)
- func ErrorCode(err error) string
- func ErrorMessage(err error) string
- func ErrorOp(err error) string
- func FindOptionParams(opts ...FindOptions) [][2]string
- func FindTaskAuthRequired(ctx context.Context) bool
- func FindTaskWithoutAuth(ctx context.Context) context.Context
- func IsActive(a *Authorization) bool
- func MarshalViewPropertiesJSON(v ViewProperties) ([]byte, error)
- func NewBuilderTag(key string, functionType string, values ...string) struct{ ... }
- func PermissionAllowed(perm Permission, ps []Permission) bool
- func ReadMeasurement(name []byte) (orgID, bucketID []byte, err error)
- func SetBuildInfo(version, commit, date string)
- func SortDashboards(opts FindOptions, ds []*Dashboard)
- func ValidScraperType(s string) bool
- func WhereOrg(org string) func(DocumentIndex, DocumentDecorator) ([]ID, error)
- func WhereOrgID(orgID ID) func(DocumentIndex, DocumentDecorator) ([]ID, error)
- func WithErrorCode(code string) func(*Error)
- func WithErrorErr(err error) func(*Error)
- func WithErrorMsg(msg string) func(*Error)
- func WithErrorOp(op string) func(*Error)
- type Action
- type AddDashboardCellOptions
- type Authorization
- type AuthorizationFilter
- type AuthorizationService
- type AuthorizationUpdate
- type Authorizer
- type Axis
- type BackupService
- type Bucket
- type BucketFilter
- type BucketOperationLogService
- type BucketService
- type BucketType
- type BucketUpdate
- type BuildInfo
- type BuilderConfig
- type CRUDLog
- type CRUDLogSetter
- type Cell
- type CellProperty
- type CellUpdate
- type Check
- type CheckCreate
- type CheckFilter
- type CheckService
- type CheckUpdate
- type CheckViewProperties
- type ChronografError
- type DBRPMapping
- type DBRPMappingFilter
- type DBRPMappingService
- type Dashboard
- type DashboardFilter
- type DashboardMeta
- type DashboardOperationLogService
- type DashboardQuery
- type DashboardService
- type DashboardUpdate
- type DecimalPlaces
- type DeleteService
- type Document
- type DocumentDecorator
- type DocumentFindOptions
- type DocumentIndex
- type DocumentMeta
- type DocumentService
- type DocumentStore
- type Duration
- type EmptyViewProperties
- type Error
- func ErrFluxParseError(err error) *Error
- func ErrInternalBucketServiceError(op string, err error) *Error
- func ErrInternalOrgServiceError(op string, err error) *Error
- func ErrInternalTaskServiceError(err error) *Error
- func ErrJsonMarshalError(err error) *Error
- func ErrQueryError(err error) *Error
- func ErrResultIteratorError(err error) *Error
- func ErrRunExecutionError(err error) *Error
- func ErrTaskConcurrencyLimitReached(runsInFront int) *Error
- func ErrTaskOptionParse(err error) *Error
- func ErrTaskTimeParse(err error) *Error
- func ErrUnexpectedTaskBucketErr(err error) *Error
- func NewError(options ...func(*Error)) *Error
- type FindOptions
- type GaugeViewProperties
- type HTTPErrorHandler
- type HeatmapViewProperties
- type HistogramViewProperties
- type ID
- type IDGenerator
- type KVBackupService
- type KeyValueLog
- type Label
- type LabelFilter
- type LabelMapping
- type LabelMappingFilter
- type LabelService
- type LabelUpdate
- type Lease
- type Legend
- type Limit
- type LinePlusSingleStatProperties
- type Log
- type LogColumnSetting
- type LogFilter
- type LogViewProperties
- type LogViewerColumn
- type LookupService
- type MappingType
- type MarkdownViewProperties
- type NotificationEndpoint
- type NotificationEndpointFilter
- type NotificationEndpointService
- type NotificationEndpointUpdate
- type NotificationRule
- type NotificationRuleCreate
- type NotificationRuleFilter
- type NotificationRuleStore
- type NotificationRuleUpdate
- type OnboardingRequest
- type OnboardingResults
- type OnboardingService
- type OperationLogEntry
- type Operator
- type Organization
- type OrganizationFilter
- type OrganizationOperationLogService
- type OrganizationService
- type OrganizationUpdate
- type PagingFilter
- type PagingLinks
- type PasswordsService
- type Permission
- func MePermissions(userID ID) []Permission
- func MemberBucketPermission(bucketID ID) Permission
- func MemberPermissions(orgID ID) []Permission
- func NewGlobalPermission(a Action, rt ResourceType) (*Permission, error)
- func NewPermission(a Action, rt ResourceType, orgID ID) (*Permission, error)
- func NewPermissionAtID(id ID, a Action, rt ResourceType, orgID ID) (*Permission, error)
- func NewResourcePermission(a Action, rt ResourceType, rid ID) (*Permission, error)
- func OperPermissions() []Permission
- func OwnerPermissions(orgID ID) []Permission
- func ReadAllPermissions() []Permission
- type Predicate
- type RealTimeGenerator
- type RenamableField
- type RequestStillQueuedError
- type Resource
- type ResourceType
- type Run
- type RunFilter
- type RunStatus
- type ScatterViewProperties
- type ScraperTarget
- type ScraperTargetFilter
- type ScraperTargetStoreService
- type ScraperType
- type SecretField
- type SecretService
- type Semaphore
- type Session
- type SessionService
- type SingleStatViewProperties
- type Source
- type SourceFields
- type SourceQuery
- type SourceService
- type SourceType
- type SourceUpdate
- type Status
- type TableOptions
- type TableViewProperties
- type Tag
- type TagRule
- type Task
- type TaskCreate
- type TaskFilter
- type TaskService
- type TaskStatus
- type TaskUpdate
- type TelegrafConfig
- type TelegrafConfigFilter
- type TelegrafConfigStore
- type TenantService
- type TimeGenerator
- type Timespan
- type TokenGenerator
- type Usage
- type UsageFilter
- type UsageMetric
- type UsageService
- type User
- type UserFilter
- type UserOperationLogService
- type UserResourceMapping
- type UserResourceMappingFilter
- type UserResourceMappingService
- type UserService
- type UserStatus
- type UserType
- type UserUpdate
- type V1SourceFields
- type Variable
- type VariableArguments
- type VariableConstantValues
- type VariableFilter
- type VariableMapValues
- type VariableQueryValues
- type VariableService
- type VariableUpdate
- type View
- type ViewColor
- type ViewContents
- type ViewContentsUpdate
- type ViewFilter
- type ViewProperties
- type ViewUpdate
- type WriteService
- type XYViewProperties
Constants ¶
const ( OpFindAuthorizationByID = "FindAuthorizationByID" OpFindAuthorizationByToken = "FindAuthorizationByToken" OpFindAuthorizations = "FindAuthorizations" OpCreateAuthorization = "CreateAuthorization" OpUpdateAuthorization = "UpdateAuthorization" OpDeleteAuthorization = "DeleteAuthorization" )
auth service op
const ( // AuthorizationsResourceType gives permissions to one or more authorizations. AuthorizationsResourceType = ResourceType("authorizations") // 0 // BucketsResourceType gives permissions to one or more buckets. BucketsResourceType = ResourceType("buckets") // 1 // DashboardsResourceType gives permissions to one or more dashboards. DashboardsResourceType = ResourceType("dashboards") // 2 // OrgsResourceType gives permissions to one or more orgs. OrgsResourceType = ResourceType("orgs") // 3 // SourcesResourceType gives permissions to one or more sources. SourcesResourceType = ResourceType("sources") // 4 // TasksResourceType gives permissions to one or more tasks. TasksResourceType = ResourceType("tasks") // 5 // TelegrafsResourceType type gives permissions to a one or more telegrafs. TelegrafsResourceType = ResourceType("telegrafs") // 6 // UsersResourceType gives permissions to one or more users. UsersResourceType = ResourceType("users") // 7 // VariablesResourceType gives permission to one or more variables. VariablesResourceType = ResourceType("variables") // 8 // ScraperResourceType gives permission to one or more scrapers. ScraperResourceType = ResourceType("scrapers") // 9 // SecretsResourceType gives permission to one or more secrets. SecretsResourceType = ResourceType("secrets") // 10 // LabelsResourceType gives permission to one or more labels. LabelsResourceType = ResourceType("labels") // 11 // ViewsResourceType gives permission to one or more views. ViewsResourceType = ResourceType("views") // 12 // DocumentsResourceType gives permission to one or more documents. DocumentsResourceType = ResourceType("documents") // 13 // NotificationRuleResourceType gives permission to one or more notificationRules. NotificationRuleResourceType = ResourceType("notificationRules") // 14 // NotificationEndpointResourceType gives permission to one or more notificationEndpoints. NotificationEndpointResourceType = ResourceType("notificationEndpoints") // 15 // ChecksResourceType gives permission to one or more Checks. ChecksResourceType = ResourceType("checks") // 16 )
const ( // TasksSystemBucketID is the fixed ID for our tasks system bucket TasksSystemBucketID = ID(10) // MonitoringSystemBucketID is the fixed ID for our monitoring system bucket MonitoringSystemBucketID = ID(11) // BucketTypeUser is a user created bucket BucketTypeUser = BucketType(0) // BucketTypeSystem is an internally created bucket that cannot be deleted/renamed. BucketTypeSystem = BucketType(1) // MonitoringSystemBucketRetention is the time we should retain monitoring system bucket information MonitoringSystemBucketRetention = time.Hour * 24 * 7 // TasksSystemBucketRetention is the time we should retain task system bucket information TasksSystemBucketRetention = time.Hour * 24 * 3 )
const ( TasksSystemBucketName = "_tasks" MonitoringSystemBucketName = "_monitoring" )
Bucket names constants
const ( CheckDefaultPageSize = 100 CheckMaxPageSize = 500 )
consts for checks config.
const ( OpFindDashboardByID = "FindDashboardByID" OpFindDashboards = "FindDashboards" OpCreateDashboard = "CreateDashboard" OpUpdateDashboard = "UpdateDashboard" OpAddDashboardCell = "AddDashboardCell" OpRemoveDashboardCell = "RemoveDashboardCell" OpUpdateDashboardCell = "UpdateDashboardCell" OpGetDashboardCellView = "GetDashboardCellView" OpUpdateDashboardCellView = "UpdateDashboardCellView" OpDeleteDashboard = "DeleteDashboard" OpReplaceDashboardCells = "ReplaceDashboardCells" )
ops for dashboard service.
const ( ViewPropertyTypeCheck = "check" ViewPropertyTypeGauge = "gauge" ViewPropertyTypeHeatMap = "heatmap" ViewPropertyTypeHistogram = "histogram" ViewPropertyTypeLogViewer = "log-viewer" ViewPropertyTypeMarkdown = "markdown" ViewPropertyTypeScatter = "scatter" ViewPropertyTypeSingleStat = "single-stat" ViewPropertyTypeSingleStatPlusLine = "line-plus-single-stat" ViewPropertyTypeTable = "table" ViewPropertyTypeXY = "xy" )
Values for all supported view property types.
const ( EInternal = "internal error" ENotFound = "not found" EConflict = "conflict" // action cannot be performed EInvalid = "invalid" // validation failed EUnprocessableEntity = "unprocessable entity" // data type is correct, but out of range EEmptyValue = "empty value" EForbidden = "forbidden" ETooManyRequests = "too many requests" EMethodNotAllowed = "method not allowed" ETooLarge = "request too large" )
Some error code constant, ideally we want define common platform codes here projects on use platform's error, should have their own central place like this. Any time this set of constants changes, you must also update the swagger for Error.properties.code.enum.
const ( OpFindLabels = "FindLabels" OpFindLabelByID = "FindLabelByID" OpFindLabelMapping = "FindLabelMapping" OpCreateLabel = "CreateLabel" OpCreateLabelMapping = "CreateLabelMapping" OpUpdateLabel = "UpdateLabel" OpDeleteLabel = "DeleteLabel" OpDeleteLabelMapping = "DeleteLabelMapping" )
const ( OrgIDLength = 8 BucketIDLength = 8 MeasurementLength = OrgIDLength + BucketIDLength )
Length of components of measurement names.
const ( OpFindOrganizationByID = "FindOrganizationByID" OpFindOrganization = "FindOrganization" OpFindOrganizations = "FindOrganizations" OpCreateOrganization = "CreateOrganization" OpPutOrganization = "PutOrganization" OpUpdateOrganization = "UpdateOrganization" OpDeleteOrganization = "DeleteOrganization" )
ops for orgs error and orgs op logs.
const ( DefaultPageSize = 20 MaxPageSize = 100 )
const ( OpListTargets = "ListTargets" OpAddTarget = "AddTarget" OpGetTargetByID = "GetTargetByID" OpRemoveTarget = "RemoveTarget" OpUpdateTarget = "UpdateTarget" )
ops for ScraperTarget Store
const ( // V2SourceType is an InfluxDBv2 type. V2SourceType = "v2" // V1SourceType is an InfluxDBv1 type. V1SourceType = "v1" // SelfSourceType is the source hosting the UI. SelfSourceType = "self" )
const ( OpDefaultSource = "DefaultSource" OpFindSourceByID = "FindSourceByID" OpFindSources = "FindSources" OpCreateSource = "CreateSource" OpUpdateSource = "UpdateSource" OpDeleteSource = "DeleteSource" )
ops for sources.
const ( TaskDefaultPageSize = 100 TaskMaxPageSize = 500 TaskStatusActive = "active" TaskStatusInactive = "inactive" )
const ( ErrTelegrafConfigInvalidOrgID = "invalid org ID" // ErrTelegrafConfigInvalidOrgID is the error message for a missing or invalid organization ID. ErrTelegrafConfigNotFound = "telegraf configuration not found" // ErrTelegrafConfigNotFound is the error message for a missing telegraf config. ErrTelegrafPluginNameUnmatch = "the telegraf plugin is name %s doesn't match the config %s" ErrNoTelegrafPlugins = "there is no telegraf plugin in the config" ErrUnsupportTelegrafPluginType = "unsupported telegraf plugin type %s" ErrUnsupportTelegrafPluginName = "unsupported telegraf plugin %s, type %s" )
const ( OpFindUserByID = "FindUserByID" OpFindUser = "FindUser" OpFindUsers = "FindUsers" OpCreateUser = "CreateUser" OpUpdateUser = "UpdateUser" OpDeleteUser = "DeleteUser" )
Ops for user errors and op log.
const ( UserMappingType = 0 OrgMappingType = 1 )
const ( OpFindVariableByID = "FindVariableByID" OpFindVariables = "FindVariables" OpCreateVariable = "CreateVariable" OpUpdateVariable = "UpdateVariable" OpReplaceVariable = "ReplaceVariable" OpDeleteVariable = "DeleteVariable" )
ops for variable error.
const AuthorizationKind = "authorization"
AuthorizationKind is returned by (*Authorization).Kind().
const DefaultLeaseTTL = time.Minute
DefaultLeaseTTL is used when a specific lease TTL is not requested.
const ErrCellNotFound = "cell not found"
ErrCellNotFound is the error msg for a missing cell.
const ErrDashboardNotFound = "dashboard not found"
ErrDashboardNotFound is the error msg for a missing dashboard.
const ErrDocumentNotFound = "document not found"
ErrDocumentNotFound is the error msg for a missing document.
const ErrLabelNotFound = "label not found"
ErrLabelNotFound is the error for a missing Label.
const ErrScraperTargetNotFound = "scraper target not found"
ErrScraperTargetNotFound is the error msg for a missing scraper target.
const ErrSecretNotFound = "secret not found"
ErrSecretNotFound is the error msg for a missing secret.
const ErrSessionExpired = "session has expired"
ErrSessionExpired is the error message for expired sessions.
const ErrSessionNotFound = "session not found"
ErrSessionNotFound is the error messages for a missing sessions.
const (
// ErrSourceNotFound is an error message when a source does not exist.
ErrSourceNotFound = "source not found"
)
const ErrVariableNotFound = "variable not found"
ErrVariableNotFound is the error msg for a missing variable.
const ErrViewNotFound = "view not found"
ErrViewNotFound is the error msg for a missing View.
const IDLength = 16
IDLength is the exact length a string (or a byte slice representing it) must have in order to be decoded into a valid ID.
const InfiniteRetention = 0
InfiniteRetention is default infinite retention period.
const (
// PrometheusScraperType parses metrics from a prometheus endpoint.
PrometheusScraperType = "prometheus"
)
Scraper types
const SessionAuthorizionKind = "session"
SessionAuthorizionKind defines the type of authorizer
Variables ¶
var ( // ErrAuthorizerNotSupported notes that the provided authorizer is not supported for the action you are trying to perform. ErrAuthorizerNotSupported = errors.New("your authorizer is not supported, please use *platform.Authorization as authorizer") // ErrInvalidResourceType notes that the provided resource is invalid ErrInvalidResourceType = errors.New("unknown resource type for permission") // ErrInvalidAction notes that the provided action is invalid ErrInvalidAction = errors.New("unknown action for permission") )
var ( OpFindBucketByID = "FindBucketByID" OpFindBucket = "FindBucket" OpFindBuckets = "FindBuckets" OpCreateBucket = "CreateBucket" OpPutBucket = "PutBucket" OpUpdateBucket = "UpdateBucket" OpDeleteBucket = "DeleteBucket" )
ops for buckets error and buckets op logs.
var ( OpFindCheckByID = "FindCheckByID" OpFindCheck = "FindCheck" OpFindChecks = "FindChecks" OpCreateCheck = "CreateCheck" OpUpdateCheck = "UpdateCheck" OpDeleteCheck = "DeleteCheck" )
ops for checks error
var ( // ErrInvalidID signifies invalid IDs. ErrInvalidID = &Error{ Code: EInvalid, Msg: "invalid ID", } // ErrInvalidIDLength is returned when an ID has the incorrect number of bytes. ErrInvalidIDLength = &Error{ Code: EInvalid, Msg: "id must have a length of 16 bytes", } )
var ( // ErrLabelNameisEmpty is error when org name is empty ErrLabelNameisEmpty = &Error{ Code: EInvalid, Msg: "label name is empty", } // ErrLabelExistsOnResource is used when attempting to add a label to a resource // when that label already exists on the resource ErrLabelExistsOnResource = &Error{ Code: EConflict, Msg: "Cannot add label, label already exists on resource", } )
errors on label
var ( OpFindNotificationEndpointByID = "FindNotificationEndpointByID" OpFindNotificationEndpoint = "FindNotificationEndpoint" OpFindNotificationEndpoints = "FindNotificationEndpoints" OpCreateNotificationEndpoint = "CreateNotificationEndpoint" OpUpdateNotificationEndpoint = "UpdateNotificationEndpoint" OpDeleteNotificationEndpoint = "DeleteNotificationEndpoint" )
ops for checks error
var ( // OpFindSession represents the operation that looks for sessions. OpFindSession = "FindSession" // OpExpireSession represents the operation that expires sessions. OpExpireSession = "ExpireSession" // OpCreateSession represents the operation that creates a session for a given user. OpCreateSession = "CreateSession" // OpRenewSession = "RenewSession" OpRenewSession = "RenewSession" )
var ( // ErrRunCanceled is returned from the RunResult when a Run is Canceled. It is used mostly internally. ErrRunCanceled = &Error{ Code: EInternal, Msg: "run canceled", } // ErrTaskNotClaimed is returned when attempting to operate against a task that must be claimed but is not. ErrTaskNotClaimed = &Error{ Code: EConflict, Msg: "task not claimed", } // ErrTaskAlreadyClaimed is returned when attempting to operate against a task that must not be claimed but is. ErrTaskAlreadyClaimed = &Error{ Code: EConflict, Msg: "task already claimed", } // ErrNoRunsFound is returned when searching for a range of runs, but none are found. ErrNoRunsFound = &Error{ Code: ENotFound, Msg: "no matching runs found", } // ErrInvalidTaskID error object for bad id's ErrInvalidTaskID = &Error{ Code: EInvalid, Msg: "invalid id", } // ErrTaskNotFound indicates no task could be found for given parameters. ErrTaskNotFound = &Error{ Code: ENotFound, Msg: "task not found", } // ErrRunNotFound is returned when searching for a single run that doesn't exist. ErrRunNotFound = &Error{ Code: ENotFound, Msg: "run not found", } ErrRunKeyNotFound = &Error{ Code: ENotFound, Msg: "run key not found", } ErrPageSizeTooSmall = &Error{ Msg: "cannot have negative page limit", Code: EInvalid, } ErrPageSizeTooLarge = &Error{ Msg: fmt.Sprintf("cannot use page size larger then %d", MaxPageSize), Code: EInvalid, } ErrOrgNotFound = &Error{ Msg: "organization not found", Code: ENotFound, } ErrTaskRunAlreadyQueued = &Error{ Msg: "run already queued", Code: EConflict, } // ErrOutOfBoundsLimit is returned with FindRuns is called with an invalid filter limit. ErrOutOfBoundsLimit = &Error{ Code: EUnprocessableEntity, Msg: "run limit is out of bounds, must be between 1 and 500", } // ErrInvalidOwnerID is called when trying to create a task with out a valid ownerID ErrInvalidOwnerID = &Error{ Code: EInvalid, Msg: "cannot create task with invalid ownerID", } )
var ( OpFindTelegrafConfigByID = "FindTelegrafConfigByID" OpFindTelegrafConfigs = "FindTelegrafConfigs" OpCreateTelegrafConfig = "CreateTelegrafConfig" OpUpdateTelegrafConfig = "UpdateTelegrafConfig" OpDeleteTelegrafConfig = "DeleteTelegrafConfig" )
ops for buckets error and buckets op logs.
var ( // ErrInvalidUserType notes that the provided UserType is invalid ErrInvalidUserType = errors.New("unknown user type") // ErrInvalidMappingType notes that the provided MappingType is invalid ErrInvalidMappingType = errors.New("unknown mapping type") // ErrUserIDRequired notes that the ID was not provided ErrUserIDRequired = errors.New("user id is required") // ErrResourceIDRequired notes that the provided ID was not provided ErrResourceIDRequired = errors.New("resource id is required") )
var AllResourceTypes = []ResourceType{ AuthorizationsResourceType, BucketsResourceType, DashboardsResourceType, OrgsResourceType, SourcesResourceType, TasksResourceType, TelegrafsResourceType, UsersResourceType, VariablesResourceType, ScraperResourceType, SecretsResourceType, LabelsResourceType, ViewsResourceType, DocumentsResourceType, NotificationRuleResourceType, NotificationEndpointResourceType, ChecksResourceType, }
AllResourceTypes is the list of all known resource types.
var DefaultDashboardFindOptions = FindOptions{
SortBy: "ID",
}
DefaultDashboardFindOptions are the default find options for dashboards
var DefaultOperationLogFindOptions = FindOptions{ Descending: true, Limit: 100, }
DefaultOperationLogFindOptions are the default options for the operation log.
var DefaultSessionLength = time.Hour
DefaultSessionLength is the default session length on initial creation.
var DefaultSourceFindOptions = FindOptions{}
DefaultSourceFindOptions are the default find options for sources
var DefaultVariableFindOptions = FindOptions{}
DefaultVariableFindOptions are the default find options for variables.
var ( // ErrInvalidNotificationEndpointType denotes that the provided NotificationEndpoint is not a valid type ErrInvalidNotificationEndpointType = errors.New("unknown notification endpoint type") )
var ErrInvalidOrgFilter = &Error{ Code: EInvalid, Msg: "Please provide either orgID or org", }
ErrInvalidOrgFilter is the error indicate org filter is empty
var ErrNoAcquire = errors.New("ownership not acquired")
ErrNoAcquire is returned when it was not possible to acquire ownership of the semaphore.
var ( // ErrOrgNameisEmpty is error when org name is empty ErrOrgNameisEmpty = &Error{ Code: EInvalid, Msg: "org name is empty", } )
errors of org
var ErrUnableToCreateToken = &Error{ Msg: "unable to create token", Code: EInvalid, }
ErrUnableToCreateToken sanitized error message for all errors when a user cannot create a token
var OrgResourceTypes = []ResourceType{ BucketsResourceType, DashboardsResourceType, SourcesResourceType, TasksResourceType, TelegrafsResourceType, UsersResourceType, VariablesResourceType, SecretsResourceType, DocumentsResourceType, NotificationRuleResourceType, NotificationEndpointResourceType, ChecksResourceType, }
OrgResourceTypes is the list of all known resource types that belong to an organization.
var RenewSessionTime = time.Duration(time.Second * 300)
RenewSessionTime is the the time to extend session, currently set to 5min.
var (
// TaskSystemType is the type set in tasks' for all crud requests
TaskSystemType = "system"
)
Functions ¶
func CreateMeasurement ¶
CreateMeasurement returns 16 bytes that represent a measurement.
If either org or bucket are short then an error is returned, otherwise the first 8 bytes of each are combined and returned.
func ErrorCode ¶
ErrorCode returns the code of the root error, if available; otherwise returns EINTERNAL.
func ErrorMessage ¶
ErrorMessage returns the human-readable message of the error, if available. Otherwise returns a generic error message.
func FindOptionParams ¶
func FindOptionParams(opts ...FindOptions) [][2]string
func FindTaskAuthRequired ¶
FindTaskAuthRequired retrieves the taskAuth hint
func FindTaskWithoutAuth ¶
TODO: these are temporary functions until we can work through optimizing auth FindTaskWithAuth adds a auth hint for lookup of tasks
func MarshalViewPropertiesJSON ¶
func MarshalViewPropertiesJSON(v ViewProperties) ([]byte, error)
MarshalViewPropertiesJSON encodes a view into JSON bytes.
func NewBuilderTag ¶
func NewBuilderTag(key string, functionType string, values ...string) struct { Key string `json:"key"` Values []string `json:"values"` AggregateFunctionType string `json:"aggregateFunctionType"` }
NewBuilderTag is a constructor for the builder config types. This isn't technically required, but working with struct literals with embedded struct tags is really painful. This is to get around that bit. Would be nicer to have these as actual types maybe.
func PermissionAllowed ¶
func PermissionAllowed(perm Permission, ps []Permission) bool
PermissionAllowed determines if a permission is allowed.
func ReadMeasurement ¶
ReadMeasurement reads the provided measurement name and returns an Org ID and bucket ID. It returns an error if the provided name has an invalid length.
ReadMeasurement does not allocate, and instead returns sub-slices of name, so callers should be careful about subsequent mutations to the provided name slice.
func SetBuildInfo ¶
func SetBuildInfo(version, commit, date string)
SetBuildInfo sets the build information for the binary.
func SortDashboards ¶
func SortDashboards(opts FindOptions, ds []*Dashboard)
SortDashboards sorts a slice of dashboards by a field.
func ValidScraperType ¶
ValidScraperType returns true is the type string is valid
func WhereOrg ¶
func WhereOrg(org string) func(DocumentIndex, DocumentDecorator) ([]ID, error)
WhereOrg retrieves a list of the ids of the documents that belong to the provided org.
func WhereOrgID ¶
func WhereOrgID(orgID ID) func(DocumentIndex, DocumentDecorator) ([]ID, error)
WhereOrgID retrieves a list of the ids of the documents that belong to the provided orgID.
func WithErrorCode ¶
WithErrorCode sets the code on the error.
func WithErrorErr ¶
WithErrorErr sets the err on the error.
func WithErrorMsg ¶
WithErrorMsg sets the message on the error.
func WithErrorOp ¶
WithErrorOp sets the message on the error.
Types ¶
type AddDashboardCellOptions ¶
type AddDashboardCellOptions struct {
View *View
}
AddDashboardCellOptions are options for adding a dashboard.
type Authorization ¶
type Authorization struct { ID ID `json:"id"` Token string `json:"token"` Status Status `json:"status"` Description string `json:"description"` OrgID ID `json:"orgID"` UserID ID `json:"userID,omitempty"` Permissions []Permission `json:"permissions"` CRUDLog }
Authorization is an authorization. 🎉
func (*Authorization) Allowed ¶
func (a *Authorization) Allowed(p Permission) bool
Allowed returns true if the authorization is active and request permission exists in the authorization's list of permissions.
func (*Authorization) GetUserID ¶
func (a *Authorization) GetUserID() ID
GetUserID returns the user id.
func (*Authorization) Identifier ¶
func (a *Authorization) Identifier() ID
Identifier returns the authorizations ID and is used for auditing.
func (*Authorization) IsActive ¶
func (a *Authorization) IsActive() bool
IsActive returns true if the authorization active.
func (*Authorization) Kind ¶
func (a *Authorization) Kind() string
Kind returns session and is used for auditing.
func (*Authorization) Valid ¶
func (a *Authorization) Valid() error
Valid ensures that the authorization is valid.
type AuthorizationFilter ¶
type AuthorizationFilter struct { Token *string ID *ID UserID *ID User *string OrgID *ID Org *string }
AuthorizationFilter represents a set of filter that restrict the returned results.
type AuthorizationService ¶
type AuthorizationService interface { // Returns a single authorization by ID. FindAuthorizationByID(ctx context.Context, id ID) (*Authorization, error) // Returns a single authorization by Token. FindAuthorizationByToken(ctx context.Context, t string) (*Authorization, error) // Returns a list of authorizations that match filter and the total count of matching authorizations. // Additional options provide pagination & sorting. FindAuthorizations(ctx context.Context, filter AuthorizationFilter, opt ...FindOptions) ([]*Authorization, int, error) // Creates a new authorization and sets a.Token and a.UserID with the new identifier. CreateAuthorization(ctx context.Context, a *Authorization) error // UpdateAuthorization updates the status and description if available. UpdateAuthorization(ctx context.Context, id ID, upd *AuthorizationUpdate) (*Authorization, error) // Removes a authorization by token. DeleteAuthorization(ctx context.Context, id ID) error }
AuthorizationService represents a service for managing authorization data.
type AuthorizationUpdate ¶
type AuthorizationUpdate struct { Status *Status `json:"status,omitempty"` Description *string `json:"description,omitempty"` }
AuthorizationUpdate is the authorization update request.
type Authorizer ¶
type Authorizer interface { // Allowed returns true is the associated permission is allowed by the authorizer Allowed(p Permission) bool // ID returns an identifier used for auditing. Identifier() ID // GetUserID returns the user id. GetUserID() ID // Kind metadata for auditing. Kind() string }
Authorizer will authorize a permission.
type Axis ¶
type Axis struct { Bounds []string `json:"bounds"` // bounds are an arbitrary list of client-defined strings that specify the viewport for a View LegacyBounds [2]int64 `json:"-"` // legacy bounds are for testing a migration from an earlier version of axis Label string `json:"label"` // label is a description of this Axis Prefix string `json:"prefix"` // Prefix represents a label prefix for formatting axis values Suffix string `json:"suffix"` // Suffix represents a label suffix for formatting axis values Base string `json:"base"` // Base represents the radix for formatting axis values Scale string `json:"scale"` // Scale is the axis formatting scale. Supported: "log", "linear" }
Axis represents the visible extents of a visualization
type BackupService ¶
type BackupService interface { // CreateBackup creates a local copy (hard links) of the TSM data for all orgs and buckets. // The return values are used to download each backup file. CreateBackup(context.Context) (backupID int, backupFiles []string, err error) // FetchBackupFile downloads one backup file, data or metadata. FetchBackupFile(ctx context.Context, backupID int, backupFile string, w io.Writer) error // InternalBackupPath is a utility to determine the on-disk location of a backup fileset. InternalBackupPath(backupID int) string }
BackupService represents the data backup functions of InfluxDB.
type Bucket ¶
type Bucket struct { ID ID `json:"id,omitempty"` OrgID ID `json:"orgID,omitempty"` Type BucketType `json:"type"` Name string `json:"name"` Description string `json:"description"` RetentionPolicyName string `json:"rp,omitempty"` // This to support v1 sources RetentionPeriod time.Duration `json:"retentionPeriod"` CRUDLog }
Bucket is a bucket. 🎉
type BucketFilter ¶
BucketFilter represents a set of filter that restrict the returned results.
func (BucketFilter) QueryParams ¶
func (f BucketFilter) QueryParams() map[string][]string
QueryParams Converts BucketFilter fields to url query params.
func (BucketFilter) String ¶
func (f BucketFilter) String() string
String returns a human-readable string of the BucketFilter, particularly useful for error messages.
type BucketOperationLogService ¶
type BucketOperationLogService interface { // GetBucketOperationLog retrieves the operation log for the bucket with the provided id. GetBucketOperationLog(ctx context.Context, id ID, opts FindOptions) ([]*OperationLogEntry, int, error) }
BucketOperationLogService is an interface for retrieving the operation log for a bucket.
type BucketService ¶
type BucketService interface { // FindBucketByID returns a single bucket by ID. FindBucketByID(ctx context.Context, id ID) (*Bucket, error) // FindBucket returns the first bucket that matches filter. FindBucket(ctx context.Context, filter BucketFilter) (*Bucket, error) // FindBuckets returns a list of buckets that match filter and the total count of matching buckets. // Additional options provide pagination & sorting. FindBuckets(ctx context.Context, filter BucketFilter, opt ...FindOptions) ([]*Bucket, int, error) // CreateBucket creates a new bucket and sets b.ID with the new identifier. CreateBucket(ctx context.Context, b *Bucket) error // UpdateBucket updates a single bucket with changeset. // Returns the new bucket state after update. UpdateBucket(ctx context.Context, id ID, upd BucketUpdate) (*Bucket, error) // DeleteBucket removes a bucket by ID. DeleteBucket(ctx context.Context, id ID) error FindBucketByName(ctx context.Context, orgID ID, name string) (*Bucket, error) }
BucketService represents a service for managing bucket data.
type BucketType ¶
type BucketType int
BucketType differentiates system buckets from user buckets.
func ParseBucketType ¶
func ParseBucketType(s string) BucketType
ParseBucketType parses a bucket type from a string
func (BucketType) String ¶
func (bt BucketType) String() string
String converts a BucketType into a human-readable string.
type BucketUpdate ¶
type BucketUpdate struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` RetentionPeriod *time.Duration `json:"retentionPeriod,omitempty"` }
BucketUpdate represents updates to a bucket. Only fields which are set are updated.
type BuildInfo ¶
type BuildInfo struct { Version string // Version is the current git tag with v prefix stripped Commit string // Commit is the current git commit SHA Date string // Date is the build date in RFC3339 }
BuildInfo represents the information about InfluxDB build.
func GetBuildInfo ¶
func GetBuildInfo() BuildInfo
GetBuildInfo returns the current build information for the binary.
type BuilderConfig ¶
type BuilderConfig 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"` }
func (BuilderConfig) MarshalJSON ¶
func (b BuilderConfig) MarshalJSON() ([]byte, error)
MarshalJSON is necessary for the time being. UI keeps breaking b/c it relies on these slices being populated/not nil. Other consumers may have same issue.
type CRUDLog ¶
type CRUDLog struct { CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
CRUDLog is the struct to store crud related ops.
func (*CRUDLog) SetCreatedAt ¶
SetCreatedAt set the created time.
func (*CRUDLog) SetUpdatedAt ¶
SetUpdatedAt set the updated time.
type CRUDLogSetter ¶
CRUDLogSetter is the interface to set the crudlog.
type Cell ¶
type Cell struct { ID ID `json:"id,omitempty"` CellProperty View *View `json:"-"` }
Cell holds positional information about a cell on dashboard and a reference to a cell.
func (*Cell) UnmarshalJSON ¶
type CellProperty ¶
type CellProperty struct { X int32 `json:"x"` Y int32 `json:"y"` W int32 `json:"w"` H int32 `json:"h"` }
CellProperty contains the properties of a cell.
type CellUpdate ¶
type CellUpdate struct { X *int32 `json:"x"` Y *int32 `json:"y"` W *int32 `json:"w"` H *int32 `json:"h"` }
CellUpdate is the patch structure for a cell.
func (CellUpdate) Apply ¶
func (u CellUpdate) Apply(c *Cell) error
Apply applies an update to a Cell.
func (CellUpdate) Valid ¶
func (u CellUpdate) Valid() *Error
Valid returns an error if the cell update is invalid.
type Check ¶
type Check interface { Valid() error Type() string ClearPrivateData() SetTaskID(ID) GetTaskID() ID GetOwnerID() ID SetOwnerID(ID) GenerateFlux() (string, error) json.Marshaler CRUDLogSetter SetID(id ID) SetOrgID(id ID) SetName(name string) SetDescription(description string) GetID() ID GetCRUDLog() CRUDLog GetOrgID() ID GetName() string GetDescription() string }
Check represents the information required to generate a periodic check task.
type CheckCreate ¶
CheckCreate represent data to create a new Check
type CheckFilter ¶
type CheckFilter struct { ID *ID Name *string OrgID *ID Org *string UserResourceMappingFilter }
CheckFilter represents a set of filters that restrict the returned results.
func (CheckFilter) QueryParams ¶
func (f CheckFilter) QueryParams() map[string][]string
QueryParams Converts CheckFilter fields to url query params.
type CheckService ¶
type CheckService interface { // UserResourceMappingService must be part of all NotificationRuleStore service, // for create, search, delete. UserResourceMappingService // OrganizationService is needed for search filter OrganizationService // FindCheckByID returns a single check by ID. FindCheckByID(ctx context.Context, id ID) (Check, error) // FindCheck returns the first check that matches filter. FindCheck(ctx context.Context, filter CheckFilter) (Check, error) // FindChecks returns a list of checks that match filter and the total count of matching checks. // Additional options provide pagination & sorting. FindChecks(ctx context.Context, filter CheckFilter, opt ...FindOptions) ([]Check, int, error) // CreateCheck creates a new check and sets b.ID with the new identifier. CreateCheck(ctx context.Context, c CheckCreate, userID ID) error // UpdateCheck updates the whole check. // Returns the new check state after update. UpdateCheck(ctx context.Context, id ID, c CheckCreate) (Check, error) // PatchCheck updates a single bucket with changeset. // Returns the new check state after update. PatchCheck(ctx context.Context, id ID, upd CheckUpdate) (Check, error) // DeleteCheck will delete the check by id. DeleteCheck(ctx context.Context, id ID) error }
CheckService represents a service for managing checks.
type CheckUpdate ¶
type CheckUpdate struct { Name *string `json:"name,omitempty"` Status *Status `json:"status,omitempty"` Description *string `json:"description,omitempty"` }
CheckUpdate are properties than can be updated on a check
func (*CheckUpdate) Valid ¶
func (n *CheckUpdate) Valid() error
Valid returns err is the update is invalid.
type CheckViewProperties ¶
type CheckViewProperties struct { Type string `json:"type"` CheckID string `json:"checkID"` Queries []DashboardQuery `json:"queries"` ViewColors []string `json:"colors"` }
CheckViewProperties represents options for a view representing a check
func (CheckViewProperties) GetType ¶
func (v CheckViewProperties) GetType() string
type ChronografError ¶
type ChronografError string
ChronografError is a domain error encountered while processing chronograf requests.
func (ChronografError) Error ¶
func (e ChronografError) Error() string
ChronografError returns the string of an error.
type DBRPMapping ¶
type DBRPMapping struct { Cluster string `json:"cluster"` Database string `json:"database"` RetentionPolicy string `json:"retention_policy"` // Default indicates if this mapping is the default for the cluster and database. Default bool `json:"default"` OrganizationID ID `json:"organization_id"` BucketID ID `json:"bucket_id"` }
DBRPMapping represents a mapping of a cluster, database and retention policy to an organization ID and bucket ID.
func (*DBRPMapping) Equal ¶
func (m *DBRPMapping) Equal(o *DBRPMapping) bool
Equal checks if the two mappings are identical.
func (DBRPMapping) Validate ¶
func (m DBRPMapping) Validate() error
Validate reports any validation errors for the mapping.
type DBRPMappingFilter ¶
type DBRPMappingFilter struct { Cluster *string Database *string RetentionPolicy *string Default *bool }
DBRPMappingFilter represents a set of filters that restrict the returned results by cluster, database and retention policy.
func (DBRPMappingFilter) String ¶
func (f DBRPMappingFilter) String() string
type DBRPMappingService ¶
type DBRPMappingService interface { // FindBy returns the dbrp mapping the for cluster, db and rp. FindBy(ctx context.Context, cluster, db, rp string) (*DBRPMapping, error) // Find returns the first dbrp mapping the matches the filter. Find(ctx context.Context, filter DBRPMappingFilter) (*DBRPMapping, error) // FindMany returns a list of dbrp mappings that match filter and the total count of matching dbrp mappings. FindMany(ctx context.Context, filter DBRPMappingFilter, opt ...FindOptions) ([]*DBRPMapping, int, error) // Create creates a new dbrp mapping, if a different mapping exists an error is returned. Create(ctx context.Context, dbrpMap *DBRPMapping) error // Delete removes a dbrp mapping. // Deleting a mapping that does not exists is not an error. Delete(ctx context.Context, cluster, db, rp string) error }
DBRPMappingService provides a mapping of cluster, database and retention policy to an organization ID and bucket ID.
type Dashboard ¶
type Dashboard struct { ID ID `json:"id,omitempty"` OrganizationID ID `json:"orgID,omitempty"` Name string `json:"name"` Description string `json:"description"` Cells []*Cell `json:"cells"` Meta DashboardMeta `json:"meta"` }
Dashboard represents all visual and query data for a dashboard.
type DashboardFilter ¶
DashboardFilter is a filter for dashboards.
func (DashboardFilter) QueryParams ¶
func (f DashboardFilter) QueryParams() map[string][]string
QueryParams turns a dashboard filter into query params
It implements PagingFilter.
type DashboardMeta ¶
type DashboardMeta struct { CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
DashboardMeta contains meta information about dashboards
type DashboardOperationLogService ¶
type DashboardOperationLogService interface { // GetDashboardOperationLog retrieves the operation log for the dashboard with the provided id. GetDashboardOperationLog(ctx context.Context, id ID, opts FindOptions) ([]*OperationLogEntry, int, error) }
DashboardOperationLogService is an interface for retrieving the operation log for a dashboard.
type DashboardQuery ¶
type DashboardQuery struct { Text string `json:"text"` EditMode string `json:"editMode"` // Either "builder" or "advanced" Name string `json:"name"` // Term or phrase that refers to the query BuilderConfig BuilderConfig `json:"builderConfig"` }
DashboardQuery represents a query used in a dashboard cell
type DashboardService ¶
type DashboardService interface { // FindDashboardByID returns a single dashboard by ID. FindDashboardByID(ctx context.Context, id ID) (*Dashboard, error) // FindDashboards returns a list of dashboards that match filter and the total count of matching dashboards. // Additional options provide pagination & sorting. FindDashboards(ctx context.Context, filter DashboardFilter, opts FindOptions) ([]*Dashboard, int, error) // CreateDashboard creates a new dashboard and sets b.ID with the new identifier. CreateDashboard(ctx context.Context, b *Dashboard) error // UpdateDashboard updates a single dashboard with changeset. // Returns the new dashboard state after update. UpdateDashboard(ctx context.Context, id ID, upd DashboardUpdate) (*Dashboard, error) // AddDashboardCell adds a cell to a dashboard. AddDashboardCell(ctx context.Context, id ID, c *Cell, opts AddDashboardCellOptions) error // RemoveDashboardCell removes a dashboard. RemoveDashboardCell(ctx context.Context, dashboardID, cellID ID) error // UpdateDashboardCell replaces the dashboard cell with the provided ID. UpdateDashboardCell(ctx context.Context, dashboardID, cellID ID, upd CellUpdate) (*Cell, error) // GetDashboardCellView retrieves a dashboard cells view. GetDashboardCellView(ctx context.Context, dashboardID, cellID ID) (*View, error) // UpdateDashboardCellView retrieves a dashboard cells view. UpdateDashboardCellView(ctx context.Context, dashboardID, cellID ID, upd ViewUpdate) (*View, error) // DeleteDashboard removes a dashboard by ID. DeleteDashboard(ctx context.Context, id ID) error // ReplaceDashboardCells replaces all cells in a dashboard ReplaceDashboardCells(ctx context.Context, id ID, c []*Cell) error }
DashboardService represents a service for managing dashboard data.
type DashboardUpdate ¶
type DashboardUpdate struct { Name *string `json:"name"` Description *string `json:"description"` Cells *[]*Cell `json:"cells"` }
DashboardUpdate is the patch structure for a dashboard.
func (DashboardUpdate) Apply ¶
func (u DashboardUpdate) Apply(d *Dashboard) error
Apply applies an update to a dashboard.
func (DashboardUpdate) Valid ¶
func (u DashboardUpdate) Valid() *Error
Valid returns an error if the dashboard update is invalid.
type DecimalPlaces ¶
DecimalPlaces indicates whether decimal places should be enforced, and how many digits it should show.
type DeleteService ¶
type DeleteService interface {
DeleteBucketRangePredicate(ctx context.Context, orgID, bucketID ID, min, max int64, pred Predicate) error
}
DeleteService will delete a bucket from the range and predict.
type Document ¶
type Document struct { ID ID `json:"id"` Meta DocumentMeta `json:"meta"` Content interface{} `json:"content,omitempty"` // TODO(desa): maybe this needs to be json.Marshaller & json.Unmarshaler Labels []*Label `json:"labels,omitempty"` // read only // This is needed for authorization. // The service that passes documents around will take care of filling it // via request parameters or others, as the kv store will take care of // filling it once it returns a document. // This is not stored in the kv store neither required in the API. Organizations map[ID]UserType `json:"-"` }
Document is a generic structure for stating data.
type DocumentDecorator ¶
type DocumentDecorator interface { IncludeContent() error IncludeLabels() error IncludeOrganizations() error }
DocumentDecorator passes information to the DocumentStore about the presentation of the data being retrieved.
type DocumentFindOptions ¶
type DocumentFindOptions func(DocumentIndex, DocumentDecorator) ([]ID, error)
DocumentFindOptions are used to lookup documents. TODO(desa): consider changing this to have a single struct that has both
the decorator and the index on it.
type DocumentIndex ¶
type DocumentIndex interface { GetAccessorsDocuments(ownerType string, ownerID ID) ([]ID, error) GetDocumentsAccessors(docID ID) ([]ID, error) UsersOrgs(userID ID) ([]ID, error) // IsOrgAccessor checks to see if the userID provided is allowed to access // the orgID privided. If the lookup is done in a writable operation // then this method should ensure that the user is an org owner. If the // operation is readable, then it should only require that the user is an org // member. IsOrgAccessor(userID, orgID ID) error // TODO(desa): support finding document by label FindOrganizationByName(n string) (ID, error) FindOrganizationByID(id ID) error FindLabelByID(id ID) error }
DocumentIndex is a structure that is used in DocumentFindOptions to filter out documents based on some criteria.
type DocumentMeta ¶
type DocumentMeta struct { Name string `json:"name"` Type string `json:"type,omitempty"` Description string `json:"description,omitempty"` Version string `json:"version,omitempty"` CRUDLog }
DocumentMeta is information that is universal across documents. Ideally data in the meta should be indexed and queryable.
type DocumentService ¶
type DocumentService interface { CreateDocumentStore(ctx context.Context, name string) (DocumentStore, error) FindDocumentStore(ctx context.Context, name string) (DocumentStore, error) }
DocumentService is used to create/find instances of document stores.
type DocumentStore ¶
type DocumentStore interface { CreateDocument(ctx context.Context, d *Document) error FindDocument(ctx context.Context, id ID) (*Document, error) UpdateDocument(ctx context.Context, d *Document) error DeleteDocument(ctx context.Context, id ID) error FindDocuments(ctx context.Context, opts ...DocumentFindOptions) ([]*Document, error) DeleteDocuments(ctx context.Context, opts ...DocumentFindOptions) error }
DocumentStore is used to perform CRUD operations on documents. It follows an options pattern that allows users to perform actions related to documents in a transactional way.
type Duration ¶
Duration is based on time.Duration to embed in any struct.
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface.
type EmptyViewProperties ¶
type EmptyViewProperties struct{}
EmptyViewProperties is visualization that has no values
func (EmptyViewProperties) GetType ¶
func (v EmptyViewProperties) GetType() string
type Error ¶
Error is the error struct of platform.
Errors may have error codes, human-readable messages, and a logical stack trace.
The Code targets automated handlers so that recovery can occur. Msg is used by the system operator to help diagnose and fix the problem. Op and Err chain errors together in a logical stack trace to further help operators.
To create a simple error,
&Error{ Code:ENotFound, }
To show where the error happens, add Op.
&Error{ Code: ENotFound, Op: "bolt.FindUserByID" }
To show an error with a unpredictable value, add the value in Msg.
&Error{ Code: EConflict, Message: fmt.Sprintf("organization with name %s already exist", aName), }
To show an error wrapped with another error.
&Error{ Code:EInternal, Err: err, }.
func ErrFluxParseError ¶
ErrFluxParseError is returned when an error is thrown by Flux.Parse in the task executor
func ErrJsonMarshalError ¶
func ErrQueryError ¶
ErrQueryError is returned when an error is thrown by Query service in the task executor
func ErrResultIteratorError ¶
ErrResultIteratorError is returned when an error is thrown by exhaustResultIterators in the executor
func ErrRunExecutionError ¶
func ErrTaskOptionParse ¶
func ErrTaskTimeParse ¶
ErrTaskTimeParse an error for time parsing errors
func ErrUnexpectedTaskBucketErr ¶
ErrUnexpectedTaskBucketErr a generic error we can use when we rail to retrieve a bucket
func (*Error) MarshalJSON ¶
MarshalJSON recursively marshals the stack of Err.
func (*Error) UnmarshalJSON ¶
UnmarshalJSON recursively unmarshals the error stack.
type FindOptions ¶
FindOptions represents options passed to all find methods with multiple results.
func DecodeFindOptions ¶
func DecodeFindOptions(r *http.Request) (*FindOptions, error)
DecodeFindOptions returns a FindOptions decoded from http request.
func (FindOptions) QueryParams ¶
func (f FindOptions) QueryParams() map[string][]string
QueryParams returns a map containing url query params.
type GaugeViewProperties ¶
type GaugeViewProperties struct { Type string `json:"type"` Queries []DashboardQuery `json:"queries"` Prefix string `json:"prefix"` TickPrefix string `json:"tickPrefix"` Suffix string `json:"suffix"` TickSuffix string `json:"tickSuffix"` ViewColors []ViewColor `json:"colors"` DecimalPlaces DecimalPlaces `json:"decimalPlaces"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` }
GaugeViewProperties represents options for gauge view in Chronograf
func (GaugeViewProperties) GetType ¶
func (v GaugeViewProperties) GetType() string
type HTTPErrorHandler ¶
type HTTPErrorHandler interface {
HandleHTTPError(ctx context.Context, err error, w http.ResponseWriter)
}
HTTPErrorHandler is the interface to handle http error.
type HeatmapViewProperties ¶
type HeatmapViewProperties struct { Type string `json:"type"` Queries []DashboardQuery `json:"queries"` ViewColors []string `json:"colors"` BinSize int32 `json:"binSize"` XColumn string `json:"xColumn"` YColumn string `json:"yColumn"` XDomain []float64 `json:"xDomain,omitempty"` YDomain []float64 `json:"yDomain,omitempty"` XAxisLabel string `json:"xAxisLabel"` YAxisLabel string `json:"yAxisLabel"` XPrefix string `json:"xPrefix"` XSuffix string `json:"xSuffix"` YPrefix string `json:"yPrefix"` YSuffix string `json:"ySuffix"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` TimeFormat string `json:"timeFormat"` }
HeatmapViewProperties represents options for heatmap view in Chronograf
func (HeatmapViewProperties) GetType ¶
func (v HeatmapViewProperties) GetType() string
type HistogramViewProperties ¶
type HistogramViewProperties struct { Type string `json:"type"` Queries []DashboardQuery `json:"queries"` ViewColors []ViewColor `json:"colors"` XColumn string `json:"xColumn"` FillColumns []string `json:"fillColumns"` XDomain []float64 `json:"xDomain,omitempty"` XAxisLabel string `json:"xAxisLabel"` Position string `json:"position"` BinCount int `json:"binCount"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` }
HistogramViewProperties represents options for histogram view in Chronograf
func (HistogramViewProperties) GetType ¶
func (v HistogramViewProperties) GetType() string
type ID ¶
type ID uint64
ID is a unique identifier.
Its zero value is not a valid ID.
func IDFromString ¶
IDFromString creates an ID from a given string.
It errors if the input string does not match a valid ID.
func IncludeContent ¶
func IncludeContent(_ DocumentIndex, dd DocumentDecorator) ([]ID, error)
IncludeContent signals to the DocumentStore that the content of the document should be included.
func IncludeLabels ¶
func IncludeLabels(_ DocumentIndex, dd DocumentDecorator) ([]ID, error)
IncludeLabels signals to the DocumentStore that the documents labels should be included.
func IncludeOrganizations ¶
func IncludeOrganizations(_ DocumentIndex, dd DocumentDecorator) ([]ID, error)
IncludeOwner signals to the DocumentStore that the owner should be included.
func (*ID) Decode ¶
Decode parses b as a hex-encoded byte-slice-string.
It errors if the input byte slice does not have the correct length or if it contains all zeros.
func (*ID) DecodeFromString ¶
DecodeFromString parses s as a hex-encoded string.
func (ID) Encode ¶
Encode converts ID to a hex-encoded byte-slice-string.
It errors if the receiving ID holds its zero value.
func (ID) GoString ¶
GoString formats the ID the same as the String method. Without this, when using the %#v verb, an ID would be printed as a uint64, so you would see e.g. 0x2def021097c6000 instead of 02def021097c6000 (note the leading 0x, which means the former doesn't show up in searches for the latter).
func (ID) MarshalText ¶
MarshalText encodes i as text. Providing this method is a fallback for json.Marshal, with the added benefit that IDs encoded as map keys will be the expected string encoding, rather than the effective fmt.Sprintf("%d", i) that json.Marshal uses by default for integer types.
func (ID) String ¶
String returns the ID as a hex encoded string.
Returns an empty string in the case the ID is invalid.
func (*ID) UnmarshalText ¶
UnmarshalText decodes i from a byte slice. Providing this method is also a fallback for json.Unmarshal, also relevant when IDs are used as map keys.
type IDGenerator ¶
type IDGenerator interface { // ID creates unique byte slice ID. ID() ID }
IDGenerator represents a generator for IDs.
type KVBackupService ¶
type KVBackupService interface { // Backup creates a live backup copy of the metadata database. Backup(ctx context.Context, w io.Writer) error }
KVBackupService represents the meta data backup functions of InfluxDB.
type KeyValueLog ¶
type KeyValueLog interface { // AddLogEntry adds an entry (v,t) to the log defined for the key k. AddLogEntry(ctx context.Context, k []byte, v []byte, t time.Time) error // ForEachLogEntry iterates through all the log entries at key k and applies the function fn for each record. ForEachLogEntry(ctx context.Context, k []byte, opts FindOptions, fn func(v []byte, t time.Time) error) error // FirstLogEntry is used to retrieve the first entry in the log at key k. FirstLogEntry(ctx context.Context, k []byte) ([]byte, time.Time, error) // LastLogEntry is used to retrieve the last entry in the log at key k. LastLogEntry(ctx context.Context, k []byte) ([]byte, time.Time, error) }
KeyValueLog is a generic type logs key-value pairs. This interface is intended to be used to construct other higher-level log-like resources such as an oplog or audit log.
The idea is to create a log who values can be accessed at the key k: k -> [(v0,t0) (v1,t1) ... (vn,tn)]
Logs may be retrieved in ascending or descending time order and support limits and offsets.
type Label ¶
type Label struct { ID ID `json:"id,omitempty"` OrgID ID `json:"orgID,omitempty"` Name string `json:"name"` Properties map[string]string `json:"properties,omitempty"` }
Label is a tag set on a resource, typically used for filtering on a UI.
type LabelFilter ¶
LabelFilter represents a set of filters that restrict the returned results.
type LabelMapping ¶
type LabelMapping struct { LabelID ID `json:"labelID"` ResourceID ID `json:"resourceID,omitempty"` ResourceType `json:"resourceType"` }
LabelMapping is used to map resource to its labels. It should not be shared directly over the HTTP API.
func (*LabelMapping) Validate ¶
func (l *LabelMapping) Validate() error
Validate returns an error if the mapping is invalid.
type LabelMappingFilter ¶
type LabelMappingFilter struct { ResourceID ID ResourceType }
LabelMappingFilter represents a set of filters that restrict the returned results.
type LabelService ¶
type LabelService interface { // FindLabelByID a single label by ID. FindLabelByID(ctx context.Context, id ID) (*Label, error) // FindLabels returns a list of labels that match a filter FindLabels(ctx context.Context, filter LabelFilter, opt ...FindOptions) ([]*Label, error) // FindResourceLabels returns a list of labels that belong to a resource FindResourceLabels(ctx context.Context, filter LabelMappingFilter) ([]*Label, error) // CreateLabel creates a new label CreateLabel(ctx context.Context, l *Label) error // CreateLabelMapping maps a resource to an existing label CreateLabelMapping(ctx context.Context, m *LabelMapping) error // UpdateLabel updates a label with a changeset. UpdateLabel(ctx context.Context, id ID, upd LabelUpdate) (*Label, error) // DeleteLabel deletes a label DeleteLabel(ctx context.Context, id ID) error // DeleteLabelMapping deletes a label mapping DeleteLabelMapping(ctx context.Context, m *LabelMapping) error }
LabelService represents a service for managing resource labels
type LabelUpdate ¶
type LabelUpdate struct { Name string `json:"name,omitempty"` Properties map[string]string `json:"properties,omitempty"` }
LabelUpdate represents a changeset for a label. Only the properties specified are updated.
type Lease ¶
type Lease interface { // TTL returns the duration of time remaining before the lease expires. TTL(context.Context) (time.Duration, error) // Release terminates ownership of the semaphore by revoking the lease. Release(context.Context) error // KeepAlive extends the lease back to the original TTL. KeepAlive(context.Context) error }
A Lease represents ownership over a semaphore. It gives the owner the ability to extend ownership over the semaphore or release ownership of the semaphore.
type Legend ¶
type Legend struct { Type string `json:"type,omitempty"` Orientation string `json:"orientation,omitempty"` }
Legend represents the encoding of data into a legend
type Limit ¶
type Limit struct { Rate int `json:"limit,omitempty"` // every seconds. Every int `json:"limitEvery,omitempty"` }
Limit don't notify me more than <limit> times every <limitEvery> seconds. If set, limit cannot be empty.
type LinePlusSingleStatProperties ¶
type LinePlusSingleStatProperties struct { Queries []DashboardQuery `json:"queries"` Axes map[string]Axis `json:"axes"` Type string `json:"type"` Legend Legend `json:"legend"` ViewColors []ViewColor `json:"colors"` Prefix string `json:"prefix"` Suffix string `json:"suffix"` DecimalPlaces DecimalPlaces `json:"decimalPlaces"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` XColumn string `json:"xColumn"` YColumn string `json:"yColumn"` ShadeBelow bool `json:"shadeBelow"` Position string `json:"position"` }
LinePlusSingleStatProperties represents options for line plus single stat view in Chronograf
func (LinePlusSingleStatProperties) GetType ¶
func (v LinePlusSingleStatProperties) GetType() string
type Log ¶
type Log struct { RunID ID `json:"runID,omitempty"` Time string `json:"time"` Message string `json:"message"` }
Log represents a link to a log resource
type LogColumnSetting ¶
type LogColumnSetting struct { Type string `json:"type"` Value string `json:"value"` Name string `json:"name,omitempty"` }
LogColumnSetting represent the settings for a specific column of a Log Viewer.
type LogFilter ¶
type LogFilter struct { // Task ID is required. Task ID // The optional Run ID limits logs to a single run. Run *ID }
LogFilter represents a set of filters that restrict the returned log results.
type LogViewProperties ¶
type LogViewProperties struct { Type string `json:"type"` Columns []LogViewerColumn `json:"columns"` }
LogViewProperties represents options for log viewer in Chronograf.
func (LogViewProperties) GetType ¶
func (v LogViewProperties) GetType() string
type LogViewerColumn ¶
type LogViewerColumn struct { Name string `json:"name"` Position int32 `json:"position"` Settings []LogColumnSetting `json:"settings"` }
LogViewerColumn represents a specific column in a Log Viewer.
type LookupService ¶
type LookupService interface { // Name returns the name for the resource and ID. Name(ctx context.Context, resource ResourceType, id ID) (string, error) }
LookupService provides field lookup for the resource and ID.
type MappingType ¶
type MappingType uint8
func (MappingType) MarshalJSON ¶
func (mt MappingType) MarshalJSON() ([]byte, error)
func (MappingType) String ¶
func (mt MappingType) String() string
func (*MappingType) UnmarshalJSON ¶
func (mt *MappingType) UnmarshalJSON(b []byte) error
func (MappingType) Valid ¶
func (mt MappingType) Valid() error
type MarkdownViewProperties ¶
func (MarkdownViewProperties) GetType ¶
func (v MarkdownViewProperties) GetType() string
type NotificationEndpoint ¶
type NotificationEndpoint interface { Valid() error Type() string json.Marshaler CRUDLogSetter SetID(id ID) SetOrgID(id ID) SetName(name string) SetDescription(description string) SetStatus(status Status) GetID() ID GetCRUDLog() CRUDLog GetOrgID() ID GetName() string GetDescription() string GetStatus() Status // SecretFields return available secret fields. SecretFields() []SecretField // BackfillSecretKeys fill back fill the secret field key during the unmarshalling // if value of that secret field is not nil. BackfillSecretKeys() }
NotificationEndpoint is the configuration describing how to call a 3rd party service. E.g. Slack, Pagerduty
type NotificationEndpointFilter ¶
type NotificationEndpointFilter struct { ID *ID OrgID *ID Org *string UserResourceMappingFilter }
NotificationEndpointFilter represents a set of filter that restrict the returned notification endpoints.
func (NotificationEndpointFilter) QueryParams ¶
func (f NotificationEndpointFilter) QueryParams() map[string][]string
QueryParams Converts NotificationEndpointFilter fields to url query params.
type NotificationEndpointService ¶
type NotificationEndpointService interface { // UserResourceMappingService must be part of all NotificationEndpointStore service, // for create, delete. UserResourceMappingService // OrganizationService is needed for search filter OrganizationService // FindNotificationEndpointByID returns a single notification endpoint by ID. FindNotificationEndpointByID(ctx context.Context, id ID) (NotificationEndpoint, error) // FindNotificationEndpoints returns a list of notification endpoints that match filter and the total count of matching notification endpoints. // Additional options provide pagination & sorting. FindNotificationEndpoints(ctx context.Context, filter NotificationEndpointFilter, opt ...FindOptions) ([]NotificationEndpoint, int, error) // CreateNotificationEndpoint creates a new notification endpoint and sets b.ID with the new identifier. CreateNotificationEndpoint(ctx context.Context, ne NotificationEndpoint, userID ID) error // UpdateNotificationEndpoint updates a single notification endpoint. // Returns the new notification endpoint after update. UpdateNotificationEndpoint(ctx context.Context, id ID, nr NotificationEndpoint, userID ID) (NotificationEndpoint, error) // PatchNotificationEndpoint updates a single notification endpoint with changeset. // Returns the new notification endpoint state after update. PatchNotificationEndpoint(ctx context.Context, id ID, upd NotificationEndpointUpdate) (NotificationEndpoint, error) // DeleteNotificationEndpoint removes a notification endpoint by ID, returns secret fields, orgID for further deletion. DeleteNotificationEndpoint(ctx context.Context, id ID) (flds []SecretField, orgID ID, err error) }
NotificationEndpointService represents a service for managing notification endpoints.
type NotificationEndpointUpdate ¶
type NotificationEndpointUpdate struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` Status *Status `json:"status,omitempty"` }
NotificationEndpointUpdate is the set of upgrade fields for patch request.
func (*NotificationEndpointUpdate) Valid ¶
func (n *NotificationEndpointUpdate) Valid() error
Valid will verify if the NotificationEndpointUpdate is valid.
type NotificationRule ¶
type NotificationRule interface { Valid() error Type() string json.Marshaler CRUDLogSetter SetID(id ID) SetOrgID(id ID) SetName(name string) SetDescription(description string) GetID() ID GetCRUDLog() CRUDLog GetOrgID() ID GetName() string GetDescription() string SetOwnerID(id ID) ClearPrivateData() GetOwnerID() ID SetTaskID(id ID) GetTaskID() ID GetEndpointID() ID GetLimit() *Limit GenerateFlux(NotificationEndpoint) (string, error) MatchesTags(tags []Tag) bool }
NotificationRule is a *Query* of a *Status Bucket* that returns the *Status*. When warranted by the rules, sends a *Message* to a 3rd Party using the *Notification Endpoint* and stores a receipt in the *Notifications Bucket*.
type NotificationRuleCreate ¶
type NotificationRuleCreate struct { NotificationRule Status Status `json:"status"` }
NotificationRuleCreate is the struct providing data to create a Notification Rule.
type NotificationRuleFilter ¶
type NotificationRuleFilter struct { OrgID *ID Organization *string Tags []Tag UserResourceMappingFilter }
NotificationRuleFilter represents a set of filter that restrict the returned notification rules.
func (NotificationRuleFilter) QueryParams ¶
func (f NotificationRuleFilter) QueryParams() map[string][]string
QueryParams Converts NotificationRuleFilter fields to url query params.
type NotificationRuleStore ¶
type NotificationRuleStore interface { // UserResourceMappingService must be part of all NotificationRuleStore service, // for create, search, delete. UserResourceMappingService // OrganizationService is needed for search filter OrganizationService // FindNotificationRuleByID returns a single notification rule by ID. FindNotificationRuleByID(ctx context.Context, id ID) (NotificationRule, error) // FindNotificationRules returns a list of notification rules that match filter and the total count of matching notification rules. // Additional options provide pagination & sorting. FindNotificationRules(ctx context.Context, filter NotificationRuleFilter, opt ...FindOptions) ([]NotificationRule, int, error) // CreateNotificationRule creates a new notification rule and sets b.ID with the new identifier. CreateNotificationRule(ctx context.Context, nr NotificationRuleCreate, userID ID) error // UpdateNotificationRuleUpdateNotificationRule updates a single notification rule. // Returns the new notification rule after update. UpdateNotificationRule(ctx context.Context, id ID, nr NotificationRuleCreate, userID ID) (NotificationRule, error) // PatchNotificationRule updates a single notification rule with changeset. // Returns the new notification rule state after update. PatchNotificationRule(ctx context.Context, id ID, upd NotificationRuleUpdate) (NotificationRule, error) // DeleteNotificationRule removes a notification rule by ID. DeleteNotificationRule(ctx context.Context, id ID) error }
NotificationRuleStore represents a service for managing notification rule.
type NotificationRuleUpdate ¶
type NotificationRuleUpdate struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` Status *Status `json:"status,omitempty"` }
NotificationRuleUpdate is the set of upgrade fields for patch request.
func (*NotificationRuleUpdate) Valid ¶
func (n *NotificationRuleUpdate) Valid() error
Valid will verify if the NotificationRuleUpdate is valid.
type OnboardingRequest ¶
type OnboardingRequest struct { User string `json:"username"` Password string `json:"password"` Org string `json:"org"` Bucket string `json:"bucket"` RetentionPeriod uint `json:"retentionPeriodHrs,omitempty"` Token string `json:"token,omitempty"` }
OnboardingRequest is the request to setup defaults.
func (*OnboardingRequest) Valid ¶
func (r *OnboardingRequest) Valid() error
type OnboardingResults ¶
type OnboardingResults struct { User *User `json:"user"` Org *Organization `json:"org"` Bucket *Bucket `json:"bucket"` Auth *Authorization `json:"auth"` }
OnboardingResults is a group of elements required for first run.
type OnboardingService ¶
type OnboardingService interface { // IsOnboarding determine if onboarding request is allowed. IsOnboarding(ctx context.Context) (bool, error) // OnboardInitialUser OnboardingResults. OnboardInitialUser(ctx context.Context, req *OnboardingRequest) (*OnboardingResults, error) // OnboardUser creates a new user/org/buckets OnboardUser(ctx context.Context, req *OnboardingRequest) (*OnboardingResults, error) }
OnboardingService represents a service for the first run.
type OperationLogEntry ¶
type OperationLogEntry struct { Description string `json:"description"` UserID ID `json:"userID,omitempty"` Time time.Time `json:"time,omitempty"` }
OperationLogEntry is a record in an operation log.
type Operator ¶
type Operator int
Operator is an Enum value of operators.
func ToOperator ¶
ToOperator converts a string into its equivalent Operator.
func (Operator) MarshalJSON ¶
MarshalJSON implements json.Marshal interface.
func (*Operator) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface.
type Organization ¶
type Organization struct { ID ID `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description"` CRUDLog }
Organization is an organization. 🎉
type OrganizationFilter ¶
OrganizationFilter represents a set of filter that restrict the returned results.
type OrganizationOperationLogService ¶
type OrganizationOperationLogService interface { // GetOrganizationOperationLog retrieves the operation log for the org with the provided id. GetOrganizationOperationLog(ctx context.Context, id ID, opts FindOptions) ([]*OperationLogEntry, int, error) }
OrganizationOperationLogService is an interface for retrieving the operation log for an org.
type OrganizationService ¶
type OrganizationService interface { // Returns a single organization by ID. FindOrganizationByID(ctx context.Context, id ID) (*Organization, error) // Returns the first organization that matches filter. FindOrganization(ctx context.Context, filter OrganizationFilter) (*Organization, error) // Returns a list of organizations that match filter and the total count of matching organizations. // Additional options provide pagination & sorting. FindOrganizations(ctx context.Context, filter OrganizationFilter, opt ...FindOptions) ([]*Organization, int, error) // Creates a new organization and sets b.ID with the new identifier. CreateOrganization(ctx context.Context, b *Organization) error // Updates a single organization with changeset. // Returns the new organization state after update. UpdateOrganization(ctx context.Context, id ID, upd OrganizationUpdate) (*Organization, error) // Removes a organization by ID. DeleteOrganization(ctx context.Context, id ID) error }
OrganizationService represents a service for managing organization data.
type OrganizationUpdate ¶
OrganizationUpdate represents updates to a organization. Only fields which are set are updated.
type PagingFilter ¶
type PagingFilter interface { // QueryParams returns a map containing url query params. QueryParams() map[string][]string }
PagingFilter represents a filter containing url query params.
type PagingLinks ¶
type PagingLinks struct { Prev string `json:"prev,omitempty"` Self string `json:"self"` Next string `json:"next,omitempty"` }
PagingLinks represents paging links.
func NewPagingLinks ¶
func NewPagingLinks(basePath string, opts FindOptions, f PagingFilter, num int) *PagingLinks
NewPagingLinks returns a PagingLinks. num is the number of returned results.
type PasswordsService ¶
type PasswordsService interface { // SetPassword overrides the password of a known user. SetPassword(ctx context.Context, userID ID, password string) error // ComparePassword checks if the password matches the password recorded. // Passwords that do not match return errors. ComparePassword(ctx context.Context, userID ID, password string) error // CompareAndSetPassword checks the password and if they match // updates to the new password. CompareAndSetPassword(ctx context.Context, userID ID, old, new string) error }
PasswordsService is the service for managing basic auth passwords.
type Permission ¶
Permission defines an action and a resource.
func MePermissions ¶
func MePermissions(userID ID) []Permission
MePermissions is the permission to read/write myself.
func MemberBucketPermission ¶
func MemberBucketPermission(bucketID ID) Permission
MemberPermissions are the default permissions for those who can see a resource.
func MemberPermissions ¶
func MemberPermissions(orgID ID) []Permission
MemberPermissions are the default permissions for those who can see a resource.
func NewGlobalPermission ¶
func NewGlobalPermission(a Action, rt ResourceType) (*Permission, error)
NewGlobalPermission constructs a global permission capable of accessing any resource of type rt.
func NewPermission ¶
func NewPermission(a Action, rt ResourceType, orgID ID) (*Permission, error)
NewPermission returns a permission with provided arguments.
func NewPermissionAtID ¶
func NewPermissionAtID(id ID, a Action, rt ResourceType, orgID ID) (*Permission, error)
NewPermissionAtID creates a permission with the provided arguments.
func NewResourcePermission ¶
func NewResourcePermission(a Action, rt ResourceType, rid ID) (*Permission, error)
NewResourcePermission returns a permission with provided arguments.
func OperPermissions ¶
func OperPermissions() []Permission
OperPermissions are the default permissions for those who setup the application.
func OwnerPermissions ¶
func OwnerPermissions(orgID ID) []Permission
OwnerPermissions are the default permissions for those who own a resource.
func ReadAllPermissions ¶
func ReadAllPermissions() []Permission
ReadAllPermissions represents permission to read all data and metadata. Like OperPermissions, but allows read-only users.
func (Permission) Matches ¶
func (p Permission) Matches(perm Permission) bool
Matches returns whether or not one permission matches the other.
func (Permission) String ¶
func (p Permission) String() string
func (*Permission) Valid ¶
func (p *Permission) Valid() error
Valid checks if there the resource and action provided is known.
type RealTimeGenerator ¶
type RealTimeGenerator struct{}
RealTimeGenerator will generate the real time.
func (RealTimeGenerator) Now ¶
func (g RealTimeGenerator) Now() time.Time
Now returns the current time.
type RenamableField ¶
type RenamableField struct { InternalName string `json:"internalName"` DisplayName string `json:"displayName"` Visible bool `json:"visible"` }
RenamableField is a column/row field in a DashboardView of type Table
type RequestStillQueuedError ¶
type RequestStillQueuedError struct {
// Unix timestamps matching existing request's start and end.
Start, End int64
}
RequestStillQueuedError is returned when attempting to retry a run which has not yet completed.
func ParseRequestStillQueuedError ¶
func ParseRequestStillQueuedError(msg string) *RequestStillQueuedError
ParseRequestStillQueuedError attempts to parse a RequestStillQueuedError from msg. If msg is formatted correctly, the resultant error is returned; otherwise it returns nil.
func (RequestStillQueuedError) Error ¶
func (e RequestStillQueuedError) Error() string
type Resource ¶
type Resource struct { Type ResourceType `json:"type"` ID *ID `json:"id,omitempty"` OrgID *ID `json:"orgID,omitempty"` }
Resource is an authorizable resource.
type ResourceType ¶
type ResourceType string
ResourceType is an enum defining all resource types that have a permission model in platform
func (ResourceType) Valid ¶
func (t ResourceType) Valid() (err error)
Valid checks if the resource type is a member of the ResourceType enum.
type Run ¶
type Run struct { ID ID `json:"id,omitempty"` TaskID ID `json:"taskID"` Status string `json:"status"` ScheduledFor time.Time `json:"scheduledFor"` // ScheduledFor is the Now time used in the task's query RunAt time.Time `json:"runAt"` // RunAt is the time the task is scheduled to be run, which is ScheduledFor + Offset StartedAt time.Time `json:"startedAt,omitempty"` // StartedAt is the time the executor begins running the task FinishedAt time.Time `json:"finishedAt,omitempty"` // FinishedAt is the time the executor finishes running the task RequestedAt time.Time `json:"requestedAt,omitempty"` // RequestedAt is the time the coordinator told the scheduler to schedule the task Log []Log `json:"log,omitempty"` }
Run is a record createId when a run of a task is scheduled.
type RunFilter ¶
type RunFilter struct { // Task ID is required for listing runs. Task ID After *ID Limit int AfterTime string BeforeTime string }
RunFilter represents a set of filters that restrict the returned results
type ScatterViewProperties ¶
type ScatterViewProperties struct { Type string `json:"type"` Queries []DashboardQuery `json:"queries"` ViewColors []string `json:"colors"` FillColumns []string `json:"fillColumns"` SymbolColumns []string `json:"symbolColumns"` XColumn string `json:"xColumn"` YColumn string `json:"yColumn"` XDomain []float64 `json:"xDomain,omitempty"` YDomain []float64 `json:"yDomain,omitempty"` XAxisLabel string `json:"xAxisLabel"` YAxisLabel string `json:"yAxisLabel"` XPrefix string `json:"xPrefix"` XSuffix string `json:"xSuffix"` YPrefix string `json:"yPrefix"` YSuffix string `json:"ySuffix"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` TimeFormat string `json:"timeFormat"` }
ScatterViewProperties represents options for scatter view in Chronograf
func (ScatterViewProperties) GetType ¶
func (v ScatterViewProperties) GetType() string
type ScraperTarget ¶
type ScraperTarget struct { ID ID `json:"id,omitempty"` Name string `json:"name"` Type ScraperType `json:"type"` URL string `json:"url"` OrgID ID `json:"orgID,omitempty"` BucketID ID `json:"bucketID,omitempty"` }
ScraperTarget is a target to scrape
type ScraperTargetFilter ¶
type ScraperTargetFilter struct { IDs map[ID]bool `json:"ids"` Name *string `json:"name"` OrgID *ID `json:"orgID"` Org *string `json:"org"` }
ScraperTargetFilter represents a set of filter that restrict the returned results.
type ScraperTargetStoreService ¶
type ScraperTargetStoreService interface { UserResourceMappingService OrganizationService ListTargets(ctx context.Context, filter ScraperTargetFilter) ([]ScraperTarget, error) AddTarget(ctx context.Context, t *ScraperTarget, userID ID) error GetTargetByID(ctx context.Context, id ID) (*ScraperTarget, error) RemoveTarget(ctx context.Context, id ID) error UpdateTarget(ctx context.Context, t *ScraperTarget, userID ID) (*ScraperTarget, error) }
ScraperTargetStoreService defines the crud service for ScraperTarget.
type SecretField ¶
SecretField contains a key string, and value pointer.
func (SecretField) MarshalJSON ¶
func (s SecretField) MarshalJSON() ([]byte, error)
MarshalJSON implement the json marshaler interface.
func (SecretField) String ¶
func (s SecretField) String() string
String returns the key of the secret.
func (*SecretField) UnmarshalJSON ¶
func (s *SecretField) UnmarshalJSON(b []byte) error
UnmarshalJSON implement the json unmarshaler interface.
type SecretService ¶
type SecretService interface { // LoadSecret retrieves the secret value v found at key k for organization orgID. LoadSecret(ctx context.Context, orgID ID, k string) (string, error) // GetSecretKeys retrieves all secret keys that are stored for the organization orgID. GetSecretKeys(ctx context.Context, orgID ID) ([]string, error) // PutSecret stores the secret pair (k,v) for the organization orgID. PutSecret(ctx context.Context, orgID ID, k string, v string) error // PutSecrets puts all provided secrets and overwrites any previous values. PutSecrets(ctx context.Context, orgID ID, m map[string]string) error // PatchSecrets patches all provided secrets and updates any previous values. PatchSecrets(ctx context.Context, orgID ID, m map[string]string) error // DeleteSecret removes a single secret from the secret store. DeleteSecret(ctx context.Context, orgID ID, ks ...string) error }
SecretService a service for storing and retrieving secrets.
type Semaphore ¶
type Semaphore interface { // TryAcquire attempts to acquire ownership of the semaphore. TryAcquire // must not block. Failure to get ownership of the semaphore should be // signalled to the caller via the return of the ErrNoAcquire error. TryAcquire(ctx context.Context, ttl time.Duration) (Lease, error) }
A Semaphore provides an API for requesting ownership of an expirable semaphore.
Acquired semaphores have an expiration. If they're not released or kept alive during this period then they will expire and ownership of the semaphore will be lost.
TODO(edd): add AcquireTTL when needed. It should block.
var NopSemaphore Semaphore = nopSemaphore{}
NopSemaphore is a Semaphore that always hands out leases.
type Session ¶
type Session struct { // ID is only required for auditing purposes. ID ID `json:"id"` Key string `json:"key"` CreatedAt time.Time `json:"createdAt"` ExpiresAt time.Time `json:"expiresAt"` UserID ID `json:"userID,omitempty"` Permissions []Permission `json:"permissions,omitempty"` }
Session is a user session.
func (*Session) Allowed ¶
func (s *Session) Allowed(p Permission) bool
Allowed returns true if the authorization is unexpired and request permission exists in the sessions list of permissions.
func (*Session) EphemeralAuth ¶
func (s *Session) EphemeralAuth(orgID ID) *Authorization
EphemeralAuth generates an Authorization that is not stored but at the user's max privs.
func (*Session) Identifier ¶
Identifier returns the sessions ID and is used for auditing.
type SessionService ¶
type SessionService interface { FindSession(ctx context.Context, key string) (*Session, error) ExpireSession(ctx context.Context, key string) error CreateSession(ctx context.Context, user string) (*Session, error) RenewSession(ctx context.Context, session *Session, newExpiration time.Time) error }
SessionService represents a service for managing user sessions.
type SingleStatViewProperties ¶
type SingleStatViewProperties struct { Type string `json:"type"` Queries []DashboardQuery `json:"queries"` Prefix string `json:"prefix"` TickPrefix string `json:"tickPrefix"` Suffix string `json:"suffix"` TickSuffix string `json:"tickSuffix"` ViewColors []ViewColor `json:"colors"` DecimalPlaces DecimalPlaces `json:"decimalPlaces"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` }
SingleStatViewProperties represents options for single stat view in Chronograf
func (SingleStatViewProperties) GetType ¶
func (v SingleStatViewProperties) GetType() string
type Source ¶
type Source struct { ID ID `json:"id,omitempty"` // ID is the unique ID of the source OrganizationID ID `json:"orgID"` // OrganizationID is the organization ID that resource belongs to Default bool `json:"default"` // Default specifies the default source for the application Name string `json:"name"` // Name is the user-defined name for the source Type SourceType `json:"type,omitempty"` // Type specifies which kinds of source (enterprise vs oss vs 2.0) URL string `json:"url"` // URL are the connections to the source InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` // InsecureSkipVerify as true means any certificate presented by the source is accepted Telegraf string `json:"telegraf"` // Telegraf is the db telegraf is written to. By default it is "telegraf" SourceFields V1SourceFields }
Source is an external Influx with time series data. TODO(desa): do we still need default? TODO(desa): do sources belong
type SourceFields ¶
type SourceFields struct {
Token string `json:"token"` // Token is the 2.0 authorization token associated with a source
}
SourceFields is used to authorize against an influx 2.0 source.
type SourceQuery ¶
SourceQuery is a query for a source.
type SourceService ¶
type SourceService interface { // DefaultSource retrieves the default source. DefaultSource(ctx context.Context) (*Source, error) // FindSourceByID retrieves a source by its ID. FindSourceByID(ctx context.Context, id ID) (*Source, error) // FindSources returns a list of all sources. FindSources(ctx context.Context, opts FindOptions) ([]*Source, int, error) // CreateSource sets the sources ID and stores it. CreateSource(ctx context.Context, s *Source) error // UpdateSource updates the source. UpdateSource(ctx context.Context, id ID, upd SourceUpdate) (*Source, error) // DeleteSource removes the source. DeleteSource(ctx context.Context, id ID) error }
SourceService is a service for managing sources.
type SourceUpdate ¶
type SourceUpdate struct { Name *string `json:"name"` Type *SourceType `json:"type,omitempty"` Token *string `json:"token"` URL *string `json:"url"` InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"` Telegraf *string `json:"telegraf"` Username *string `json:"username,omitempty"` Password *string `json:"password,omitempty"` MetaURL *string `json:"metaURL,omitempty"` Role *string `json:"role,omitempty"` DefaultRP *string `json:"defaultRP"` }
SourceUpdate represents updates to a source.
func (SourceUpdate) Apply ¶
func (u SourceUpdate) Apply(s *Source) error
Apply applies an update to a source.
type TableOptions ¶
type TableOptions struct { VerticalTimeAxis bool `json:"verticalTimeAxis"` SortBy RenamableField `json:"sortBy"` Wrapping string `json:"wrapping"` FixFirstColumn bool `json:"fixFirstColumn"` }
TableOptions is a type of options for a DashboardView with type Table
type TableViewProperties ¶
type TableViewProperties struct { Type string `json:"type"` Queries []DashboardQuery `json:"queries"` ViewColors []ViewColor `json:"colors"` TableOptions TableOptions `json:"tableOptions"` FieldOptions []RenamableField `json:"fieldOptions"` TimeFormat string `json:"timeFormat"` DecimalPlaces DecimalPlaces `json:"decimalPlaces"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` }
TableViewProperties represents options for table view in Chronograf
func (TableViewProperties) GetType ¶
func (v TableViewProperties) GetType() string
type Tag ¶
Tag is a tag key-value pair.
func (*Tag) QueryParam ¶
QueryParam converts a Tag to a string query parameter
type Task ¶
type Task struct { ID ID `json:"id"` Type string `json:"type,omitempty"` OrganizationID ID `json:"orgID"` Organization string `json:"org"` AuthorizationID ID `json:"-"` Authorization *Authorization `json:"-"` OwnerID 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 time.Duration `json:"offset,omitempty"` LatestCompleted time.Time `json:"latestCompleted,omitempty"` LatestScheduled time.Time `json:"latestScheduled,omitempty"` LastRunStatus string `json:"lastRunStatus,omitempty"` LastRunError string `json:"lastRunError,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Task is a task. 🎊
func (*Task) EffectiveCron ¶
EffectiveCron returns the effective cron string of the options. If the cron option was specified, it is returned. If the every option was specified, it is converted into a cron string using "@every". Otherwise, the empty string is returned. The value of the offset option is not considered.
type TaskCreate ¶
type TaskCreate struct { Type string `json:"type,omitempty"` Flux string `json:"flux"` Description string `json:"description,omitempty"` Status string `json:"status,omitempty"` OrganizationID ID `json:"orgID,omitempty"` Organization string `json:"org,omitempty"` OwnerID ID `json:"-"` Metadata map[string]interface{} `json:"-"` // not to be set through a web request but rather used by a http service using tasks backend. }
TaskCreate is the set of values to create a task.
func (TaskCreate) Validate ¶
func (t TaskCreate) Validate() error
type TaskFilter ¶
type TaskFilter struct { Type *string Name *string After *ID OrganizationID *ID Organization string User *ID Limit int Status *string }
TaskFilter represents a set of filters that restrict the returned results
func (TaskFilter) QueryParams ¶
func (f TaskFilter) QueryParams() map[string][]string
QueryParams Converts TaskFilter fields to url query params.
type TaskService ¶
type TaskService interface { // FindTaskByID returns a single task FindTaskByID(ctx context.Context, id ID) (*Task, error) // FindTasks returns a list of tasks that match a filter (limit 100) and the total count // of matching tasks. FindTasks(ctx context.Context, filter TaskFilter) ([]*Task, int, error) // CreateTask creates a new task. // The owner of the task is inferred from the authorizer associated with ctx. CreateTask(ctx context.Context, t TaskCreate) (*Task, error) // UpdateTask updates a single task with changeset. UpdateTask(ctx context.Context, id ID, upd TaskUpdate) (*Task, error) // DeleteTask removes a task by ID and purges all associated data and scheduled runs. DeleteTask(ctx context.Context, id ID) error // FindLogs returns logs for a run. FindLogs(ctx context.Context, filter LogFilter) ([]*Log, int, error) // FindRuns returns a list of runs that match a filter and the total count of returned runs. FindRuns(ctx context.Context, filter RunFilter) ([]*Run, int, error) // FindRunByID returns a single run. FindRunByID(ctx context.Context, taskID, runID ID) (*Run, error) // CancelRun cancels a currently running run. CancelRun(ctx context.Context, taskID, runID ID) error // RetryRun creates and returns a new run (which is a retry of another run). RetryRun(ctx context.Context, taskID, runID ID) (*Run, error) // ForceRun forces a run to occur with unix timestamp scheduledFor, to be executed as soon as possible. // The value of scheduledFor may or may not align with the task's schedule. ForceRun(ctx context.Context, taskID ID, scheduledFor int64) (*Run, error) }
TaskService represents a service for managing one-off and recurring tasks.
type TaskStatus ¶
type TaskStatus string
const ( TaskActive TaskStatus = "active" TaskInactive TaskStatus = "inactive" DefaultTaskStatus TaskStatus = TaskActive )
type TaskUpdate ¶
type TaskUpdate struct { Flux *string `json:"flux,omitempty"` Status *string `json:"status,omitempty"` Description *string `json:"description,omitempty"` // LatestCompleted us to set latest completed on startup to skip task catchup LatestCompleted *time.Time `json:"-"` LatestScheduled *time.Time `json:"-"` LastRunStatus *string `json:"-"` LastRunError *string `json:"-"` Metadata map[string]interface{} `json:"-"` // not to be set through a web request but rather used by a http service using tasks backend. // Options gets unmarshalled from json as if it was flat, with the same level as Flux and Status. Options options.Options // when we unmarshal this gets unmarshalled from flat key-values }
TaskUpdate represents updates to a task. Options updates override any options set in the Flux field.
func (*TaskUpdate) MarshalJSON ¶
func (t *TaskUpdate) MarshalJSON() ([]byte, error)
func (*TaskUpdate) UnmarshalJSON ¶
func (t *TaskUpdate) UnmarshalJSON(data []byte) error
func (*TaskUpdate) UpdateFlux ¶
func (t *TaskUpdate) UpdateFlux(oldFlux string) (err error)
UpdateFlux updates the TaskUpdate to go from updating options to updating a flux string, that now has those updated options in it It zeros the options in the TaskUpdate.
func (*TaskUpdate) Validate ¶
func (t *TaskUpdate) Validate() error
type TelegrafConfig ¶
type TelegrafConfig struct { ID ID `json:"id,omitempty"` // ID of this config object. OrgID ID `json:"orgID,omitempty"` // OrgID is the id of the owning organization. Name string `json:"name,omitempty"` // Name of this config object. Description string `json:"description,omitempty"` // Decription of this config object. Config string `json:"config,omitempty"` // ConfigTOML contains the raw toml config. Metadata map[string]interface{} `json:"metadata,omitempty"` // Metadata for the config. }
TelegrafConfig stores telegraf config for one telegraf instance.
func (*TelegrafConfig) CountPlugins ¶
func (tc *TelegrafConfig) CountPlugins() map[string]float64
CountPlugins returns a map of the number of times each plugin is used.
func (*TelegrafConfig) UnmarshalJSON ¶
func (tc *TelegrafConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON implement the json.Unmarshaler interface. Gets called when reading from the kv db. mostly legacy so loading old/stored configs still work. May not remove for a while. Primarily will get hit when user views/downloads config.
type TelegrafConfigFilter ¶
type TelegrafConfigFilter struct { OrgID *ID Organization *string UserResourceMappingFilter }
TelegrafConfigFilter represents a set of filter that restrict the returned telegraf configs.
type TelegrafConfigStore ¶
type TelegrafConfigStore interface { // UserResourceMappingService must be part of all TelegrafConfigStore service, // for create, search, delete. UserResourceMappingService // FindTelegrafConfigByID returns a single telegraf config by ID. FindTelegrafConfigByID(ctx context.Context, id ID) (*TelegrafConfig, error) // FindTelegrafConfigs returns a list of telegraf configs that match filter and the total count of matching telegraf configs. // Additional options provide pagination & sorting. FindTelegrafConfigs(ctx context.Context, filter TelegrafConfigFilter, opt ...FindOptions) ([]*TelegrafConfig, int, error) // CreateTelegrafConfig creates a new telegraf config and sets b.ID with the new identifier. CreateTelegrafConfig(ctx context.Context, tc *TelegrafConfig, userID ID) error // UpdateTelegrafConfig updates a single telegraf config. // Returns the new telegraf config after update. UpdateTelegrafConfig(ctx context.Context, id ID, tc *TelegrafConfig, userID ID) (*TelegrafConfig, error) // DeleteTelegrafConfig removes a telegraf config by ID. DeleteTelegrafConfig(ctx context.Context, id ID) error }
TelegrafConfigStore represents a service for managing telegraf config data.
type TenantService ¶
type TenantService interface { UserService PasswordsService UserResourceMappingService OrganizationService BucketService }
TenantService is a service that exposes the functionality of the embedded services.
type TimeGenerator ¶
TimeGenerator represents a generator for now.
type TokenGenerator ¶
TokenGenerator represents a generator for API tokens.
type Usage ¶
type Usage struct { OrganizationID *ID `json:"organizationID,omitempty"` BucketID *ID `json:"bucketID,omitempty"` Type UsageMetric `json:"type"` Value float64 `json:"value"` }
Usage is a metric associated with the utilization of a particular resource.
type UsageFilter ¶
UsageFilter is used to filter usage.
type UsageMetric ¶
type UsageMetric string
UsageMetric used to track classes of usage.
const ( // UsageWriteRequestCount is the name of the metrics for tracking write request count. UsageWriteRequestCount UsageMetric = "usage_write_request_count" // UsageWriteRequestBytes is the name of the metrics for tracking the number of write bytes. UsageWriteRequestBytes UsageMetric = "usage_write_request_bytes" // UsageValues is the name of the metrics for tracking the number of values. UsageValues UsageMetric = "usage_values" // UsageSeries is the name of the metrics for tracking the number of series written. UsageSeries UsageMetric = "usage_series" // UsageQueryRequestCount is the name of the metrics for tracking query request count. UsageQueryRequestCount UsageMetric = "usage_query_request_count" // UsageQueryRequestBytes is the name of the metrics for tracking the number of query bytes. UsageQueryRequestBytes UsageMetric = "usage_query_request_bytes" )
type UsageService ¶
type UsageService interface {
GetUsage(ctx context.Context, filter UsageFilter) (map[UsageMetric]*Usage, error)
}
UsageService is a service for accessing usage statistics.
type User ¶
type User struct { ID ID `json:"id,omitempty"` Name string `json:"name"` OAuthID string `json:"oauthID,omitempty"` Status Status `json:"status"` }
User is a user. 🎉
type UserFilter ¶
UserFilter represents a set of filter that restrict the returned results.
type UserOperationLogService ¶
type UserOperationLogService interface { // GetUserOperationLog retrieves the operation log for the user with the provided id. GetUserOperationLog(ctx context.Context, id ID, opts FindOptions) ([]*OperationLogEntry, int, error) }
UserOperationLogService is an interface for retrieving the operation log for a user.
type UserResourceMapping ¶
type UserResourceMapping struct { UserID ID `json:"userID"` UserType UserType `json:"userType"` MappingType MappingType `json:"mappingType"` ResourceType ResourceType `json:"resourceType"` ResourceID ID `json:"resourceID"` }
UserResourceMapping represents a mapping of a resource to its user.
func (*UserResourceMapping) ToPermissions ¶
func (m *UserResourceMapping) ToPermissions() ([]Permission, error)
ToPermissions converts a user resource mapping into a set of permissions.
func (UserResourceMapping) Validate ¶
func (m UserResourceMapping) Validate() error
Validate reports any validation errors for the mapping.
type UserResourceMappingFilter ¶
type UserResourceMappingFilter struct { ResourceID ID ResourceType ResourceType UserID ID UserType UserType }
UserResourceMappingFilter represents a set of filters that restrict the returned results.
type UserResourceMappingService ¶
type UserResourceMappingService interface { // FindUserResourceMappings returns a list of UserResourceMappings that match filter and the total count of matching mappings. FindUserResourceMappings(ctx context.Context, filter UserResourceMappingFilter, opt ...FindOptions) ([]*UserResourceMapping, int, error) // CreateUserResourceMapping creates a user resource mapping. CreateUserResourceMapping(ctx context.Context, m *UserResourceMapping) error // DeleteUserResourceMapping deletes a user resource mapping. DeleteUserResourceMapping(ctx context.Context, resourceID, userID ID) error }
UserResourceMappingService maps the relationships between users and resources.
type UserService ¶
type UserService interface { // Returns a single user by ID. FindUserByID(ctx context.Context, id ID) (*User, error) // Returns the first user that matches filter. FindUser(ctx context.Context, filter UserFilter) (*User, error) // Returns a list of users that match filter and the total count of matching users. // Additional options provide pagination & sorting. FindUsers(ctx context.Context, filter UserFilter, opt ...FindOptions) ([]*User, int, error) // Creates a new user and sets u.ID with the new identifier. CreateUser(ctx context.Context, u *User) error // Updates a single user with changeset. // Returns the new user state after update. UpdateUser(ctx context.Context, id ID, upd UserUpdate) (*User, error) // Removes a user by ID. DeleteUser(ctx context.Context, id ID) error }
UserService represents a service for managing user data.
type UserUpdate ¶
UserUpdate represents updates to a user. Only fields which are set are updated.
type V1SourceFields ¶
type V1SourceFields struct { Username string `json:"username,omitempty"` // Username is the username to connect to the source Password string `json:"password,omitempty"` // Password is in CLEARTEXT MetaURL string `json:"metaUrl,omitempty"` // MetaURL is the url for the meta node DefaultRP string `json:"defaultRP"` // DefaultRP is the default retention policy used in database queries to this source }
V1SourceFields are the fields for connecting to a 1.0 source (oss or enterprise)
type Variable ¶
type Variable struct { ID ID `json:"id,omitempty"` OrganizationID ID `json:"orgID,omitempty"` Name string `json:"name"` Description string `json:"description"` Selected []string `json:"selected"` Arguments *VariableArguments `json:"arguments"` CRUDLog }
A Variable describes a keyword that can be expanded into several possible values when used in an InfluxQL or Flux query
type VariableArguments ¶
type VariableArguments struct { Type string `json:"type"` // "constant", "map", or "query" Values interface{} `json:"values"` // either VariableQueryValues, VariableConstantValues, VariableMapValues }
A VariableArguments contains arguments used when expanding a Variable
func (*VariableArguments) UnmarshalJSON ¶
func (a *VariableArguments) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals json into a VariableArguments struct, using the `Type` field to assign the approriate struct to the `Values` field
type VariableConstantValues ¶
type VariableConstantValues []string
VariableConstantValues are the data for expanding a constants-based Variable
type VariableFilter ¶
VariableFilter represents a set of filter that restrict the returned results.
func (VariableFilter) QueryParams ¶
func (f VariableFilter) QueryParams() map[string][]string
QueryParams implements PagingFilter.
It converts VariableFilter fields to url query params.
type VariableMapValues ¶
VariableMapValues are the data for expanding a map-based Variable
type VariableQueryValues ¶
type VariableQueryValues struct { Query string `json:"query"` Language string `json:"language"` // "influxql" or "flux" }
VariableQueryValues contains a query used when expanding a query-based Variable
type VariableService ¶
type VariableService interface { // FindVariableByID finds a single variable from the store by its ID FindVariableByID(ctx context.Context, id ID) (*Variable, error) // FindVariables returns all variables in the store FindVariables(ctx context.Context, filter VariableFilter, opt ...FindOptions) ([]*Variable, error) // CreateVariable creates a new variable and assigns it an ID CreateVariable(ctx context.Context, m *Variable) error // UpdateVariable updates a single variable with a changeset UpdateVariable(ctx context.Context, id ID, update *VariableUpdate) (*Variable, error) // ReplaceVariable replaces a single variable ReplaceVariable(ctx context.Context, variable *Variable) error // DeleteVariable removes a variable from the store DeleteVariable(ctx context.Context, id ID) error }
VariableService describes a service for managing Variables
type VariableUpdate ¶
type VariableUpdate struct { Name string `json:"name"` Selected []string `json:"selected"` Description string `json:"description"` Arguments *VariableArguments `json:"arguments"` }
A VariableUpdate describes a set of changes that can be applied to a Variable
func (*VariableUpdate) Apply ¶
func (u *VariableUpdate) Apply(m *Variable)
Apply applies non-zero fields from a VariableUpdate to a Variable
func (*VariableUpdate) Valid ¶
func (u *VariableUpdate) Valid() error
Valid returns an error if a Variable changeset is not valid
type View ¶
type View struct { ViewContents Properties ViewProperties }
View holds positional and visual information for a View.
func (View) MarshalJSON ¶
MarshalJSON encodes a view to JSON bytes.
func (*View) UnmarshalJSON ¶
UnmarshalJSON decodes JSON bytes into the corresponding view type (those that implement ViewProperties).
type ViewColor ¶
type ViewColor struct { ID string `json:"id"` // ID is the unique id of the View color Type string `json:"type"` // Type is how the color is used. Accepted (min,max,threshold) Hex string `json:"hex"` // Hex is the hex number of the color Name string `json:"name"` // Name is the user-facing name of the hex color Value float64 `json:"value"` // Value is the data value mapped to this color }
ViewColor represents the encoding of data into visualizations
type ViewContents ¶
ViewContents is the id and name of a specific view.
type ViewContentsUpdate ¶
type ViewContentsUpdate struct {
Name *string `json:"name"`
}
ViewContentsUpdate is a struct for updating the non properties content of a View.
type ViewFilter ¶
ViewFilter represents a set of filter that restrict the returned results.
type ViewProperties ¶
type ViewProperties interface { GetType() string // contains filtered or unexported methods }
ViewProperties is used to mark other structures as conforming to a View.
func UnmarshalViewPropertiesJSON ¶
func UnmarshalViewPropertiesJSON(b []byte) (ViewProperties, error)
UnmarshalViewPropertiesJSON unmarshals JSON bytes into a ViewProperties.
type ViewUpdate ¶
type ViewUpdate struct { ViewContentsUpdate Properties ViewProperties }
ViewUpdate is a struct for updating Views.
func (ViewUpdate) Apply ¶
func (u ViewUpdate) Apply(v *View) error
Apply updates a view with the view updates properties.
func (ViewUpdate) MarshalJSON ¶
func (u ViewUpdate) MarshalJSON() ([]byte, error)
MarshalJSON encodes a view to JSON bytes.
func (*ViewUpdate) UnmarshalJSON ¶
func (u *ViewUpdate) UnmarshalJSON(b []byte) error
UnmarshalJSON decodes JSON bytes into the corresponding view update type (those that implement ViewProperties).
func (ViewUpdate) Valid ¶
func (u ViewUpdate) Valid() *Error
Valid validates the update struct. It expects minimal values to be set.
type WriteService ¶
WriteService writes data read from the reader.
type XYViewProperties ¶
type XYViewProperties struct { Queries []DashboardQuery `json:"queries"` Axes map[string]Axis `json:"axes"` Type string `json:"type"` Legend Legend `json:"legend"` Geom string `json:"geom"` // Either "line", "step", "stacked", or "bar" ViewColors []ViewColor `json:"colors"` Note string `json:"note"` ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` XColumn string `json:"xColumn"` YColumn string `json:"yColumn"` ShadeBelow bool `json:"shadeBelow"` Position string `json:"position"` TimeFormat string `json:"timeFormat"` }
XYViewProperties represents options for line, bar, step, or stacked view in Chronograf
func (XYViewProperties) GetType ¶
func (v XYViewProperties) GetType() string
Source Files ¶
- auth.go
- authz.go
- backup.go
- bucket.go
- build.go
- check.go
- crud_log.go
- dashboard.go
- dbrp_mapping.go
- delete.go
- document.go
- duration.go
- error.go
- errors.go
- id.go
- keyvalue_log.go
- label.go
- lookup.go
- measurement.go
- notification.go
- notification_endpoint.go
- onboarding.go
- operation_log.go
- organization.go
- paging.go
- passwords.go
- query.go
- scraper.go
- secret.go
- semaphore.go
- session.go
- source.go
- status.go
- tag.go
- task.go
- task_errors.go
- telegraf.go
- tenant.go
- token.go
- usage.go
- user.go
- user_resource_mapping.go
- variable.go
- write.go
Directories ¶
Path | Synopsis |
---|---|
oauth2
Package oauth2 provides http.Handlers necessary for implementing Oauth2 authentication with multiple Providers.
|
Package oauth2 provides http.Handlers necessary for implementing Oauth2 authentication with multiple Providers. |
cmd
|
|
influx_inspect/buildtsi
Package buildtsi reads an in-memory index and exports it as a TSI index.
|
Package buildtsi reads an in-memory index and exports it as a TSI index. |
influxd/inspect
inspects low-level details about tsi1 files.
|
inspects low-level details about tsi1 files. |
influxd/migrate
Package migrate provides a tool to help migrate data from InfluxDB 1.x to 2.x
|
Package migrate provides a tool to help migrate data from InfluxDB 1.x to 2.x |
internal
|
|
kit
|
|
check
Package check standardizes /health and /ready endpoints.
|
Package check standardizes /health and /ready endpoints. |
cli
Package cli creates simple CLI options with ENV overrides using viper.
|
Package cli creates simple CLI options with ENV overrides using viper. |
feature
Package feature provides feature flagging capabilities for InfluxDB servers.
|
Package feature provides feature flagging capabilities for InfluxDB servers. |
prom
Package prom provides a wrapper around a prometheus metrics registry so that all services are unified in how they expose prometheus metrics.
|
Package prom provides a wrapper around a prometheus metrics registry so that all services are unified in how they expose prometheus metrics. |
prom/promtest
Package promtest provides helpers for parsing and extracting prometheus metrics.
|
Package promtest provides helpers for parsing and extracting prometheus metrics. |
Package models implements basic objects used throughout the TICK stack.
|
Package models implements basic objects used throughout the TICK stack. |
pkg
|
|
encoding/simple8b
Package simple8b implements the 64bit integer encoding algorithm as published by Ann and Moffat in "Index compression using 64-bit words", Softw.
|
Package simple8b implements the 64bit integer encoding algorithm as published by Ann and Moffat in "Index compression using 64-bit words", Softw. |
escape
Package escape contains utilities for escaping parts of InfluxQL and InfluxDB line protocol.
|
Package escape contains utilities for escaping parts of InfluxQL and InfluxDB line protocol. |
hll
Package hll contains a HyperLogLog++ with a LogLog-Beta bias correction implementation that is adapted (mostly copied) from an implementation provided by Clark DuVall github.com/clarkduvall/hyperloglog.
|
Package hll contains a HyperLogLog++ with a LogLog-Beta bias correction implementation that is adapted (mostly copied) from an implementation provided by Clark DuVall github.com/clarkduvall/hyperloglog. |
limiter
Package limiter provides concurrency limiters.
|
Package limiter provides concurrency limiters. |
metrics
Package metrics provides various measurements that are safe for concurrent access.
|
Package metrics provides various measurements that are safe for concurrent access. |
mmap
Package mmap provides a way to memory-map a file.
|
Package mmap provides a way to memory-map a file. |
pointer
Package pointer provides utilities for pointer handling that aren't available in go.
|
Package pointer provides utilities for pointer handling that aren't available in go. |
pool
Package pool provides pool structures to help reduce garbage collector pressure.
|
Package pool provides pool structures to help reduce garbage collector pressure. |
slices
Package slices contains functions to operate on slices treated as sets.
|
Package slices contains functions to operate on slices treated as sets. |
testing/assert
Package assert provides helper functions that can be used with the standard Go testing package.
|
Package assert provides helper functions that can be used with the standard Go testing package. |
Package pkger implements a means to create and consume reusable templates for what will eventually come to support all influxdb resources.
|
Package pkger implements a means to create and consume reusable templates for what will eventually come to support all influxdb resources. |
builtin
Package builtin ensures all packages related to Flux built-ins are imported and initialized.
|
Package builtin ensures all packages related to Flux built-ins are imported and initialized. |
control
Package control keeps track of resources and manages queries.
|
Package control keeps track of resources and manages queries. |
influxql
Package influxql implements the transpiler for executing influxql queries in the 2.0 query engine.
|
Package influxql implements the transpiler for executing influxql queries in the 2.0 query engine. |
influxql/spectests
Package spectests the influxql transpiler specification tests.
|
Package spectests the influxql transpiler specification tests. |
promql
Package promql implements a promql parser to build flux query specifications from promql.
|
Package promql implements a promql parser to build flux query specifications from promql. |
Package resource defines an interface for recording changes to InfluxDB resources.
|
Package resource defines an interface for recording changes to InfluxDB resources. |
compat
package compat helps with migrating toml files from influxdb.
|
package compat helps with migrating toml files from influxdb. |
task
|
|
mock
Package mock contains mock implementations of different task interfaces.
|
Package mock contains mock implementations of different task interfaces. |
options
Package options provides ways to extract the task-related options from a Flux script.
|
Package options provides ways to extract the task-related options from a Flux script. |
servicetest
Package servicetest provides tests to ensure that implementations of platform/task/backend.Store and platform/task/backend.LogReader meet the requirements of influxdb.TaskService.
|
Package servicetest provides tests to ensure that implementations of platform/task/backend.Store and platform/task/backend.LogReader meet the requirements of influxdb.TaskService. |
telegraf
|
|
The tenant domain encapsulates all the storage critical metadata services: User Organization Bucket URM's These services are the cornerstone of all other metadata services.
|
The tenant domain encapsulates all the storage critical metadata services: User Organization Bucket URM's These services are the cornerstone of all other metadata services. |
Package toml adds support to marshal and unmarshal types not in the official TOML spec.
|
Package toml adds support to marshal and unmarshal types not in the official TOML spec. |
tools
|
|
migrate
Package migrate provides tooling to migrate data from InfluxDB 1.x to 2.x
|
Package migrate provides tooling to migrate data from InfluxDB 1.x to 2.x |
migrate/internal
Package meta is a generated protocol buffer package.
|
Package meta is a generated protocol buffer package. |
tsi1
Package tsi1 provides a memory-mapped index implementation that supports high cardinality series.
|
Package tsi1 provides a memory-mapped index implementation that supports high cardinality series. |
tsm1
Package tsm1 provides a TSDB in the Time Structured Merge tree format.
|
Package tsm1 provides a TSDB in the Time Structured Merge tree format. |
Package uuid provides functions to create time-based UUIDs.
|
Package uuid provides functions to create time-based UUIDs. |