platform

package module
v0.0.0-...-f5b6858 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 10 Imported by: 32

README

InfluxData Platform Build Status

This is the monorepo for InfluxData Platform, a.k.a. Influx 2.0 OSS.

Vendoring

This project is using dep for vendoring.

Use dep ensure -vendor-only when you only need to populate the vendor directory to run go build successfully, or run dep ensure to both populate the vendor directory and update Gopkg.lock with any newer constraints.

Introducing Flux

We recently announced Flux, the MIT-licensed data scripting language (and rename for IFQL). The source for Flux is in this repository under query. Learn more about Flux from CTO Paul Dix's presentation.

Documentation

Index

Constants

View Source
const (
	// ReadAction is the action for reading.
	ReadAction action = "read"
	// WriteAction is the action for writing.
	WriteAction action = "write"
	// CreateAction is the action for creating new resources.
	CreateAction action = "create"
	// DeleteAction is the action for deleting an existing resource.
	DeleteAction action = "delete"
)
View Source
const (
	// UserResource represents the user resource actions can apply to.
	UserResource = resource("user")
	// OrganizationResource represents the org resource actions can apply to.
	OrganizationResource = resource("org")
)
View Source
const (
	V2SourceType   = "v2"
	V1SourceType   = "v1"
	SelfSourceType = "self"
)
View Source
const ErrCellNotFound = Error("cell not found")

ErrCellNotFound is the error for a missing cell.

View Source
const ErrDashboardNotFound = Error("dashboard not found")

ErrDashboardNotFound is the error for a missing dashboard.

View Source
const (
	ErrSourceNotFound = Error("source not found")
)
View Source
const ErrViewNotFound = Error("View not found")

ErrViewNotFound is the error for a missing View.

Variables

View Source
var (
	// CreateUserPermission is a permission for creating users.
	CreateUserPermission = Permission{
		Action:   CreateAction,
		Resource: UserResource,
	}
	// DeleteUserPermission is a permission for deleting users.
	DeleteUserPermission = Permission{
		Action:   DeleteAction,
		Resource: UserResource,
	}
)

Functions

func Allowed

func Allowed(req Permission, auth *Authorization) bool

Allowed returns true if the authorization is active and requested permission level exists in the authorization's list of permissions.

func BucketResource

func BucketResource(id ID) resource

BucketResource constructs a bucket resource.

func IsActive

func IsActive(auth *Authorization) bool

IsActive returns true if the authorization active.

func MarshalViewPropertiesJSON

func MarshalViewPropertiesJSON(v ViewProperties) ([]byte, error)

func TaskResource

func TaskResource(orgID ID) resource

TaskResource represents the task resource scoped to an organization.

Types

type AddDashboardCellOptions

type AddDashboardCellOptions struct {
	// UsingView specifies the view that should be used as a template
	// for the new cells view.
	UsingView ID
}

AddDashboardCellOptions are options for adding a dashboard.

type Authorization

type Authorization struct {
	ID          ID           `json:"id"`
	Token       string       `json:"token"`
	Status      Status       `json:"status"`
	User        string       `json:"user,omitempty"`
	UserID      ID           `json:"userID,omitempty"`
	Permissions []Permission `json:"permissions"`
}

Authorization is a authorization. 🎉

type AuthorizationFilter

type AuthorizationFilter struct {
	Token *string
	ID    *ID

	UserID *ID
	User   *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

	// SetAuthorizationStatus updates the status of the authorization. Useful
	// for setting an authorization to inactive or active.
	SetAuthorizationStatus(ctx context.Context, id ID, status Status) error

	// Removes a authorization by token.
	DeleteAuthorization(ctx context.Context, id ID) error
}

AuthorizationService represents a service for managing authorization data.

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 Bucket

type Bucket struct {
	ID                  ID            `json:"id,omitempty"`
	OrganizationID      ID            `json:"organizationID,omitempty"`
	Organization        string        `json:"organization,omitempty"`
	Name                string        `json:"name"`
	RetentionPolicyName string        `json:"rp,omitempty"` // This to support v1 sources
	RetentionPeriod     time.Duration `json:"retentionPeriod"`
}

Bucket is a bucket. 🎉

type BucketFilter

type BucketFilter struct {
	ID             *ID
	Name           *string
	OrganizationID *ID
	Organization   *string
}

BucketFilter represents a set of filter that restrict the returned results.

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
}

BucketService represents a service for managing bucket data.

type BucketUpdate

type BucketUpdate struct {
	Name            *string        `json:"name,omitempty"`
	RetentionPeriod *time.Duration `json:"retentionPeriod,omitempty"`
}

BucketUpdate represents updates to a bucket. Only fields which are set are updated.

type Cell

type Cell struct {
	ID     ID    `json:"id"`
	X      int32 `json:"x"`
	Y      int32 `json:"y"`
	W      int32 `json:"w"`
	H      int32 `json:"h"`
	ViewID ID    `json:"viewID"`
}

Cell holds positional information about a cell on dashboard and a reference to a cell.

type CellUpdate

type CellUpdate struct {
	X      *int32 `json:"x"`
	Y      *int32 `json:"y"`
	W      *int32 `json:"w"`
	H      *int32 `json:"h"`
	ViewID *ID    `json:"viewID"`
}

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.

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"`
	Name  string  `json:"name"`
	Cells []*Cell `json:"cells"`
}

Dashboard represents all visual and query data for a dashboard

type DashboardFilter

type DashboardFilter struct {
	// TODO(desa): change to be a slice of IDs
	ID *ID
}

DashboardFilter is a filter for dashboards.

type DashboardQuery

type DashboardQuery struct {
	Command     string      `json:"query"`                 // Command is the query itself
	Label       string      `json:"label,omitempty"`       // Label is the Y-Axis label for the data
	Range       *Range      `json:"range,omitempty"`       // Range is the default Y-Axis range for the data
	QueryConfig QueryConfig `json:"queryConfig,omitempty"` // QueryConfig represents the query state that is understood by the data explorer
	// TODO(desa): this should be platform.ID
	Source string      `json:"source"` // Source is the optional URI to the data source for this queryConfig
	Shifts []TimeShift `json:"-"`      // Shifts represents shifts to apply to an influxql query's time range.  Clients expect the shift to be in the generated QueryConfig
}

DashboardQuery includes state for the query builder. This is a transition struct while we move to the full InfluxQL AST

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) ([]*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 dashbaord.
	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)

	// 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"`
}

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

type DecimalPlaces struct {
	IsEnforced bool  `json:"isEnforced"`
	Digits     int32 `json:"digits"`
}

DecimalPlaces indicates whether decimal places should be enforced, and how many digits it should show.

type DurationRange

type DurationRange struct {
	Upper string `json:"upper"`
	Lower string `json:"lower"`
}

DurationRange represents the lower and upper durations of the query config

type EmptyViewProperties

type EmptyViewProperties struct{}

EmptyViewProperties is visualization that has no values

func (EmptyViewProperties) ViewProperties

func (v EmptyViewProperties) ViewProperties()

type Error

type Error string

Error is a domain error encountered while processing chronograf requests.

func (Error) Error

func (e Error) Error() string

Error returns the string of an error.

type Field

type Field struct {
	Value interface{} `json:"value"`
	Type  string      `json:"type"`
	Alias string      `json:"alias"`
	Args  []Field     `json:"args,omitempty"`
}

Field represent influxql fields and functions from the UI

type FindOptions

type FindOptions struct {
	Limit      int
	Offset     int
	SortBy     string
	Descending bool
}

FindOptions represents options passed to all find methods with multiple results.

type GroupBy

type GroupBy struct {
	Time string   `json:"time"`
	Tags []string `json:"tags"`
}

GroupBy represents influxql group by tags from the UI

type ID

type ID []byte

ID is a unique identifier.

func IDFromString

func IDFromString(idstr string) (*ID, error)

IDFromString creates an ID from a given string

func (*ID) Decode

func (i *ID) Decode(b []byte) error

Decode parses b as a hex-encoded byte-slice-string.

func (*ID) DecodeFromString

func (i *ID) DecodeFromString(s string) error

DecodeFromString parses s as a hex-encoded string.

func (ID) Encode

func (i ID) Encode() []byte

Encode converts ID to a hex-encoded byte-slice-string.

func (ID) MarshalJSON

func (i ID) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshaller for IDs.

func (ID) String

func (i ID) String() string

String returns the ID as a hex encoded string

func (*ID) UnmarshalJSON

func (i *ID) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON unmarshaller for IDs.

type IDGenerator

type IDGenerator interface {
	// ID creates unique byte slice ID.
	ID() ID
}

IDGenerator represents a generator for IDs.

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 Log

type Log string

Log represents a link to a log resource

type LogFilter

type LogFilter struct {
	// TODO(lh): Org is temporary here.
	// We will be removing it when the token in context contains org information.
	Org  *ID
	Task *ID
	Run  *ID
}

LogFilter represents a set of filters that restrict the returned results

type Organization

type Organization struct {
	ID   ID     `json:"id"`
	Name string `json:"name"`
}

Organization is a organization. 🎉

type OrganizationFilter

type OrganizationFilter struct {
	Name *string
	ID   *ID
}

OrganizationFilter represents a set of filter that restrict the returned results.

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

type OrganizationUpdate struct {
	Name *string
}

OrganizationUpdate represents updates to a organization. Only fields which are set are updated.

type Permission

type Permission struct {
	Action   action   `json:"action"`
	Resource resource `json:"resource"`
}

Permission defines an action and a resource.

func ReadBucketPermission

func ReadBucketPermission(id ID) Permission

ReadBucketPermission constructs a permission for reading a bucket.

func WriteBucketPermission

func WriteBucketPermission(id ID) Permission

WriteBucketPermission constructs a permission for writing to a bucket.

func (Permission) String

func (p Permission) String() string

type QueryConfig

type QueryConfig struct {
	ID              string              `json:"id,omitempty"`
	Database        string              `json:"database"`
	Measurement     string              `json:"measurement"`
	RetentionPolicy string              `json:"retentionPolicy"`
	Fields          []Field             `json:"fields"`
	Tags            map[string][]string `json:"tags"`
	GroupBy         GroupBy             `json:"groupBy"`
	AreTagsAccepted bool                `json:"areTagsAccepted"`
	Fill            string              `json:"fill,omitempty"`
	RawText         *string             `json:"rawText"`
	Range           *DurationRange      `json:"range"`
	Shifts          []TimeShift         `json:"shifts"`
}

QueryConfig represents UI query from the data explorer

type Range

type Range struct {
	Upper int64 `json:"upper"` // Upper is the upper bound
	Lower int64 `json:"lower"` // Lower is the lower bound
}

Range represents an upper and lower bound for data

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 Run

type Run struct {
	ID           ID     `json:"id,omitempty"`
	TaskID       ID     `json:"taskId"`
	Status       string `json:"status"`
	ScheduledFor string `json:"scheduledFor"`
	StartedAt    string `json:"startedAt,omitempty"`
	FinishedAt   string `json:"finishedAt,omitempty"`
	RequestedAt  string `json:"requestedAt,omitempty"`
	Log          Log    `json:"log"`
}

Run is a record created when a run of a task is scheduled.

type RunFilter

type RunFilter struct {
	// TODO(lh): Org is temporary here.
	// We will be removing it when the token in context contains org information.
	Org        *ID
	Task       *ID
	After      *ID
	Limit      int
	AfterTime  string
	BeforeTime string
}

RunFilter represents a set of filters that restrict the returned results

type Source

type Source struct {
	ID                 ID         `json:"id,string"`                    // ID is the unique ID of the source
	OrganizationID     ID         `json:"organizationID"`               // 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

type SourceQuery

type SourceQuery struct {
	Query string `json:"query"`
	Type  string `json:"type"`
}

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 SourceType

type SourceType string

SourceType is a string for types of 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"`
	SharedSecret       *string     `json:"sharedSecret,omitempty"`
	MetaURL            *string     `json:"metaURL,omitempty"`
	FluxURL            *string     `json:"fluxURL,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 Status

type Status string

Status defines if a resource is active or inactive.

const (
	// Active status means that the resource can be used.
	Active Status = "active"
	// Inactive status means that the resource cannot be used.
	Inactive Status = "inactive"
)

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 Task

type Task struct {
	ID           ID     `json:"id,omitempty"`
	Organization ID     `json:"organizationId"`
	Name         string `json:"name"`
	Status       string `json:"status"`
	Owner        User   `json:"owner"`
	Flux         string `json:"flux"`
	Every        string `json:"every,omitempty"`
	Cron         string `json:"cron,omitempty"`
}

Task is a task. 🎊

type TaskFilter

type TaskFilter struct {
	After        *ID
	Organization *ID
	User         *ID
}

TaskFilter represents a set of filters that restrict the returned results

type TaskService

type TaskService interface {
	// Returns a single task
	FindTaskByID(ctx context.Context, id ID) (*Task, error)

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

	// Creates a new task
	CreateTask(ctx context.Context, t *Task) error

	// Updates a single task with changeset
	UpdateTask(ctx context.Context, id ID, upd TaskUpdate) (*Task, error)

	// Removes a task by ID and purges all associated data and scheduled runs
	DeleteTask(ctx context.Context, id ID) error

	// Returns logs for a run.
	FindLogs(ctx context.Context, filter LogFilter) ([]*Log, int, error)

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

	// Returns a single run
	FindRunByID(ctx context.Context, id ID) (*Run, error)

	// Creates and returns a new run (which is a retry of another run)
	RetryRun(ctx context.Context, id ID) (*Run, error)
}

TaskService represents a service for managing one-off and recurring tasks.

type TaskUpdate

type TaskUpdate struct {
	Flux   *string `json:"flux,omitempty"`
	Status *string `json:"status,omitempty"`
}

TaskUpdate represents updates to a task

type TimeShift

type TimeShift struct {
	Label    string `json:"label"`    // Label user facing description
	Unit     string `json:"unit"`     // Unit influxql time unit representation i.e. ms, s, m, h, d
	Quantity string `json:"quantity"` // Quantity number of units
}

TimeShift represents a shift to apply to an influxql query's time range

type Timespan

type Timespan struct {
	Start time.Time `json:"start"`
	Stop  time.Time `json:"stop"`
}

Timespan represents a range of time.

type TokenGenerator

type TokenGenerator interface {
	// Token generates a new API token.
	Token() (string, error)
}

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

type UsageFilter struct {
	OrgID    *ID
	BucketID *ID
	Range    *Timespan
}

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 bytes.
	UsageWriteRequestBytes UsageMetric = "usage_write_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"`
}

User is a user. 🎉

type UserFilter

type UserFilter struct {
	ID   *ID
	Name *string
}

UserFilter represents a set of filter that restrict the returned results.

type UserResourceMapping

type UserResourceMapping struct {
	ResourceID ID       `json:"resource_id"`
	UserID     ID       `json:"user_id"`
	UserType   UserType `json:"user_type"`
}

UserResourceMapping represents a mapping of a resource to its user

func (UserResourceMapping) Validate

func (m UserResourceMapping) Validate() error

Validate reports any validation errors for the mapping.

type UserResourceMappingFilter

type UserResourceMappingFilter struct {
	ResourceID ID
	UserID     ID
}

UserResourceMapping represents a set of filters that restrict the returned results.

type UserResourceMappingService

type UserResourceMappingService interface {
	CreateUserResourceMapping(ctx context.Context, m *UserResourceMapping) error
	DeleteUserResourceMapping(ctx context.Context, resourceID ID, 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 UserType

type UserType string
const (
	Owner  UserType = "owner"
	Member UserType = "member"
)

type UserUpdate

type UserUpdate struct {
	Name *string `json:"name"`
}

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
	SharedSecret string `json:"sharedSecret,omitempty"` // ShareSecret is the optional signing secret for Influx JWT authorization
	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
	FluxURL      string `json:"fluxURL,omitempty"`      // FluxURL is the url for a flux connected to a 1x source
}

V1SourceFields are the fields for connecting to a 1.0 source (oss or enterprise)

type V1ViewProperties

type V1ViewProperties struct {
	Queries       []DashboardQuery `json:"queries"`
	Axes          map[string]Axis  `json:"axes"`
	Type          string           `json:"type"`
	ViewColors    []ViewColor      `json:"colors"`
	Legend        Legend           `json:"legend"`
	TableOptions  TableOptions     `json:"tableOptions,omitempty"`
	FieldOptions  []RenamableField `json:"fieldOptions"`
	TimeFormat    string           `json:"timeFormat"`
	DecimalPlaces DecimalPlaces    `json:"decimalPlaces"`
}

func (V1ViewProperties) ViewProperties

func (V1ViewProperties) ViewProperties()

type View

type View struct {
	ViewContents
	Properties ViewProperties
}

View holds positional and visual information for a View.

func (View) MarshalJSON

func (c View) MarshalJSON() ([]byte, error)

func (*View) UnmarshalJSON

func (c *View) UnmarshalJSON(b []byte) error

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 string `json:"value"` // Value is the data value mapped to this color
}

ViewColor represents the encoding of data into visualizations

type ViewContents

type ViewContents struct {
	ID   ID     `json:"id"`
	Name string `json:"name"`
}

type ViewContentsUpdate

type ViewContentsUpdate struct {
	Name *string `json:"name"`
}

ViewContentsUpdate is a struct for updating the non properties content of a View.

type ViewFilter

type ViewFilter struct {
	ID *ID
}

ViewFilter represents a set of filter that restrict the returned results.

type ViewProperties

type ViewProperties interface {
	ViewProperties()
}

func UnmarshalViewPropertiesJSON

func UnmarshalViewPropertiesJSON(b []byte) (ViewProperties, error)

type ViewService

type ViewService interface {
	// FindViewByID returns a single View by ID.
	FindViewByID(ctx context.Context, id ID) (*View, error)

	// FindViews returns a list of Views that match filter and the total count of matching Views.
	// Additional options provide pagination & sorting.
	FindViews(ctx context.Context, filter ViewFilter) ([]*View, int, error)

	// CreateView creates a new View and sets b.ID with the new identifier.
	CreateView(ctx context.Context, b *View) error

	// UpdateView updates a single View with changeset.
	// Returns the new View state after update.
	UpdateView(ctx context.Context, id ID, upd ViewUpdate) (*View, error)

	// DeleteView removes a View by ID.
	DeleteView(ctx context.Context, id ID) error
}

ViewService represents a service for managing View data.

type ViewUpdate

type ViewUpdate struct {
	ViewContentsUpdate
	Properties ViewProperties
}

ViewUpdate is a struct for updating Views.

func (ViewUpdate) MarshalJSON

func (u ViewUpdate) MarshalJSON() ([]byte, error)

func (*ViewUpdate) UnmarshalJSON

func (u *ViewUpdate) UnmarshalJSON(b []byte) error

func (ViewUpdate) Valid

func (u ViewUpdate) Valid() error

Valid validates the update struct. It expects minimal values to be set.

Directories

Path Synopsis
bolt/internal
Package internal is a generated protocol buffer package.
Package internal is a generated protocol buffer package.
cmd/chronoctl command
cmd/chronograf command
id
log
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
fluxd command
influx command
influxd command
kit
cli
Package cli creates simple CLI options with ENV overrides using viper.
Package cli creates simple CLI options with ENV overrides using viper.
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 query contains the InfluxDB 2.0 query engine.
Package query contains the InfluxDB 2.0 query engine.
ast
Package ast declares the types used to represent the syntax tree for Flux source code.
Package ast declares the types used to represent the syntax tree for Flux source code.
ast/asttest
Package asttest implements utilities for testing the abstract syntax tree.
Package asttest implements utilities for testing the abstract syntax tree.
ast/asttest/cmpgen command
cmpgen generates comparison options for the asttest package.
cmpgen generates comparison options for the asttest package.
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.
compiler
The compiler package provides a compiler and Go runtime for a subset of the Flux language.
The compiler package provides a compiler and Go runtime for a subset of the Flux language.
complete
Package complete provides types to aid with auto-completion of Flux scripts in editors.
Package complete provides types to aid with auto-completion of Flux scripts in editors.
control
Package control controls which resources a query may consume.
Package control controls which resources a query may consume.
csv
Package csv contains the csv result encoders and decoders.
Package csv contains the csv result encoders and decoders.
execute
Package execute contains the implementation of the execution phase in the query engine.
Package execute contains the implementation of the execution phase in the query engine.
execute/executetest
Package executetest contains utilities for testing the query execution phase.
Package executetest contains utilities for testing the query execution phase.
functions
Package functions is a collection of built-in functions that are callable in the flux query processor.
Package functions is a collection of built-in functions that are callable in the flux query processor.
functions/storage
Package storage implements reading from a storage engine into a table as a data source.
Package storage implements reading from a storage engine into a table as a data source.
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.
interpreter
Package interpreter provides the implementation of the Flux interpreter.
Package interpreter provides the implementation of the Flux interpreter.
mock
Package mock contains mock implementations of the query package interfaces for testing.
Package mock contains mock implementations of the query package interfaces for testing.
options
Package options implements flux options.
Package options implements flux options.
parser
Package parser provides a PEG parser for parsing Flux.
Package parser provides a PEG parser for parsing Flux.
plan
Package plan implements the flux query planner to plan execution of a query spec.
Package plan implements the flux query planner to plan execution of a query spec.
plan/plantest
Package plantest contains utilities for testing the query planning phase.
Package plantest contains utilities for testing the query planning phase.
querytest
Package querytest contains utilities for testing the query end-to-end.
Package querytest contains utilities for testing the query end-to-end.
repl
Package repl implements the read-eval-print-loop for the command line flux query console.
Package repl implements the read-eval-print-loop for the command line flux query console.
semantic
The semantic package provides a graph structure that represents the meaning of a Flux script.
The semantic package provides a graph structure that represents the meaning of a Flux script.
semantic/semantictest
Package semantictest contains utilities for testing the semantic package.
Package semantictest contains utilities for testing the semantic package.
values
Package values declares the flux data types and implements them.
Package values declares the flux data types and implements them.
adaptertest
Package adaptertest provides tests to ensure that implementations of platform/task/backend.Store and platform/task/backend.LogReader meet the requirements of platform.TaskService.
Package adaptertest provides tests to ensure that implementations of platform/task/backend.Store and platform/task/backend.LogReader meet the requirements of platform.TaskService.
backend
Package backend is a generated protocol buffer package.
Package backend is a generated protocol buffer package.
backend/bolt
Package bolt provides an bolt-backed store implementation.
Package bolt provides an bolt-backed store implementation.
backend/executor
Package executor contains implementations of backend.Executor that depend on the query service.
Package executor contains implementations of backend.Executor that depend on the query service.
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.

Jump to

Keyboard shortcuts

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