influxdb

package module
v2.7.10 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: MIT Imports: 26 Imported by: 11

README ¶

InfluxDB

InfluxDB Logo

CircleCI Slack Status Docker Pulls Docker Pulls

Website • Documentation • InfluxDB University • Blog


InfluxDB is an open source time series platform. This includes APIs for storing and querying data, processing it in the background for ETL or monitoring and alerting purposes, user dashboards, and visualizing and exploring the data and more. The master branch on this repo now represents the latest InfluxDB, which now includes functionality for Kapacitor (background processing) and Chronograf (the UI) all in a single binary.

The list of InfluxDB Client Libraries that are compatible with the latest version can be found in our documentation.

If you are looking for the 1.x line of releases, there are branches for each minor version as well as a master-1.x branch that will contain the code for the next 1.x release. The master-1.x working branch is here. The InfluxDB 1.x Go Client can be found here.

Try InfluxDB Cloud for free and get started fast with no local setup required. Click here to start building your application on InfluxDB Cloud.

Install

We have nightly and versioned Docker images, Debian packages, RPM packages, and tarballs of InfluxDB available at the InfluxData downloads page. We also provide the influx command line interface (CLI) client as a separate binary available at the same location.

If you are interested in building from source, see the building from source guide for contributors.

Get Started

For a complete getting started guide, please see our full online documentation site.

To write and query data or use the API in any way, you'll need to first create a user, credentials, organization and bucket. Everything in InfluxDB is organized under a concept of an organization. The API is designed to be multi-tenant. Buckets represent where you store time series data. They're synonymous with what was previously in InfluxDB 1.x a database and retention policy.

The simplest way to get set up is to point your browser to http://localhost:8086 and go through the prompts.

You can also get set up from the CLI using the command influx setup:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: marty

Please type your password:

Please type your password again:

Please type your primary organization name.: InfluxData

Please type your primary bucket name.: telegraf

Please type your retention period in hours.
Or press ENTER for infinite.: 72


You have entered:
  Username:          marty
  Organization:      InfluxData
  Bucket:            telegraf
  Retention Period:  72 hrs
Confirm? (y/n): y

UserID                  Username        Organization    Bucket
033a3f2c5ccaa000        marty           InfluxData      Telegraf
Your token has been stored in /Users/marty/.influxdbv2/credentials

You can run this command non-interactively using the -f, --force flag if you are automating the setup. Some added flags can help:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx setup \
--username marty \
--password F1uxKapacit0r85 \
--org InfluxData \
--bucket telegraf \
--retention 168 \
--token where-were-going-we-dont-need-roads \
--force

Once setup is complete, a configuration profile is created to allow you to interact with your local InfluxDB without passing in credentials each time. You can list and manage those profiles using the influx config command.

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx config
Active	Name	URL			            Org
*	    default	http://localhost:8086	InfluxData

Write Data

Write to measurement m, with tag v=2, in bucket telegraf, which belongs to organization InfluxData:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx write --bucket telegraf --precision s "m v=2 $(date +%s)"

Since you have a default profile set up, you can omit the Organization and Token from the command.

Write the same point using curl:

curl --header "Authorization: Token $(bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx auth list --json | jq -r '.[0].token')" \
--data-raw "m v=2 $(date +%s)" \
"http://localhost:8086/api/v2/write?org=InfluxData&bucket=telegraf&precision=s"

Read that back with a simple Flux query:

$ bin/$(uname -s | tr '[:upper:]' '[:lower:]')/influx query 'from(bucket:"telegraf") |> range(start:-1h)'
Result: _result
Table: keys: [_start, _stop, _field, _measurement]
                   _start:time                      _stop:time           _field:string     _measurement:string                      _time:time                  _value:float
------------------------------  ------------------------------  ----------------------  ----------------------  ------------------------------  ----------------------------
2019-12-30T22:19:39.043918000Z  2019-12-30T23:19:39.043918000Z                       v                       m  2019-12-30T23:17:02.000000000Z                             2

Use the -r, --raw option to return the raw flux response from the query. This is useful for moving data from one instance to another as the influx write command can accept the Flux response using the --format csv option.

Script with Flux

Flux (previously named IFQL) is an open source functional data scripting language designed for querying, analyzing, and acting on data. Flux supports multiple data source types, including:

  • Time series databases (such as InfluxDB)
  • Relational SQL databases (such as MySQL and PostgreSQL)
  • CSV

The source for Flux is available on GitHub. To learn more about Flux, see the latest InfluxData Flux documentation and CTO Paul Dix's presentation.

Contribute to the Project

InfluxDB is an MIT licensed open source project and we love our community. The fastest way to get something fixed is to open a PR. Check out our contributing guide if you're interested in helping out. Also, join us on our Community Slack Workspace if you have questions or comments for our engineering teams.

CI and Static Analysis

CI

All pull requests will run through CI, which is currently hosted by Circle. Community contributors should be able to see the outcome of this process by looking at the checks on their PR. Please fix any issues to ensure a prompt review from members of the team.

The InfluxDB project is used internally in a number of proprietary InfluxData products, and as such, PRs and changes need to be tested internally. This can take some time, and is not really visible to community contributors.

Static Analysis

This project uses the following static analysis tools. Failure during the running of any of these tools results in a failed build. Generally, code must be adjusted to satisfy these tools, though there are exceptions.

  • go vet checks for Go code that should be considered incorrect.
  • go fmt checks that Go code is correctly formatted.
  • go mod tidy ensures that the source code and go.mod agree.
  • staticcheck checks for things like: unused code, code that can be simplified, code that is incorrect and code that will have performance issues.
staticcheck

If your PR fails staticcheck it is easy to dig into why it failed, and also to fix the problem. First, take a look at the error message in Circle under the staticcheck build section, e.g.,

tsdb/tsm1/encoding.gen.go:1445:24: func BooleanValues.assertOrdered is unused (U1000)
tsdb/tsm1/encoding.go:172:7: receiver name should not be an underscore, omit the name if it is unused (ST1006)

Next, go and take a look here for some clarification on the error code that you have received, e.g., U1000. The docs will tell you what's wrong, and often what you need to do to fix the issue.

Generated Code

Sometimes generated code will contain unused code or occasionally that will fail a different check. staticcheck allows for entire files to be ignored, though it's not ideal. A linter directive, in the form of a comment, must be placed within the generated file. This is problematic because it will be erased if the file is re-generated. Until a better solution comes about, below is the list of generated files that need an ignores comment. If you re-generate a file and find that staticcheck has failed, please see this list below for what you need to put back:

File Comment
query/promql/promql.go //lint:file-ignore SA6001 Ignore all unused code, it's generated
End-to-End Tests

CI also runs end-to-end tests. These test the integration between the influxd server the UI. Since the UI is used by interal repositories as well as the influxdb repository, the end-to-end tests cannot be run on forked pull requests or run locally. The extent of end-to-end testing required for forked pull requests will be determined as part of the review process.

Additional Resources

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	OpFindAuthorizationByID    = "FindAuthorizationByID"
	OpFindAuthorizationByToken = "FindAuthorizationByToken"
	OpFindAuthorizations       = "FindAuthorizations"
	OpCreateAuthorization      = "CreateAuthorization"
	OpUpdateAuthorization      = "UpdateAuthorization"
	OpDeleteAuthorization      = "DeleteAuthorization"
)

auth service op

View Source
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
	// DBRPType gives permission to one or more DBRPs.
	DBRPResourceType = ResourceType("dbrp") // 17
	// NotebooksResourceType gives permission to one or more notebooks.
	NotebooksResourceType = ResourceType("notebooks") // 18
	// AnnotationsResourceType gives permission to one or more annotations.
	AnnotationsResourceType = ResourceType("annotations") // 19
	// RemotesResourceType gives permission to one or more remote connections.
	RemotesResourceType = ResourceType("remotes") // 20
	// ReplicationsResourceType gives permission to one or more replications.
	ReplicationsResourceType = ResourceType("replications") // 21
	// InstanceResourceType is a special permission that allows ownership of the entire instance (creating orgs/operator tokens/etc)
	InstanceResourceType = ResourceType("instance") // 22
)
View Source
const (
	// 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
)
View Source
const (
	TasksSystemBucketName      = "_tasks"
	MonitoringSystemBucketName = "_monitoring"
)

Bucket names constants

View Source
const (
	CheckDefaultPageSize = 100
	CheckMaxPageSize     = 500
)

consts for checks config.

View Source
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.

View Source
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"
	ViewPropertyTypeMosaic             = "mosaic"
	ViewPropertyTypeBand               = "band"
	ViewPropertyTypeGeo                = "geo"
)

Values for all supported view property types.

View Source
const (
	OpFindLabels         = "FindLabels"
	OpFindLabelByID      = "FindLabelByID"
	OpFindLabelMapping   = "FindLabelMapping"
	OpCreateLabel        = "CreateLabel"
	OpCreateLabelMapping = "CreateLabelMapping"
	OpUpdateLabel        = "UpdateLabel"
	OpDeleteLabel        = "DeleteLabel"
	OpDeleteLabelMapping = "DeleteLabelMapping"
)
View Source
const (
	OrgIDLength       = 8
	BucketIDLength    = 8
	MeasurementLength = OrgIDLength + BucketIDLength
)

Length of components of measurement names.

View Source
const (
	OpFindOrganizationByID = "FindOrganizationByID"
	OpFindOrganization     = "FindOrganization"
	OpFindOrganizations    = "FindOrganizations"
	OpCreateOrganization   = "CreateOrganization"
	OpPutOrganization      = "PutOrganization"
	OpUpdateOrganization   = "UpdateOrganization"
	OpDeleteOrganization   = "DeleteOrganization"
)

ops for orgs error and orgs op logs.

View Source
const (
	DefaultPageSize = 20
	MaxPageSize     = 100
)
View Source
const (
	MinReplicationMaxQueueSizeBytes     int64 = 33554430 // 32 MiB
	DefaultReplicationMaxQueueSizeBytes       = 2 * MinReplicationMaxQueueSizeBytes
	DefaultReplicationMaxAge            int64 = 604800 // 1 week, in seconds
)
View Source
const (
	OpListTargets   = "ListTargets"
	OpAddTarget     = "AddTarget"
	OpGetTargetByID = "GetTargetByID"
	OpRemoveTarget  = "RemoveTarget"
	OpUpdateTarget  = "UpdateTarget"
)

ops for ScraperTarget Store

View Source
const (
	// V2SourceType is an InfluxDBv2 type.
	V2SourceType = "v2"
	// V1SourceType is an InfluxDBv1 type.
	V1SourceType = "v1"
	// SelfSourceType is the source hosting the UI.
	SelfSourceType = "self"
)
View Source
const (
	OpDefaultSource  = "DefaultSource"
	OpFindSourceByID = "FindSourceByID"
	OpFindSources    = "FindSources"
	OpCreateSource   = "CreateSource"
	OpUpdateSource   = "UpdateSource"
	OpDeleteSource   = "DeleteSource"
)

ops for sources.

View Source
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"
)
View Source
const (
	OpFindUserByID = "FindUserByID"
	OpFindUser     = "FindUser"
	OpFindUsers    = "FindUsers"
	OpCreateUser   = "CreateUser"
	OpUpdateUser   = "UpdateUser"
	OpDeleteUser   = "DeleteUser"
)

Ops for user errors and op log.

View Source
const (
	UserMappingType = 0
	OrgMappingType  = 1
)
View Source
const (
	OpFindVariableByID = "FindVariableByID"
	OpFindVariables    = "FindVariables"
	OpCreateVariable   = "CreateVariable"
	OpUpdateVariable   = "UpdateVariable"
	OpReplaceVariable  = "ReplaceVariable"
	OpDeleteVariable   = "DeleteVariable"
)

ops for variable error.

View Source
const AuthorizationKind = "authorization"

AuthorizationKind is returned by (*Authorization).Kind().

View Source
const (
	BackupFilenamePattern = "20060102T150405Z"
)
View Source
const DefaultLeaseTTL = time.Minute

DefaultLeaseTTL is used when a specific lease TTL is not requested.

View Source
const ErrCellNotFound = "cell not found"

ErrCellNotFound is the error msg for a missing cell.

View Source
const ErrDashboardNotFound = "dashboard not found"

ErrDashboardNotFound is the error msg for a missing dashboard.

View Source
const ErrDocumentNotFound = "document not found"

ErrDocumentNotFound is the error msg for a missing document.

View Source
const ErrLabelNotFound = "label not found"

ErrLabelNotFound is the error for a missing Label.

View Source
const ErrScraperTargetNotFound = "scraper target not found"

ErrScraperTargetNotFound is the error msg for a missing scraper target.

View Source
const ErrSecretNotFound = "secret not found"

ErrSecretNotFound is the error msg for a missing secret.

View Source
const ErrSessionExpired = "session has expired"

ErrSessionExpired is the error message for expired sessions.

View Source
const ErrSessionNotFound = "session not found"

ErrSessionNotFound is the error messages for a missing sessions.

View Source
const (
	// ErrSourceNotFound is an error message when a source does not exist.
	ErrSourceNotFound = "source not found"
)
View Source
const ErrVariableNotFound = "variable not found"

ErrVariableNotFound is the error msg for a missing variable.

View Source
const ErrViewNotFound = "view not found"

ErrViewNotFound is the error msg for a missing View.

View Source
const InfiniteRetention = 0

InfiniteRetention is default infinite retention period.

View Source
const (
	// PrometheusScraperType parses metrics from a prometheus endpoint.
	PrometheusScraperType = "prometheus"
)

Scraper types

View Source
const SessionAuthorizationKind = "session"

SessionAuthorizationKind defines the type of authorizer

Variables ¶

View Source
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")
)
View Source
var (
	OpFindBucketByID = "FindBucketByID"
	OpFindBucket     = "FindBucket"
	OpFindBuckets    = "FindBuckets"
	OpCreateBucket   = "CreateBucket"
	OpPutBucket      = "PutBucket"
	OpUpdateBucket   = "UpdateBucket"
	OpDeleteBucket   = "DeleteBucket"
)

ops for buckets error and buckets op logs.

View Source
var (
	OpFindCheckByID = "FindCheckByID"
	OpFindCheck     = "FindCheck"
	OpFindChecks    = "FindChecks"
	OpCreateCheck   = "CreateCheck"
	OpUpdateCheck   = "UpdateCheck"
	OpDeleteCheck   = "DeleteCheck"
)

ops for checks error

View Source
var (
	// ErrLabelNameisEmpty is error when org name is empty
	ErrLabelNameisEmpty = &errors.Error{
		Code: errors.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 = &errors.Error{
		Code: errors.EConflict,
		Msg:  "Cannot add label, label already exists on resource",
	}
)

errors on label

View Source
var (
	ErrMeasurementSchemaNameTooShort = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "too short",
	}

	ErrMeasurementSchemaNameTooLong = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "too long",
	}

	ErrMeasurementSchemaNameUnderscore = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "must not begin with _",
	}

	ErrMeasurementSchemaNameQuotes = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "must not contains single or double quotes",
	}

	ErrMeasurementSchemaColumnsMissing = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns missing",
	}

	ErrMeasurementSchemaColumnsMissingTime = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns missing time column with a timestamp semantic",
	}

	ErrMeasurementSchemaColumnsTimeInvalidSemantic = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema contains a time column with an invalid semantic",
	}

	ErrMeasurementSchemaColumnsTimestampSemanticInvalidName = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns contains a timestamp column that is not named time",
	}

	ErrMeasurementSchemaColumnsTimestampSemanticDataType = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns contains a time column with a data type",
	}

	ErrMeasurementSchemaColumnsTagSemanticDataType = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns contains a tag column with a data type",
	}

	ErrMeasurementSchemaColumnsFieldSemanticMissingDataType = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns contains a field column with missing data type",
	}

	ErrMeasurementSchemaColumnsMissingFields = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns requires at least one field type column",
	}

	ErrMeasurementSchemaColumnsDuplicateNames = &influxerror.Error{
		Code: influxerror.EInvalid,
		Msg:  "measurement schema columns contains duplicate column names",
	}
)
View Source
var (
	ErrOrgIDRequired  = fieldRequiredError("OrgID")
	ErrNameRequired   = fieldRequiredError("Name")
	ErrSpecRequired   = fieldRequiredError("Spec")
	ErrOffsetNegative = &errors.Error{
		Code: errors.EInvalid,
		Msg:  "offset cannot be negative",
	}
	ErrLimitLTEZero = &errors.Error{
		Code: errors.EInvalid,
		Msg:  "limit cannot be less-than or equal-to zero",
	}
	ErrNotebookNotFound = &errors.Error{
		Code: errors.ENotFound,
		Msg:  "notebook not found",
	}
)
View Source
var (
	OpFindNotificationEndpointByID = "FindNotificationEndpointByID"
	OpFindNotificationEndpoint     = "FindNotificationEndpoint"
	OpFindNotificationEndpoints    = "FindNotificationEndpoints"
	OpCreateNotificationEndpoint   = "CreateNotificationEndpoint"
	OpUpdateNotificationEndpoint   = "UpdateNotificationEndpoint"
	OpDeleteNotificationEndpoint   = "DeleteNotificationEndpoint"
)

ops for checks error

View Source
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"
)
View Source
var (
	OpFindTelegrafConfigByID = "FindTelegrafConfigByID"
	OpFindTelegrafConfigs    = "FindTelegrafConfigs"
	OpCreateTelegrafConfig   = "CreateTelegrafConfig"
	OpUpdateTelegrafConfig   = "UpdateTelegrafConfig"
	OpDeleteTelegrafConfig   = "DeleteTelegrafConfig"
)

ops for buckets error and buckets op logs.

View Source
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")
)

AllResourceTypes is the list of all known resource types.

View Source
var DefaultDashboardFindOptions = FindOptions{
	SortBy: "ID",
}

DefaultDashboardFindOptions are the default find options for dashboards

View Source
var DefaultOperationLogFindOptions = FindOptions{
	Descending: true,
	Limit:      100,
}

DefaultOperationLogFindOptions are the default options for the operation log.

View Source
var DefaultSessionLength = time.Hour

DefaultSessionLength is the default session length on initial creation.

View Source
var DefaultSourceFindOptions = FindOptions{}

DefaultSourceFindOptions are the default find options for sources

View Source
var DefaultVariableFindOptions = FindOptions{}

DefaultVariableFindOptions are the default find options for variables.

View Source
var (
	// ErrCredentialsUnauthorized is the error returned when CredentialsV1 cannot be
	// authorized.
	ErrCredentialsUnauthorized = &errors.Error{
		Code: errors.EUnauthorized,
		Msg:  "Unauthorized",
	}
)
View Source
var (
	// ErrInvalidNotificationEndpointType denotes that the provided NotificationEndpoint is not a valid type
	ErrInvalidNotificationEndpointType = errors.New("unknown notification endpoint type")
)
View Source
var ErrInvalidOrgFilter = &errors.Error{
	Code: errors.EInvalid,
	Msg:  "Please provide either orgID or org",
}

ErrInvalidOrgFilter is the error indicate org filter is empty

View Source
var ErrMaxQueueSizeTooSmall = errors.Error{
	Code: errors.EInvalid,
	Msg:  fmt.Sprintf("maxQueueSize too small, must be at least %d", MinReplicationMaxQueueSizeBytes),
}
View Source
var ErrNoAcquire = errors.New("ownership not acquired")

ErrNoAcquire is returned when it was not possible to acquire ownership of the semaphore.

View Source
var (
	// ErrOrgNameisEmpty is error when org name is empty
	ErrOrgNameisEmpty = &errors.Error{
		Code: errors.EInvalid,
		Msg:  "org name is empty",
	}
)

errors of org

View Source
var ErrUnableToCreateToken = &errors.Error{
	Msg:  "unable to create token",
	Code: errors.EInvalid,
}

ErrUnableToCreateToken sanitized error message for all errors when a user cannot create a token

View Source
var RenewSessionTime = time.Duration(time.Second * 300)

RenewSessionTime is the time to extend session, currently set to 5min.

Functions ¶

func CreateMeasurement ¶

func CreateMeasurement(org, bucket []byte) ([]byte, error)

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 FindOptionParams ¶

func FindOptionParams(opts ...FindOptions) [][2]string

func IsActive ¶

func IsActive(a *Authorization) bool

IsActive is a stub for idpe.

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 ¶

func ReadMeasurement(name []byte) (orgID, bucketID []byte, err error)

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 ¶

func ValidScraperType(s string) bool

ValidScraperType returns true is the type string is valid

func ValidateMeasurementSchemaName ¶ added in v2.1.0

func ValidateMeasurementSchemaName(name string) error

ValidateMeasurementSchemaName determines if name is a valid identifier for a measurement schema or column name and if not, returns an error.

Types ¶

type Action ¶

type Action string

Action is an enum defining all possible resource operations

const (
	// ReadAction is the action for reading.
	ReadAction Action = "read" // 1
	// WriteAction is the action for writing.
	WriteAction Action = "write" // 2
)

func (Action) Valid ¶

func (a Action) Valid() (err error)

Valid checks if the action is a member of the Action enum

type AddDashboardCellOptions ¶

type AddDashboardCellOptions struct {
	View *View
}

AddDashboardCellOptions are options for adding a dashboard.

type AnnotationCreate ¶ added in v2.1.0

type AnnotationCreate struct {
	StreamTag string             `json:"stream,omitempty"`    // StreamTag provides a means to logically group a set of annotated events.
	Summary   string             `json:"summary"`             // Summary is the only field required to annotate an event.
	Message   string             `json:"message,omitempty"`   // Message provides more details about the event being annotated.
	Stickers  AnnotationStickers `json:"stickers,omitempty"`  // Stickers are like tags, but named something obscure to differentiate them from influx tags. They are there to differentiate an annotated event.
	EndTime   *time.Time         `json:"endTime,omitempty"`   // EndTime is the time of the event being annotated. Defaults to now if not set.
	StartTime *time.Time         `json:"startTime,omitempty"` // StartTime is the start time of the event being annotated. Defaults to EndTime if not set.
}

AnnotationCreate contains user providable fields for annotating an event.

func (*AnnotationCreate) Validate ¶ added in v2.1.0

func (a *AnnotationCreate) Validate(nowFunc func() time.Time) error

Validate validates the creation object.

type AnnotationDeleteFilter ¶ added in v2.1.0

type AnnotationDeleteFilter struct {
	StreamTag string            `json:"stream,omitempty"`    // StreamTag provides a means to logically group a set of annotated events.
	StreamID  platform.ID       `json:"streamID,omitempty"`  // StreamID provides a means to logically group a set of annotated events.
	Stickers  map[string]string `json:"stickers,omitempty"`  // Stickers are like tags, but named something obscure to differentiate them from influx tags. They are there to differentiate an annotated event.
	EndTime   *time.Time        `json:"endTime,omitempty"`   // EndTime is the time of the event being annotated. Defaults to now if not set.
	StartTime *time.Time        `json:"startTime,omitempty"` // StartTime is the start time of the event being annotated. Defaults to EndTime if not set.
}

AnnotationDeleteFilter contains fields for deleting an annotated event.

func (*AnnotationDeleteFilter) SetStickers ¶ added in v2.1.0

func (a *AnnotationDeleteFilter) SetStickers(vals map[string][]string)

SetStickers sets the stickers from the query parameters.

func (*AnnotationDeleteFilter) Validate ¶ added in v2.1.0

func (a *AnnotationDeleteFilter) Validate() error

Validate validates the deletion object.

type AnnotationEvent ¶ added in v2.1.0

type AnnotationEvent struct {
	ID               platform.ID `json:"id,omitempty"` // ID is the annotation ID.
	AnnotationCreate             // AnnotationCreate defines the common input/output bits of an annotation.
}

AnnotationEvent contains fields for annotating an event.

type AnnotationList ¶ added in v2.1.0

type AnnotationList struct {
	StreamTag   string           `json:"stream"`
	Annotations []ReadAnnotation `json:"annotations"`
}

AnnotationList defines the structure of the response when listing annotations.

type AnnotationListFilter ¶ added in v2.1.0

type AnnotationListFilter struct {
	StickerIncludes AnnotationStickers `json:"stickerIncludes,omitempty"` // StickerIncludes allows the user to filter annotated events based on it's sticker.
	StreamIncludes  []string           `json:"streamIncludes,omitempty"`  // StreamIncludes allows the user to filter annotated events by stream.
	BasicFilter
}

AnnotationListFilter is a selection filter for listing annotations.

func (*AnnotationListFilter) SetStickerIncludes ¶ added in v2.1.0

func (f *AnnotationListFilter) SetStickerIncludes(vals map[string][]string)

SetStickerIncludes sets the stickerIncludes from the query parameters.

func (*AnnotationListFilter) Validate ¶ added in v2.1.0

func (f *AnnotationListFilter) Validate(nowFunc func() time.Time) error

Validate validates the filter.

type AnnotationService ¶ added in v2.1.0

type AnnotationService interface {
	// CreateAnnotations creates annotations.
	CreateAnnotations(ctx context.Context, orgID platform.ID, create []AnnotationCreate) ([]AnnotationEvent, error)
	// ListAnnotations lists all annotations matching the filter.
	ListAnnotations(ctx context.Context, orgID platform.ID, filter AnnotationListFilter) ([]StoredAnnotation, error)
	// GetAnnotation gets an annotation by id.
	GetAnnotation(ctx context.Context, id platform.ID) (*StoredAnnotation, error)
	// DeleteAnnotations deletes annotations matching the filter.
	DeleteAnnotations(ctx context.Context, orgID platform.ID, delete AnnotationDeleteFilter) error
	// DeleteAnnotation deletes an annotation by id.
	DeleteAnnotation(ctx context.Context, id platform.ID) error
	// UpdateAnnotation updates an annotation.
	UpdateAnnotation(ctx context.Context, id platform.ID, update AnnotationCreate) (*AnnotationEvent, error)

	// ListStreams lists all streams matching the filter.
	ListStreams(ctx context.Context, orgID platform.ID, filter StreamListFilter) ([]StoredStream, error)
	// CreateOrUpdateStream creates or updates the matching stream by name.
	CreateOrUpdateStream(ctx context.Context, orgID platform.ID, stream Stream) (*ReadStream, error)
	// GetStream gets a stream by id. Currently this is only used for authorization, and there are no
	// API routes for getting a single stream by ID.
	GetStream(ctx context.Context, id platform.ID) (*StoredStream, error)
	// UpdateStream updates the stream by the ID.
	UpdateStream(ctx context.Context, id platform.ID, stream Stream) (*ReadStream, error)
	// DeleteStreams deletes one or more streams by name.
	DeleteStreams(ctx context.Context, orgID platform.ID, delete BasicStream) error
	// DeleteStreamByID deletes the stream metadata by id.
	DeleteStreamByID(ctx context.Context, id platform.ID) error
}

AnnotationService is the service contract for Annotations

type AnnotationStickers ¶ added in v2.1.0

type AnnotationStickers map[string]string

func (*AnnotationStickers) Scan ¶ added in v2.1.0

func (a *AnnotationStickers) Scan(value interface{}) error

Scan implements the database/sql Scanner interface for retrieving AnnotationStickers from the database The string is decoded into a slice of strings, which are then converted back into a map

func (AnnotationStickers) Value ¶ added in v2.1.0

func (a AnnotationStickers) Value() (driver.Value, error)

Value implements the database/sql Valuer interface for adding AnnotationStickers to the database Stickers are stored in the database as a slice of strings like "[key=val]" They are encoded into a JSON string for storing into the database, and the JSON sqlite extension is able to manipulate them like an object.

type Authorization ¶

type Authorization struct {
	ID          platform.ID  `json:"id"`
	Token       string       `json:"token"`
	Status      Status       `json:"status"`
	Description string       `json:"description"`
	OrgID       platform.ID  `json:"orgID"`
	UserID      platform.ID  `json:"userID,omitempty"`
	Permissions []Permission `json:"permissions"`
	CRUDLog
}

Authorization is an authorization. 🎉

func (*Authorization) GetUserID ¶

func (a *Authorization) GetUserID() platform.ID

GetUserID returns the user id.

func (*Authorization) Identifier ¶

func (a *Authorization) Identifier() platform.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) PermissionSet ¶

func (a *Authorization) PermissionSet() (PermissionSet, error)

PermissionSet returns the set of permissions associated with the Authorization.

func (*Authorization) Valid ¶

func (a *Authorization) Valid() error

Valid ensures that the authorization is valid.

type AuthorizationFilter ¶

type AuthorizationFilter struct {
	Token *string
	ID    *platform.ID

	UserID *platform.ID
	User   *string

	OrgID *platform.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 platform.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 platform.ID, upd *AuthorizationUpdate) (*Authorization, error)

	// Removes a authorization by token.
	DeleteAuthorization(ctx context.Context, id platform.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 {
	// PermissionSet returns the PermissionSet associated with the authorizer
	PermissionSet() (PermissionSet, error)

	// ID returns an identifier used for auditing.
	Identifier() platform.ID

	// GetUserID returns the user id.
	GetUserID() platform.ID

	// Kind metadata for auditing.
	Kind() string
}

Authorizer will authorize a permission.

type AuthorizerV1 ¶

type AuthorizerV1 interface {
	Authorize(ctx context.Context, v1 CredentialsV1) (*Authorization, error)
}

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 {
	// BackupKVStore creates a live backup copy of the metadata database.
	BackupKVStore(ctx context.Context, w io.Writer) error

	// BackupShard downloads a backup file for a single shard.
	BackupShard(ctx context.Context, w io.Writer, shardID uint64, since time.Time) error

	// RLockKVStore locks the database.
	RLockKVStore()

	// RUnlockKVStore unlocks the database.
	RUnlockKVStore()
}

BackupService represents the data backup functions of InfluxDB.

type BandViewProperties ¶

type BandViewProperties struct {
	Queries                    []DashboardQuery `json:"queries"`
	Axes                       map[string]Axis  `json:"axes"`
	Type                       string           `json:"type"`
	StaticLegend               StaticLegend     `json:"staticLegend"`
	Geom                       string           `json:"geom"`
	ViewColors                 []ViewColor      `json:"colors"`
	Note                       string           `json:"note"`
	ShowNoteWhenEmpty          bool             `json:"showNoteWhenEmpty"`
	TimeFormat                 string           `json:"timeFormat"`
	HoverDimension             string           `json:"hoverDimension"`
	XColumn                    string           `json:"xColumn"`
	GenerateXAxisTicks         []string         `json:"generateXAxisTicks"`
	XTotalTicks                int              `json:"xTotalTicks"`
	XTickStart                 float64          `json:"xTickStart"`
	XTickStep                  float64          `json:"xTickStep"`
	YColumn                    string           `json:"yColumn"`
	GenerateYAxisTicks         []string         `json:"generateYAxisTicks"`
	YTotalTicks                int              `json:"yTotalTicks"`
	YTickStart                 float64          `json:"yTickStart"`
	YTickStep                  float64          `json:"yTickStep"`
	UpperColumn                string           `json:"upperColumn"`
	MainColumn                 string           `json:"mainColumn"`
	LowerColumn                string           `json:"lowerColumn"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

BandViewProperties represents options for the band view

func (BandViewProperties) GetType ¶

func (v BandViewProperties) GetType() string

type BasicFilter ¶ added in v2.1.0

type BasicFilter struct {
	StartTime *time.Time `json:"startTime,omitempty"` // StartTime is the time the event being annotated started.
	EndTime   *time.Time `json:"endTime,omitempty"`   // EndTime is the time the event being annotated ended.
}

BasicFilter defines common filter options.

func (*BasicFilter) Validate ¶ added in v2.1.0

func (f *BasicFilter) Validate(nowFunc func() time.Time) error

Validate validates the basic filter options, setting sane defaults where appropriate.

type BasicStream ¶ added in v2.1.0

type BasicStream struct {
	Names []string `json:"stream"`
}

BasicStream defines a stream by name. Used for stream deletes.

func (BasicStream) IsValid ¶ added in v2.1.0

func (s BasicStream) IsValid() bool

IsValid validates the stream is not empty.

type Bucket ¶

type Bucket struct {
	ID                  platform.ID   `json:"id,omitempty"`
	OrgID               platform.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"`
	ShardGroupDuration  time.Duration `json:"shardGroupDuration"`
	CRUDLog
}

Bucket is a bucket. 🎉

func (*Bucket) Clone ¶

func (b *Bucket) Clone() *Bucket

Clone returns a shallow copy of b.

type BucketFilter ¶

type BucketFilter struct {
	ID             *platform.ID
	Name           *string
	OrganizationID *platform.ID
	Org            *string
}

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 BucketManifestWriter ¶ added in v2.1.0

type BucketManifestWriter interface {
	WriteManifest(ctx context.Context, w io.Writer) error
}

type BucketMetadataManifest ¶ added in v2.1.0

type BucketMetadataManifest struct {
	OrganizationID         platform.ID               `json:"organizationID"`
	OrganizationName       string                    `json:"organizationName"`
	BucketID               platform.ID               `json:"bucketID"`
	BucketName             string                    `json:"bucketName"`
	Description            *string                   `json:"description,omitempty"`
	DefaultRetentionPolicy string                    `json:"defaultRetentionPolicy"`
	RetentionPolicies      []RetentionPolicyManifest `json:"retentionPolicies"`
}

BucketMetadataManifest contains the information about a bucket for backup purposes. It is composed of various nested structs below.

type BucketOperationLogService ¶

type BucketOperationLogService interface {
	// GetBucketOperationLog retrieves the operation log for the bucket with the provided id.
	GetBucketOperationLog(ctx context.Context, id platform.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 platform.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 platform.ID, upd BucketUpdate) (*Bucket, error)

	// DeleteBucket removes a bucket by ID.
	DeleteBucket(ctx context.Context, id platform.ID) error
	FindBucketByName(ctx context.Context, orgID platform.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
	Description        *string
	RetentionPeriod    *time.Duration
	ShardGroupDuration *time.Duration
}

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"`
		FillValues bool   `json:"fillValues"`
	} `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 ¶

func (log *CRUDLog) SetCreatedAt(now time.Time)

SetCreatedAt set the created time.

func (*CRUDLog) SetUpdatedAt ¶

func (log *CRUDLog) SetUpdatedAt(now time.Time)

SetUpdatedAt set the updated time.

type CRUDLogSetter ¶

type CRUDLogSetter interface {
	SetCreatedAt(now time.Time)
	SetUpdatedAt(now time.Time)
}

CRUDLogSetter is the interface to set the crudlog.

type Cell ¶

type Cell struct {
	ID platform.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) MarshalJSON ¶

func (c *Cell) MarshalJSON() ([]byte, error)

Marshals the cell

func (*Cell) UnmarshalJSON ¶

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

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() *errors.Error

Valid returns an error if the cell update is invalid.

type Check ¶

type Check interface {
	Valid(lang fluxlang.FluxLanguageService) error
	Type() string
	ClearPrivateData()
	SetTaskID(platform.ID)
	GetTaskID() platform.ID
	GetOwnerID() platform.ID
	SetOwnerID(platform.ID)
	GenerateFlux(lang fluxlang.FluxLanguageService) (string, error)
	json.Marshaler

	CRUDLogSetter
	SetID(id platform.ID)
	SetOrgID(id platform.ID)
	SetName(name string)
	SetDescription(description string)

	GetID() platform.ID
	GetCRUDLog() CRUDLog
	GetOrgID() platform.ID
	GetName() string
	GetDescription() string
}

Check represents the information required to generate a periodic check task.

type CheckCreate ¶

type CheckCreate struct {
	Check
	Status Status `json:"status"`
}

CheckCreate represent data to create a new Check

type CheckFilter ¶

type CheckFilter struct {
	ID    *platform.ID
	Name  *string
	OrgID *platform.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 {
	// FindCheckByID returns a single check by ID.
	FindCheckByID(ctx context.Context, id platform.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 platform.ID) error

	// UpdateCheck updates the whole check.
	// Returns the new check state after update.
	UpdateCheck(ctx context.Context, id platform.ID, c CheckCreate) (Check, error)

	// PatchCheck updates a single bucket with changeset.
	// Returns the new check state after update.
	PatchCheck(ctx context.Context, id platform.ID, upd CheckUpdate) (Check, error)

	// DeleteCheck will delete the check by id.
	DeleteCheck(ctx context.Context, id platform.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"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

CheckViewProperties represents options for a view representing a check

func (CheckViewProperties) GetType ¶

func (v CheckViewProperties) GetType() string

type CreateRemoteConnectionRequest ¶ added in v2.2.0

type CreateRemoteConnectionRequest struct {
	OrgID            platform.ID  `json:"orgID"`
	Name             string       `json:"name"`
	Description      *string      `json:"description,omitempty"`
	RemoteURL        string       `json:"remoteURL"`
	RemoteToken      string       `json:"remoteAPIToken"`
	RemoteOrgID      *platform.ID `json:"remoteOrgID"`
	AllowInsecureTLS bool         `json:"allowInsecureTLS"`
}

CreateRemoteConnectionRequest contains all info needed to establish a new connection to a remote InfluxDB instance.

type CreateReplicationRequest ¶ added in v2.2.0

type CreateReplicationRequest struct {
	OrgID                platform.ID `json:"orgID"`
	Name                 string      `json:"name"`
	Description          *string     `json:"description,omitempty"`
	RemoteID             platform.ID `json:"remoteID"`
	LocalBucketID        platform.ID `json:"localBucketID"`
	RemoteBucketID       platform.ID `json:"remoteBucketID"`
	RemoteBucketName     string      `json:"remoteBucketName"`
	MaxQueueSizeBytes    int64       `json:"maxQueueSizeBytes,omitempty"`
	DropNonRetryableData bool        `json:"dropNonRetryableData,omitempty"`
	MaxAgeSeconds        int64       `json:"maxAgeSeconds,omitempty"`
}

CreateReplicationRequest contains all info needed to establish a new replication to a remote InfluxDB bucket.

func (*CreateReplicationRequest) OK ¶ added in v2.2.0

type CredentialsV1 ¶

type CredentialsV1 struct {
	Scheme   SchemeV1
	Username string
	Token    string
}

CredentialsV1 encapsulates the required credentials to authorize a v1 HTTP request.

type DBRPMapping ¶

type DBRPMapping struct {
	ID              platform.ID `json:"id"`
	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"`
	// Virtual indicates if this is a virtual mapping (tied to bucket name) or physical
	Virtual bool `json:"virtual"`

	OrganizationID platform.ID `json:"orgID"`
	BucketID       platform.ID `json:"bucketID"`
}

DBRPMapping represents a mapping of a 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 {
	ID       *platform.ID
	OrgID    *platform.ID
	BucketID *platform.ID

	Database        *string
	RetentionPolicy *string
	Default         *bool
	Virtual         *bool
}

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

func (DBRPMappingFilter) String ¶

func (f DBRPMappingFilter) String() string

type DBRPMappingService ¶

type DBRPMappingService interface {
	// FindBy returns the dbrp mapping for the specified ID.
	// Requires orgID because every resource will be org-scoped.
	FindByID(ctx context.Context, orgID, id platform.ID) (*DBRPMapping, error)
	// FindMany returns a list of dbrp mappings that match filter and the total count of matching dbrp mappings.
	FindMany(ctx context.Context, dbrp DBRPMappingFilter, opts ...FindOptions) ([]*DBRPMapping, int, error)
	// Create creates a new dbrp mapping, if a different mapping exists an error is returned.
	Create(ctx context.Context, dbrp *DBRPMapping) error
	// Update a new dbrp mapping
	Update(ctx context.Context, dbrp *DBRPMapping) error
	// Delete removes a dbrp mapping.
	// Deleting a mapping that does not exists is not an error.
	// Requires orgID because every resource will be org-scoped.
	Delete(ctx context.Context, orgID, id platform.ID) error
}

DBRPMappingService provides CRUD to DBRPMappingV2s.

type Dashboard ¶

type Dashboard struct {
	ID             platform.ID   `json:"id,omitempty"`
	OrganizationID platform.ID   `json:"orgID,omitempty"`
	Name           string        `json:"name"`
	Description    string        `json:"description"`
	Cells          []*Cell       `json:"cells"`
	Meta           DashboardMeta `json:"meta"`
	OwnerID        *platform.ID  `json:"owner,omitempty"`
}

Dashboard represents all visual and query data for a dashboard.

type DashboardFilter ¶

type DashboardFilter struct {
	IDs            []*platform.ID
	OrganizationID *platform.ID
	Organization   *string
	OwnerID        *platform.ID
}

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 platform.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 platform.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 platform.ID, upd DashboardUpdate) (*Dashboard, error)

	// AddDashboardCell adds a cell to a dashboard.
	AddDashboardCell(ctx context.Context, id platform.ID, c *Cell, opts AddDashboardCellOptions) error

	// RemoveDashboardCell removes a dashboard.
	RemoveDashboardCell(ctx context.Context, dashboardID, cellID platform.ID) error

	// UpdateDashboardCell replaces the dashboard cell with the provided ID.
	UpdateDashboardCell(ctx context.Context, dashboardID, cellID platform.ID, upd CellUpdate) (*Cell, error)

	// GetDashboardCellView retrieves a dashboard cells view.
	GetDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID) (*View, error)

	// UpdateDashboardCellView retrieves a dashboard cells view.
	UpdateDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID, upd ViewUpdate) (*View, error)

	// DeleteDashboard removes a dashboard by ID.
	DeleteDashboard(ctx context.Context, id platform.ID) error

	// ReplaceDashboardCells replaces all cells in a dashboard
	ReplaceDashboardCells(ctx context.Context, id platform.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() *errors.Error

Valid returns an error if the dashboard update is invalid.

type Datum ¶ added in v2.1.0

type Datum struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

Geographical coordinates

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 DeleteService ¶

type DeleteService interface {
	DeleteBucketRangePredicate(ctx context.Context, orgID, bucketID platform.ID, min, max int64, pred Predicate, measurement influxql.Expr) error
}

DeleteService will delete a bucket from the range and predict.

type Document ¶

type Document struct {
	ID      platform.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[platform.ID]UserType `json:"-"`
}

Document is a generic structure for stating data.

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 platform.ID) (*Document, error)

	FindDocuments(ctx context.Context, orgID platform.ID) ([]*Document, 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 ¶

type Duration struct {
	time.Duration
}

Duration is based on time.Duration to embed in any struct.

func (Duration) MarshalJSON ¶

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Duration) UnmarshalJSON ¶

func (d *Duration) UnmarshalJSON(b []byte) error

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 FindOptions ¶

type FindOptions struct {
	Limit      int
	Offset     int
	After      *platform.ID
	SortBy     string
	Descending bool
}

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) GetLimit ¶

func (f *FindOptions) GetLimit() int

GetLimit returns the resolved limit between then limit boundaries. Given a limit <= 0 it returns the default limit.

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 GeoLayer ¶ added in v2.1.0

type GeoLayer struct {
	Type           string `json:"type"`
	RadiusField    string `json:"radiusField"`
	ColorField     string `json:"colorField"`
	IntensityField string `json:"intensityField"`
	// circle layer properties
	ViewColors         []ViewColor `json:"colors"`
	Radius             int32       `json:"radius"`
	Blur               int32       `json:"blur"`
	RadiusDimension    Axis        `json:"radiusDimension,omitempty"`
	ColorDimension     Axis        `json:"colorDimension,omitempty"`
	IntensityDimension Axis        `json:"intensityDimension,omitempty"`
	InterpolateColors  bool        `json:"interpolateColors"`
	// track layer properties
	TrackWidth   int32 `json:"trackWidth"`
	Speed        int32 `json:"speed"`
	RandomColors bool  `json:"randomColors"`
	// point layer properties
	IsClustered bool `json:"isClustered"`
}

Single visualization layer properties of a chronograf map widget

type GeoViewProperties ¶ added in v2.1.0

type GeoViewProperties struct {
	Type                   string           `json:"type"`
	Queries                []DashboardQuery `json:"queries"`
	Center                 Datum            `json:"center"`
	Zoom                   float64          `json:"zoom"`
	MapStyle               string           `json:"mapStyle"`
	AllowPanAndZoom        bool             `json:"allowPanAndZoom"`
	DetectCoordinateFields bool             `json:"detectCoordinateFields"`
	ViewColor              []ViewColor      `json:"colors"`
	GeoLayers              []GeoLayer       `json:"layers"`
	Note                   string           `json:"note"`
	ShowNoteWhenEmpty      bool             `json:"showNoteWhenEmpty"`
}

GeoViewProperties represents options for map view in Chronograf

func (GeoViewProperties) GetType ¶ added in v2.1.0

func (v GeoViewProperties) GetType() string

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"`
	GenerateXAxisTicks         []string         `json:"generateXAxisTicks"`
	XTotalTicks                int              `json:"xTotalTicks"`
	XTickStart                 float64          `json:"xTickStart"`
	XTickStep                  float64          `json:"xTickStep"`
	YColumn                    string           `json:"yColumn"`
	GenerateYAxisTicks         []string         `json:"generateYAxisTicks"`
	YTotalTicks                int              `json:"yTotalTicks"`
	YTickStart                 float64          `json:"yTickStart"`
	YTickStep                  float64          `json:"yTickStep"`
	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"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

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"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

HistogramViewProperties represents options for histogram view in Chronograf

func (HistogramViewProperties) GetType ¶

func (v HistogramViewProperties) GetType() string

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         platform.ID       `json:"id,omitempty"`
	OrgID      platform.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.

func (*Label) Validate ¶

func (l *Label) Validate() error

Validate returns an error if the label is invalid.

type LabelFilter ¶

type LabelFilter struct {
	Name  string
	OrgID *platform.ID
}

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

type LabelMapping ¶

type LabelMapping struct {
	LabelID      platform.ID `json:"labelID"`
	ResourceID   platform.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 platform.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 platform.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 platform.ID, upd LabelUpdate) (*Label, error)

	// DeleteLabel deletes a label
	DeleteLabel(ctx context.Context, id platform.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 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"`
	StaticLegend               StaticLegend     `json:"staticLegend"`
	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"`
	GenerateXAxisTicks         []string         `json:"generateXAxisTicks"`
	XTotalTicks                int              `json:"xTotalTicks"`
	XTickStart                 float64          `json:"xTickStart"`
	XTickStep                  float64          `json:"xTickStep"`
	YColumn                    string           `json:"yColumn"`
	GenerateYAxisTicks         []string         `json:"generateYAxisTicks"`
	YTotalTicks                int              `json:"yTotalTicks"`
	YTickStart                 float64          `json:"yTickStart"`
	YTickStep                  float64          `json:"yTickStep"`
	ShadeBelow                 bool             `json:"shadeBelow"`
	Position                   string           `json:"position"`
	TimeFormat                 string           `json:"timeFormat"`
	HoverDimension             string           `json:"hoverDimension"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

LinePlusSingleStatProperties represents options for line plus single stat view in Chronograf

func (LinePlusSingleStatProperties) GetType ¶

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 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 {
	// FindResourceName returns the name for the resource and ID.
	FindResourceName(ctx context.Context, resource ResourceType, id platform.ID) (string, error)
}

LookupService provides field lookup for the resource and ID.

type Manifest ¶

type Manifest struct {
	KV    ManifestKVEntry `json:"kv"`
	Files []ManifestEntry `json:"files"`
}

Manifest lists the KV and shard file information contained in the backup.

func (*Manifest) Size ¶

func (m *Manifest) Size() int64

Size returns the size of the manifest.

type ManifestEntry ¶

type ManifestEntry struct {
	OrganizationID   string    `json:"organizationID"`
	OrganizationName string    `json:"organizationName"`
	BucketID         string    `json:"bucketID"`
	BucketName       string    `json:"bucketName"`
	ShardID          uint64    `json:"shardID"`
	FileName         string    `json:"fileName"`
	Size             int64     `json:"size"`
	LastModified     time.Time `json:"lastModified"`
}

ManifestEntry contains the data information for a backed up shard.

type ManifestKVEntry ¶

type ManifestKVEntry struct {
	FileName string `json:"fileName"`
	Size     int64  `json:"size"`
}

ManifestKVEntry contains the KV store information for a backup.

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 ¶

type MarkdownViewProperties struct {
	Type string `json:"type"`
	Note string `json:"note"`
}

func (MarkdownViewProperties) GetType ¶

func (v MarkdownViewProperties) GetType() string

type MeasurementSchema ¶ added in v2.1.0

type MeasurementSchema struct {
	ID       influxid.ID               `json:"id,omitempty"`
	OrgID    influxid.ID               `json:"orgID"`
	BucketID influxid.ID               `json:"bucketID"`
	Name     string                    `json:"name"`
	Columns  []MeasurementSchemaColumn `json:"columns"`
	CRUDLog
}

func (*MeasurementSchema) Validate ¶ added in v2.1.0

func (m *MeasurementSchema) Validate() error

type MeasurementSchemaColumn ¶ added in v2.1.0

type MeasurementSchemaColumn struct {
	Name     string                `json:"name"`
	Type     SemanticColumnType    `json:"type"`
	DataType *SchemaColumnDataType `json:"dataType,omitempty"`
}

type MosaicViewProperties ¶

type MosaicViewProperties struct {
	Type                       string           `json:"type"`
	Queries                    []DashboardQuery `json:"queries"`
	ViewColors                 []string         `json:"colors"`
	FillColumns                []string         `json:"fillColumns"`
	XColumn                    string           `json:"xColumn"`
	GenerateXAxisTicks         []string         `json:"generateXAxisTicks"`
	XTotalTicks                int              `json:"xTotalTicks"`
	XTickStart                 float64          `json:"xTickStart"`
	XTickStep                  float64          `json:"xTickStep"`
	YLabelColumnSeparator      string           `json:"yLabelColumnSeparator"`
	YLabelColumns              []string         `json:"yLabelColumns"`
	YSeriesColumns             []string         `json:"ySeriesColumns"`
	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"`
	HoverDimension             string           `json:"hoverDimension"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

MosaicViewProperties represents options for mosaic view in Chronograf

func (MosaicViewProperties) GetType ¶

func (v MosaicViewProperties) GetType() string

type Notebook ¶ added in v2.1.0

type Notebook struct {
	OrgID     platform.ID  `json:"orgID" db:"org_id"`
	ID        platform.ID  `json:"id" db:"id"`
	Name      string       `json:"name" db:"name"`
	Spec      NotebookSpec `json:"spec" db:"spec"`
	CreatedAt time.Time    `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time    `json:"updatedAt" db:"updated_at"`
}

Notebook represents all visual and query data for a notebook.

type NotebookListFilter ¶ added in v2.1.0

type NotebookListFilter struct {
	OrgID platform.ID
	Page  Page
}

NotebookListFilter is a selection filter for listing notebooks.

type NotebookReqBody ¶ added in v2.1.0

type NotebookReqBody struct {
	OrgID platform.ID  `json:"orgID"`
	Name  string       `json:"name"`
	Spec  NotebookSpec `json:"spec"`
}

NotebookReqBody contains fields for creating or updating notebooks.

func (NotebookReqBody) Validate ¶ added in v2.1.0

func (n NotebookReqBody) Validate() error

Validate validates the creation object

type NotebookService ¶ added in v2.1.0

type NotebookService interface {
	GetNotebook(ctx context.Context, id platform.ID) (*Notebook, error)
	CreateNotebook(ctx context.Context, create *NotebookReqBody) (*Notebook, error)
	UpdateNotebook(ctx context.Context, id platform.ID, update *NotebookReqBody) (*Notebook, error)
	DeleteNotebook(ctx context.Context, id platform.ID) error
	ListNotebooks(ctx context.Context, filter NotebookListFilter) ([]*Notebook, error)
}

NotebookService is the service contract for Notebooks.

type NotebookSpec ¶ added in v2.1.0

type NotebookSpec map[string]interface{}

NotebookSpec is an abitrary JSON object provided by the client.

func (*NotebookSpec) Scan ¶ added in v2.1.0

func (s *NotebookSpec) Scan(value interface{}) error

Scan implements the database/sql Scanner interface for retrieving NotebookSpecs from the database.

func (NotebookSpec) Value ¶ added in v2.1.0

func (s NotebookSpec) Value() (driver.Value, error)

Value implements the database/sql Valuer interface for adding NotebookSpecs to the database.

type NotificationEndpoint ¶

type NotificationEndpoint interface {
	Valid() error
	Type() string
	json.Marshaler
	CRUDLogSetter
	SetID(id platform.ID)
	SetOrgID(id platform.ID)
	SetName(name string)
	SetDescription(description string)
	SetStatus(status Status)

	GetID() platform.ID
	GetCRUDLog() CRUDLog
	GetOrgID() platform.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    *platform.ID
	OrgID *platform.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 {
	// FindNotificationEndpointByID returns a single notification endpoint by ID.
	FindNotificationEndpointByID(ctx context.Context, id platform.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 platform.ID) error

	// UpdateNotificationEndpoint updates a single notification endpoint.
	// Returns the new notification endpoint after update.
	UpdateNotificationEndpoint(ctx context.Context, id platform.ID, nr NotificationEndpoint, userID platform.ID) (NotificationEndpoint, error)

	// PatchNotificationEndpoint updates a single  notification endpoint with changeset.
	// Returns the new notification endpoint state after update.
	PatchNotificationEndpoint(ctx context.Context, id platform.ID, upd NotificationEndpointUpdate) (NotificationEndpoint, error)

	// DeleteNotificationEndpoint removes a notification endpoint by ID, returns secret fields, orgID for further deletion.
	DeleteNotificationEndpoint(ctx context.Context, id platform.ID) (flds []SecretField, orgID platform.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 platform.ID)
	SetOrgID(id platform.ID)
	SetName(name string)
	SetDescription(description string)
	GetID() platform.ID
	GetCRUDLog() CRUDLog
	GetOrgID() platform.ID
	GetName() string
	GetDescription() string
	SetOwnerID(id platform.ID)
	ClearPrivateData()
	GetOwnerID() platform.ID
	SetTaskID(id platform.ID)
	GetTaskID() platform.ID
	GetEndpointID() platform.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        *platform.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 {
	// FindNotificationRuleByID returns a single notification rule by ID.
	FindNotificationRuleByID(ctx context.Context, id platform.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 platform.ID) error

	// UpdateNotificationRuleUpdateNotificationRule updates a single notification rule.
	// Returns the new notification rule after update.
	UpdateNotificationRule(ctx context.Context, id platform.ID, nr NotificationRuleCreate, userID platform.ID) (NotificationRule, error)

	// PatchNotificationRule updates a single  notification rule with changeset.
	// Returns the new notification rule state after update.
	PatchNotificationRule(ctx context.Context, id platform.ID, upd NotificationRuleUpdate) (NotificationRule, error)

	// DeleteNotificationRule removes a notification rule by ID.
	DeleteNotificationRule(ctx context.Context, id platform.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"`
	RetentionPeriodSeconds    int64         `json:"retentionPeriodSeconds,omitempty"`
	RetentionPeriodDeprecated time.Duration `json:"retentionPeriodHrs,omitempty"`
	Token                     string        `json:"token,omitempty"`
}

OnboardingRequest is the request to setup defaults.

func (*OnboardingRequest) RetentionPeriod ¶

func (r *OnboardingRequest) RetentionPeriod() time.Duration

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 creates the initial org/user/bucket in the DB.
	OnboardInitialUser(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      platform.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.

const (
	Equal Operator = iota
	NotEqual
	RegexEqual
	NotRegexEqual
)

operators

func ToOperator ¶

func ToOperator(s string) (Operator, bool)

ToOperator converts a string into its equivalent Operator.

func (Operator) MarshalJSON ¶

func (op Operator) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshal interface.

func (Operator) String ¶

func (op Operator) String() string

String returns the string value of the operator.

func (*Operator) UnmarshalJSON ¶

func (op *Operator) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler interface.

func (Operator) Valid ¶

func (op Operator) Valid() error

Valid returns invalid error if the operator is invalid.

type Organization ¶

type Organization struct {
	ID          platform.ID `json:"id,omitempty"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	CRUDLog
}

Organization is an organization. 🎉

type OrganizationFilter ¶

type OrganizationFilter struct {
	Name   *string
	ID     *platform.ID
	UserID *platform.ID
}

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 platform.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 platform.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 platform.ID, upd OrganizationUpdate) (*Organization, error)

	// Removes a organization by ID.
	DeleteOrganization(ctx context.Context, id platform.ID) error
}

OrganizationService represents a service for managing organization data.

type OrganizationUpdate ¶

type OrganizationUpdate struct {
	Name        *string
	Description *string `json:"description,omitempty"`
}

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

type Page ¶ added in v2.1.0

type Page struct {
	Offset int
	Limit  int
}

Page contains pagination information

func (Page) Validate ¶ added in v2.1.0

func (p Page) Validate() error

Validate validates the Page

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 struct {
	Prev string `json:"prev,omitempty"`
	Self string `json:"self"`
	Next string `json:"next,omitempty"`
}

PagingLinks represents paging links.

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 platform.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 platform.ID, password string) error
	// CompareAndSetPassword checks the password and if they match
	// updates to the new password.
	CompareAndSetPassword(ctx context.Context, userID platform.ID, old, new string) error
}

PasswordsService is the service for managing basic auth passwords.

type Permission ¶

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

Permission defines an action and a resource.

func MePermissions ¶

func MePermissions(userID platform.ID) []Permission

MePermissions is the permission to read/write myself.

func MemberBucketPermission ¶

func MemberBucketPermission(bucketID platform.ID) Permission

MemberPermissions are the default permissions for those who can see a resource.

func MemberPermissions ¶

func MemberPermissions(orgID platform.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 platform.ID) (*Permission, error)

NewPermission returns a permission with provided arguments.

func NewPermissionAtID ¶

func NewPermissionAtID(id platform.ID, a Action, rt ResourceType, orgID platform.ID) (*Permission, error)

NewPermissionAtID creates a permission with the provided arguments.

func NewResourcePermission ¶

func NewResourcePermission(a Action, rt ResourceType, rid platform.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 platform.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 PermissionSet ¶

type PermissionSet []Permission

func (PermissionSet) Allowed ¶

func (ps PermissionSet) Allowed(p Permission) bool

type Predicate ¶

type Predicate interface {
	Clone() Predicate
	Matches(key []byte) bool
	Marshal() ([]byte, error)
}

Predicate is something that can match on a series key.

type ReadAnnotation ¶ added in v2.1.0

type ReadAnnotation struct {
	ID        platform.ID       `json:"id"`                  // ID is the annotation's generated id.
	Summary   string            `json:"summary"`             // Summary is the only field required to annotate an event.
	Message   string            `json:"message,omitempty"`   // Message provides more details about the event being annotated.
	Stickers  map[string]string `json:"stickers,omitempty"`  // Stickers are like tags, but named something obscure to differentiate them from influx tags. They are there to differentiate an annotated event.
	EndTime   string            `json:"endTime"`             // EndTime is the time of the event being annotated.
	StartTime string            `json:"startTime,omitempty"` // StartTime is the start time of the event being annotated.
}

ReadAnnotation defines the simplest form of an annotation to be returned. Essentially, it's AnnotationEvent without stream info.

type ReadAnnotations ¶ added in v2.1.0

type ReadAnnotations map[string][]ReadAnnotation

ReadAnnotations allows annotations to be assigned to a stream.

func (ReadAnnotations) MarshalJSON ¶ added in v2.1.0

func (s ReadAnnotations) MarshalJSON() ([]byte, error)

MarshalJSON allows us to marshal the annotations belonging to a stream properly.

type ReadStream ¶ added in v2.1.0

type ReadStream struct {
	ID          platform.ID `json:"id" db:"id"`                             // ID is the id of a stream.
	Name        string      `json:"stream" db:"name"`                       // Name is the name of a stream.
	Description string      `json:"description,omitempty" db:"description"` // Description is more information about a stream.
	CreatedAt   time.Time   `json:"createdAt" db:"created_at"`              // CreatedAt is a timestamp.
	UpdatedAt   time.Time   `json:"updatedAt" db:"updated_at"`              // UpdatedAt is a timestamp.
}

ReadStream defines the returned stream.

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 RemoteConnection ¶ added in v2.2.0

type RemoteConnection struct {
	ID               platform.ID  `json:"id" db:"id"`
	OrgID            platform.ID  `json:"orgID" db:"org_id"`
	Name             string       `json:"name" db:"name"`
	Description      *string      `json:"description,omitempty" db:"description"`
	RemoteURL        string       `json:"remoteURL" db:"remote_url"`
	RemoteOrgID      *platform.ID `json:"remoteOrgID" db:"remote_org_id"`
	AllowInsecureTLS bool         `json:"allowInsecureTLS" db:"allow_insecure_tls"`
}

RemoteConnection contains all info about a remote InfluxDB instance that should be returned to users. Note that the auth token used by the request is *not* included here.

type RemoteConnectionListFilter ¶ added in v2.2.0

type RemoteConnectionListFilter struct {
	OrgID     platform.ID
	Name      *string
	RemoteURL *string
}

RemoteConnectionListFilter is a selection filter for listing remote InfluxDB instances.

type RemoteConnections ¶ added in v2.2.0

type RemoteConnections struct {
	Remotes []RemoteConnection `json:"remotes"`
}

RemoteConnections is a collection of metadata about remote InfluxDB instances.

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 Replication ¶ added in v2.2.0

type Replication struct {
	ID                       platform.ID  `json:"id" db:"id"`
	OrgID                    platform.ID  `json:"orgID" db:"org_id"`
	Name                     string       `json:"name" db:"name"`
	Description              *string      `json:"description,omitempty" db:"description"`
	RemoteID                 platform.ID  `json:"remoteID" db:"remote_id"`
	LocalBucketID            platform.ID  `json:"localBucketID" db:"local_bucket_id"`
	RemoteBucketID           *platform.ID `json:"remoteBucketID" db:"remote_bucket_id"`
	RemoteBucketName         string       `json:"RemoteBucketName" db:"remote_bucket_name"`
	MaxQueueSizeBytes        int64        `json:"maxQueueSizeBytes" db:"max_queue_size_bytes"`
	CurrentQueueSizeBytes    int64        `json:"currentQueueSizeBytes"`
	RemainingBytesToBeSynced int64        `json:"remainingBytesToBeSynced"`
	LatestResponseCode       *int32       `json:"latestResponseCode,omitempty" db:"latest_response_code"`
	LatestErrorMessage       *string      `json:"latestErrorMessage,omitempty" db:"latest_error_message"`
	DropNonRetryableData     bool         `json:"dropNonRetryableData" db:"drop_non_retryable_data"`
	MaxAgeSeconds            int64        `json:"maxAgeSeconds" db:"max_age_seconds"`
}

Replication contains all info about a replication that should be returned to users.

type ReplicationHTTPConfig ¶ added in v2.2.0

type ReplicationHTTPConfig struct {
	RemoteURL            string       `db:"remote_url"`
	RemoteToken          string       `db:"remote_api_token"`
	RemoteOrgID          *platform.ID `db:"remote_org_id"`
	AllowInsecureTLS     bool         `db:"allow_insecure_tls"`
	RemoteBucketID       *platform.ID `db:"remote_bucket_id"`
	RemoteBucketName     string       `db:"remote_bucket_name"`
	DropNonRetryableData bool         `db:"drop_non_retryable_data"`
}

ReplicationHTTPConfig contains all info needed by a client to make HTTP requests against the remote bucket targeted by a replication.

type ReplicationListFilter ¶ added in v2.2.0

type ReplicationListFilter struct {
	OrgID         platform.ID
	Name          *string
	RemoteID      *platform.ID
	LocalBucketID *platform.ID
}

ReplicationListFilter is a selection filter for listing replications.

type Replications ¶ added in v2.2.0

type Replications struct {
	Replications []Replication `json:"replications"`
}

Replications is a collection of metadata about replications.

type Resource ¶

type Resource struct {
	Type  ResourceType `json:"type"`
	ID    *platform.ID `json:"id,omitempty"`
	OrgID *platform.ID `json:"orgID,omitempty"`
}

Resource is an authorizable resource.

func (Resource) String ¶

func (r Resource) String() string

String stringifies a resource

func (Resource) Valid ¶

func (r Resource) Valid() (err error)

Valid checks if the resource type is a member of the ResourceType enum.

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 RestoreService ¶

type RestoreService interface {
	// RestoreKVStore restores & replaces metadata database.
	RestoreKVStore(ctx context.Context, r io.Reader) error

	// RestoreBucket restores storage metadata for a bucket.
	// TODO(danmoran): As far as I can tell, dbInfo is typed as a []byte because typing it as
	//  a meta.DatabaseInfo introduces a circular dependency between the root package and `meta`.
	//  We should refactor to make this signature easier to use. It might be easier to wait
	//  until we're ready to delete the 2.0.x restore APIs before refactoring.
	RestoreBucket(ctx context.Context, id platform.ID, dbInfo []byte) (shardIDMap map[uint64]uint64, err error)

	// RestoreShard uploads a backup file for a single shard.
	RestoreShard(ctx context.Context, shardID uint64, r io.Reader) error
}

RestoreService represents the data restore functions of InfluxDB.

type RestoredBucketMappings ¶ added in v2.1.0

type RestoredBucketMappings struct {
	ID            platform.ID            `json:"id"`
	Name          string                 `json:"name"`
	ShardMappings []RestoredShardMapping `json:"shardMappings"`
}

type RestoredShardMapping ¶ added in v2.1.0

type RestoredShardMapping struct {
	OldId uint64 `json:"oldId"`
	NewId uint64 `json:"newId"`
}

type RetentionPolicyManifest ¶ added in v2.1.0

type RetentionPolicyManifest struct {
	Name               string                 `json:"name"`
	ReplicaN           int                    `json:"replicaN"`
	Duration           time.Duration          `json:"duration"`
	ShardGroupDuration time.Duration          `json:"shardGroupDuration"`
	ShardGroups        []ShardGroupManifest   `json:"shardGroups"`
	Subscriptions      []SubscriptionManifest `json:"subscriptions"`
}

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"`
	GenerateXAxisTicks         []string         `json:"generateXAxisTicks"`
	XTotalTicks                int              `json:"xTotalTicks"`
	XTickStart                 float64          `json:"xTickStart"`
	XTickStep                  float64          `json:"xTickStep"`
	YColumn                    string           `json:"yColumn"`
	GenerateYAxisTicks         []string         `json:"generateYAxisTicks"`
	YTotalTicks                int              `json:"yTotalTicks"`
	YTickStart                 float64          `json:"yTickStart"`
	YTickStep                  float64          `json:"yTickStep"`
	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"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

ScatterViewProperties represents options for scatter view in Chronograf

func (ScatterViewProperties) GetType ¶

func (v ScatterViewProperties) GetType() string

type SchemaColumnDataType ¶ added in v2.1.0

type SchemaColumnDataType uint
const (
	SchemaColumnDataTypeFloat SchemaColumnDataType = iota
	SchemaColumnDataTypeInteger
	SchemaColumnDataTypeUnsigned
	SchemaColumnDataTypeString
	SchemaColumnDataTypeBoolean
)

func SchemaColumnDataTypeFromString ¶ added in v2.1.0

func SchemaColumnDataTypeFromString(s string) *SchemaColumnDataType

func (SchemaColumnDataType) MarshalJSON ¶ added in v2.1.0

func (s SchemaColumnDataType) MarshalJSON() ([]byte, error)

func (SchemaColumnDataType) Ptr ¶ added in v2.1.0

Ptr returns a pointer to s.

func (*SchemaColumnDataType) String ¶ added in v2.1.0

func (s *SchemaColumnDataType) String() string

func (SchemaColumnDataType) ToFieldType ¶ added in v2.1.0

func (s SchemaColumnDataType) ToFieldType() models.FieldType

ToFieldType maps SchemaColumnDataType to the equivalent models.FieldType or models.Empty if no such mapping exists.

func (*SchemaColumnDataType) UnmarshalJSON ¶ added in v2.1.0

func (s *SchemaColumnDataType) UnmarshalJSON(d []byte) error

type SchemaType ¶ added in v2.1.0

type SchemaType int

SchemaType differentiates the supported schema for a bucket.

const (
	SchemaTypeImplicit SchemaType = iota // SchemaTypeImplicit specifies the bucket has an implicit schema.
	SchemaTypeExplicit                   // SchemaTypeExplicit specifies the bucket has an explicit schema.
)

func SchemaTypeFromString ¶ added in v2.1.0

func SchemaTypeFromString(s string) *SchemaType

SchemaTypeFromString returns the SchemaType for s or nil if none exists.

func (*SchemaType) Equals ¶ added in v2.1.0

func (s *SchemaType) Equals(other *SchemaType) bool

func (SchemaType) MarshalJSON ¶ added in v2.1.0

func (s SchemaType) MarshalJSON() ([]byte, error)

func (SchemaType) Ptr ¶ added in v2.1.0

func (s SchemaType) Ptr() *SchemaType

Ptr returns a pointer to s.

func (*SchemaType) String ¶ added in v2.1.0

func (s *SchemaType) String() string

func (*SchemaType) UnmarshalJSON ¶ added in v2.1.0

func (s *SchemaType) UnmarshalJSON(d []byte) error

type SchemeV1 ¶

type SchemeV1 string

SchemeV1 is an enumeration of supported authorization types

const (
	// SchemeV1Basic indicates the credentials came from an Authorization header using the BASIC scheme
	SchemeV1Basic SchemeV1 = "basic"

	// SchemeV1Token indicates the credentials came from an Authorization header using the Token scheme
	SchemeV1Token SchemeV1 = "token"

	// SchemeV1URL indicates the credentials came from the u and p query parameters
	SchemeV1URL SchemeV1 = "url"
)

type ScraperTarget ¶

type ScraperTarget struct {
	ID            platform.ID `json:"id,omitempty"`
	Name          string      `json:"name"`
	Type          ScraperType `json:"type"`
	URL           string      `json:"url"`
	OrgID         platform.ID `json:"orgID,omitempty"`
	BucketID      platform.ID `json:"bucketID,omitempty"`
	AllowInsecure bool        `json:"allowInsecure,omitempty"`
}

ScraperTarget is a target to scrape

type ScraperTargetFilter ¶

type ScraperTargetFilter struct {
	IDs   map[platform.ID]bool `json:"ids"`
	Name  *string              `json:"name"`
	OrgID *platform.ID         `json:"orgID"`
	Org   *string              `json:"org"`
}

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

type ScraperTargetStoreService ¶

type ScraperTargetStoreService interface {
	ListTargets(ctx context.Context, filter ScraperTargetFilter) ([]ScraperTarget, error)
	AddTarget(ctx context.Context, t *ScraperTarget, userID platform.ID) error
	GetTargetByID(ctx context.Context, id platform.ID) (*ScraperTarget, error)
	RemoveTarget(ctx context.Context, id platform.ID) error
	UpdateTarget(ctx context.Context, t *ScraperTarget, userID platform.ID) (*ScraperTarget, error)
}

ScraperTargetStoreService defines the crud service for ScraperTarget.

type ScraperType ¶

type ScraperType string

ScraperType defines the scraper methods.

type SecretField ¶

type SecretField struct {
	Key   string  `json:"key"`
	Value *string `json:"value,omitempty"`
}

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 platform.ID, k string) (string, error)

	// GetSecretKeys retrieves all secret keys that are stored for the organization orgID.
	GetSecretKeys(ctx context.Context, orgID platform.ID) ([]string, error)

	// PutSecret stores the secret pair (k,v) for the organization orgID.
	PutSecret(ctx context.Context, orgID platform.ID, k string, v string) error

	// PutSecrets puts all provided secrets and overwrites any previous values.
	PutSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

	// PatchSecrets patches all provided secrets and updates any previous values.
	PatchSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

	// DeleteSecret removes a single secret from the secret store.
	DeleteSecret(ctx context.Context, orgID platform.ID, ks ...string) error
}

SecretService a service for storing and retrieving secrets.

type SemanticColumnType ¶ added in v2.1.0

type SemanticColumnType int

SemanticColumnType specifies the semantics of a measurement column.

const (
	SemanticColumnTypeTimestamp SemanticColumnType = iota // SemanticColumnTypeTimestamp identifies the column is used as the timestamp
	SemanticColumnTypeTag                                 // SemanticColumnTypeTag identifies the column is used as a tag
	SemanticColumnTypeField                               // SemanticColumnTypeField identifies the column is used as a field
)

func SemanticColumnTypeFromString ¶ added in v2.1.0

func SemanticColumnTypeFromString(s string) *SemanticColumnType

func (SemanticColumnType) MarshalJSON ¶ added in v2.1.0

func (s SemanticColumnType) MarshalJSON() ([]byte, error)

func (SemanticColumnType) Ptr ¶ added in v2.1.0

func (SemanticColumnType) String ¶ added in v2.1.0

func (s SemanticColumnType) String() string

func (*SemanticColumnType) UnmarshalJSON ¶ added in v2.1.0

func (s *SemanticColumnType) UnmarshalJSON(d []byte) error

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          platform.ID  `json:"id"`
	Key         string       `json:"key"`
	CreatedAt   time.Time    `json:"createdAt"`
	ExpiresAt   time.Time    `json:"expiresAt"`
	UserID      platform.ID  `json:"userID,omitempty"`
	Permissions []Permission `json:"permissions,omitempty"`
}

Session is a user session.

func (*Session) EphemeralAuth ¶

func (s *Session) EphemeralAuth(orgID platform.ID) *Authorization

EphemeralAuth generates an Authorization that is not stored but at the user's max privs.

func (*Session) Expired ¶

func (s *Session) Expired() error

Expired returns an error if the session is expired.

func (*Session) GetUserID ¶

func (s *Session) GetUserID() platform.ID

GetUserID returns the user id.

func (*Session) Identifier ¶

func (s *Session) Identifier() platform.ID

Identifier returns the sessions ID and is used for auditing.

func (*Session) Kind ¶

func (s *Session) Kind() string

Kind returns session and is used for auditing.

func (*Session) PermissionSet ¶

func (s *Session) PermissionSet() (PermissionSet, error)

PermissionSet returns the set of permissions associated with the session.

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)
	// TODO: update RenewSession to take a ID instead of a session.
	// By taking a session object it could be confused to update more things about the session
	RenewSession(ctx context.Context, session *Session, newExpiration time.Time) error
}

SessionService represents a service for managing user sessions.

type ShardGroupManifest ¶ added in v2.1.0

type ShardGroupManifest struct {
	ID          uint64          `json:"id"`
	StartTime   time.Time       `json:"startTime"`
	EndTime     time.Time       `json:"endTime"`
	DeletedAt   *time.Time      `json:"deletedAt,omitempty"`   // use pointer to time.Time so that omitempty works
	TruncatedAt *time.Time      `json:"truncatedAt,omitempty"` // use pointer to time.Time so that omitempty works
	Shards      []ShardManifest `json:"shards"`
}

type ShardManifest ¶ added in v2.1.0

type ShardManifest struct {
	ID          uint64       `json:"id"`
	ShardOwners []ShardOwner `json:"shardOwners"`
}

type ShardOwner ¶ added in v2.1.0

type ShardOwner struct {
	NodeID uint64 `json:"nodeID"`
}

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                 platform.ID `json:"id,omitempty"`                 // ID is the unique ID of the source
	OrganizationID     platform.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 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 platform.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 platform.ID, upd SourceUpdate) (*Source, error)
	// DeleteSource removes the source.
	DeleteSource(ctx context.Context, id platform.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"`
	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 SqlBackupRestoreService ¶ added in v2.1.0

type SqlBackupRestoreService interface {
	// BackupSqlStore creates a live backup copy of the sqlite database.
	BackupSqlStore(ctx context.Context, w io.Writer) error

	// RestoreSqlStore restores & replaces the sqlite database.
	RestoreSqlStore(ctx context.Context, r io.Reader) error

	// RLockSqlStore takes a read lock on the database
	RLockSqlStore()

	// RUnlockSqlStore releases a previously-taken read lock on the database.
	RUnlockSqlStore()
}

SqlBackupRestoreService represents the backup and restore functions for the sqlite database.

type StaticLegend ¶ added in v2.1.0

type StaticLegend struct {
	ColorizeRows         bool    `json:"colorizeRows,omitempty"`
	HeightRatio          float64 `json:"heightRatio,omitempty"`
	Show                 bool    `json:"show,omitempty"`
	Opacity              float64 `json:"opacity,omitempty"`
	OrientationThreshold int     `json:"orientationThreshold,omitempty"`
	ValueAxis            string  `json:"valueAxis,omitempty"`
	WidthRatio           float64 `json:"widthRatio,omitempty"`
}

StaticLegend represents the options specific to the static legend

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

func (Status) Ptr ¶

func (s Status) Ptr() *Status

Ptr returns the pointer of that status.

func (Status) Valid ¶

func (s Status) Valid() error

Valid determines if a Status value matches the enum.

type StoredAnnotation ¶ added in v2.1.0

type StoredAnnotation struct {
	ID        platform.ID        `db:"id"`        // ID is the annotation's id.
	OrgID     platform.ID        `db:"org_id"`    // OrgID is the annotations's owning organization.
	StreamID  platform.ID        `db:"stream_id"` // StreamID is the id of a stream.
	StreamTag string             `db:"stream"`    // StreamTag is the name of a stream (when selecting with join of streams).
	Summary   string             `db:"summary"`   // Summary is the summary of the annotated event.
	Message   string             `db:"message"`   // Message is a longer description of the annotated event.
	Stickers  AnnotationStickers `db:"stickers"`  // Stickers are additional labels to group annotations by.
	Duration  string             `db:"duration"`  // Duration is the time range (with zone) of an annotated event.
	Lower     string             `db:"lower"`     // Lower is the time an annotated event begins.
	Upper     string             `db:"upper"`     // Upper is the time an annotated event ends.
}

StoredAnnotation represents annotation data to be stored in the database.

func (StoredAnnotation) ToCreate ¶ added in v2.1.0

func (s StoredAnnotation) ToCreate() (*AnnotationCreate, error)

ToCreate is a utility method for converting a StoredAnnotation to an AnnotationCreate type

func (StoredAnnotation) ToEvent ¶ added in v2.1.0

func (s StoredAnnotation) ToEvent() (*AnnotationEvent, error)

ToEvent is a utility method for converting a StoredAnnotation to an AnnotationEvent type

type StoredStream ¶ added in v2.1.0

type StoredStream struct {
	ID          platform.ID `db:"id"`          // ID is the stream's id.
	OrgID       platform.ID `db:"org_id"`      // OrgID is the stream's owning organization.
	Name        string      `db:"name"`        // Name is the name of a stream.
	Description string      `db:"description"` // Description is more information about a stream.
	CreatedAt   time.Time   `db:"created_at"`  // CreatedAt is a timestamp.
	UpdatedAt   time.Time   `db:"updated_at"`  // UpdatedAt is a timestamp.
}

StoredStream represents stream data to be stored in the metadata database.

type Stream ¶ added in v2.1.0

type Stream struct {
	Name        string `json:"stream"`                // Name is the name of a stream.
	Description string `json:"description,omitempty"` // Description is more information about a stream.
}

Stream defines the stream metadata. Used in create and update requests/responses. Delete requests will only require stream name.

func (*Stream) Validate ¶ added in v2.1.0

func (s *Stream) Validate(strict bool) error

IsValid validates the stream.

type StreamListFilter ¶ added in v2.1.0

type StreamListFilter struct {
	StreamIncludes []string `json:"streamIncludes,omitempty"` // StreamIncludes allows the user to filter streams returned.
	BasicFilter
}

StreamListFilter is a selection filter for listing streams. Streams are not considered first class resources, but depend on an annotation using them.

func (*StreamListFilter) Validate ¶ added in v2.1.0

func (f *StreamListFilter) Validate(nowFunc func() time.Time) error

Validate validates the filter.

type SubscriptionManifest ¶ added in v2.1.0

type SubscriptionManifest struct {
	Name         string   `json:"name"`
	Mode         string   `json:"mode"`
	Destinations []string `json:"destinations"`
}

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 ¶

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Tag is a tag key-value pair.

func NewTag ¶

func NewTag(s string) (Tag, error)

NewTag generates a tag pair from a string in the format key:value.

func (*Tag) QueryParam ¶

func (t *Tag) QueryParam() string

QueryParam converts a Tag to a string query parameter

func (Tag) Valid ¶

func (t Tag) Valid() error

Valid returns an error if the tagpair is missing fields

type TagRule ¶

type TagRule struct {
	Tag
	Operator Operator `json:"operator"`
}

TagRule is the struct of tag rule.

func (TagRule) Valid ¶

func (tr TagRule) Valid() error

Valid returns error for invalid operators.

type TelegrafConfig ¶

type TelegrafConfig struct {
	ID          platform.ID            `json:"id,omitempty"`          // ID of this config object.
	OrgID       platform.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        *platform.ID
	Organization *string
}

TelegrafConfigFilter represents a set of filter that restrict the returned telegraf configs.

type TelegrafConfigStore ¶

type TelegrafConfigStore interface {
	// FindTelegrafConfigByID returns a single telegraf config by ID.
	FindTelegrafConfigByID(ctx context.Context, id platform.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 platform.ID) error

	// UpdateTelegrafConfig updates a single telegraf config.
	// Returns the new telegraf config after update.
	UpdateTelegrafConfig(ctx context.Context, id platform.ID, tc *TelegrafConfig, userID platform.ID) (*TelegrafConfig, error)

	// DeleteTelegrafConfig removes a telegraf config by ID.
	DeleteTelegrafConfig(ctx context.Context, id platform.ID) error
}

TelegrafConfigStore represents a service for managing telegraf config data.

type TimeGenerator ¶

type TimeGenerator interface {
	// Now creates the generated time.
	Now() time.Time
}

TimeGenerator represents a generator for now.

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 TrackedReplication ¶ added in v2.2.0

type TrackedReplication struct {
	MaxQueueSizeBytes int64
	MaxAgeSeconds     int64
	OrgID             platform.ID
	LocalBucketID     platform.ID
}

TrackedReplication defines a replication stream which is currently being tracked via sqlite.

type UpdateRemoteConnectionRequest ¶ added in v2.2.0

type UpdateRemoteConnectionRequest struct {
	Name             *string      `json:"name,omitempty"`
	Description      *string      `json:"description,omitempty"`
	RemoteURL        *string      `json:"remoteURL,omitempty"`
	RemoteToken      *string      `json:"remoteAPIToken,omitempty"`
	RemoteOrgID      *platform.ID `json:"remoteOrgID,omitempty"`
	AllowInsecureTLS *bool        `json:"allowInsecureTLS,omitempty"`
}

UpdateRemoteConnectionRequest contains a partial update to existing info about a remote InfluxDB instance.

type UpdateReplicationRequest ¶ added in v2.2.0

type UpdateReplicationRequest struct {
	Name                 *string      `json:"name,omitempty"`
	Description          *string      `json:"description,omitempty"`
	RemoteID             *platform.ID `json:"remoteID,omitempty"`
	RemoteBucketID       *platform.ID `json:"remoteBucketID,omitempty"`
	RemoteBucketName     *string      `json:"remoteBucketName,omitempty"`
	MaxQueueSizeBytes    *int64       `json:"maxQueueSizeBytes,omitempty"`
	DropNonRetryableData *bool        `json:"dropNonRetryableData,omitempty"`
	MaxAgeSeconds        *int64       `json:"maxAgeSeconds,omitempty"`
}

UpdateReplicationRequest contains a partial update to existing info about a replication.

func (*UpdateReplicationRequest) OK ¶ added in v2.2.0

type Usage ¶

type Usage struct {
	OrganizationID *platform.ID `json:"organizationID,omitempty"`
	BucketID       *platform.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    *platform.ID
	BucketID *platform.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 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      platform.ID `json:"id,omitempty"`
	Name    string      `json:"name"`
	OAuthID string      `json:"oauthID,omitempty"`
	Status  Status      `json:"status"`
}

User is a user. 🎉

func (*User) Valid ¶

func (u *User) Valid() error

Valid validates user

type UserFilter ¶

type UserFilter struct {
	ID   *platform.ID
	Name *string
}

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 platform.ID, opts FindOptions) ([]*OperationLogEntry, int, error)
}

UserOperationLogService is an interface for retrieving the operation log for a user.

type UserResourceMapping ¶

type UserResourceMapping struct {
	UserID       platform.ID  `json:"userID"`
	UserType     UserType     `json:"userType"`
	MappingType  MappingType  `json:"mappingType"`
	ResourceType ResourceType `json:"resourceType"`
	ResourceID   platform.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   platform.ID
	ResourceType ResourceType
	UserID       platform.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 platform.ID) error
}

UserResourceMappingService maps the relationships between users and resources.

type UserResponse ¶ added in v2.2.0

type UserResponse struct {
	Links map[string]string `json:"links"`
	User
}

UserResponse is the response of user

type UserService ¶

type UserService interface {

	// Returns a single user by ID.
	FindUserByID(ctx context.Context, id platform.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 platform.ID, upd UserUpdate) (*User, error)

	// Removes a user by ID.
	DeleteUser(ctx context.Context, id platform.ID) error

	// FindPermissionForUser
	FindPermissionForUser(ctx context.Context, UserID platform.ID) (PermissionSet, error)
}

UserService represents a service for managing user data.

type UserStatus ¶

type UserStatus string

UserStatus indicates whether a user is active or inactive

func (*UserStatus) Valid ¶

func (u *UserStatus) Valid() error

Valid validates user status

type UserType ¶

type UserType string

UserType can either be owner or member.

const (
	// Owner can read and write to a resource
	Owner UserType = "owner" // 1
	// Member can read from a resource.
	Member UserType = "member" // 2
)

func (UserType) Valid ¶

func (ut UserType) Valid() (err error)

Valid checks if the UserType is a member of the UserType enum

type UserUpdate ¶

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

UserUpdate represents updates to a user. Only fields which are set are updated.

func (UserUpdate) Valid ¶

func (uu UserUpdate) Valid() error

Valid validates UserUpdate

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
}

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

type Variable ¶

type Variable struct {
	ID             platform.ID        `json:"id,omitempty"`
	OrganizationID platform.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

func (*Variable) Valid ¶

func (m *Variable) Valid() error

Valid returns an error if a Variable contains invalid data

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 ¶

type VariableFilter struct {
	ID             *platform.ID
	OrganizationID *platform.ID
	Organization   *string
}

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 ¶

type VariableMapValues map[string]string

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 platform.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 platform.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 platform.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 ¶

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

MarshalJSON encodes a view to JSON bytes.

func (*View) UnmarshalJSON ¶

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

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 ¶

type ViewContents struct {
	ID   platform.ID `json:"id,omitempty"`
	Name string      `json:"name"`
}

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 ¶

type ViewFilter struct {
	ID    *platform.ID
	Types []string
}

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() *errors.Error

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

type WriteService ¶

type WriteService interface {
	WriteTo(ctx context.Context, filter BucketFilter, r io.Reader) error
}

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"`
	StaticLegend               StaticLegend     `json:"staticLegend"`
	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"`
	GenerateXAxisTicks         []string         `json:"generateXAxisTicks"`
	XTotalTicks                int              `json:"xTotalTicks"`
	XTickStart                 float64          `json:"xTickStart"`
	XTickStep                  float64          `json:"xTickStep"`
	YColumn                    string           `json:"yColumn"`
	GenerateYAxisTicks         []string         `json:"generateYAxisTicks"`
	YTotalTicks                int              `json:"yTotalTicks"`
	YTickStart                 float64          `json:"yTickStart"`
	YTickStep                  float64          `json:"yTickStep"`
	ShadeBelow                 bool             `json:"shadeBelow"`
	Position                   string           `json:"position"`
	TimeFormat                 string           `json:"timeFormat"`
	HoverDimension             string           `json:"hoverDimension"`
	LegendColorizeRows         bool             `json:"legendColorizeRows"`
	LegendHide                 bool             `json:"legendHide"`
	LegendOpacity              float64          `json:"legendOpacity"`
	LegendOrientationThreshold int              `json:"legendOrientationThreshold"`
}

XYViewProperties represents options for line, bar, step, or stacked view in Chronograf

func (XYViewProperties) GetType ¶

func (v XYViewProperties) GetType() string

Directories ¶

Path Synopsis
cmd
influxd/inspect/report_tsi
Package report_tsi provides a report about the series cardinality in one or more TSI indexes.
Package report_tsi provides a report about the series cardinality in one or more TSI indexes.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
This package imports all the influxdb-specific query builtins.
This package imports all the influxdb-specific query builtins.
static
The fluxinit/static package can be imported in test cases and other uses cases where it is okay to always initialize flux.
The fluxinit/static package can be imported in test cases and other uses cases where it is okay to always initialize flux.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
query/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
query/neldermead
Package neldermead is an implementation of the Nelder-Mead optimization method.
Package neldermead is an implementation of the Nelder-Mead optimization method.
fs
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.
io
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.
kv
package kv
package kv
migration
package migration
package migration
migration/all
package all
package all
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package models implements basic objects used throughout the TICK stack.
Package models implements basic objects used throughout the TICK stack.
pkg
cmputil
Package cmputil provides helper utilities for the go-cmp package.
Package cmputil provides helper utilities for the go-cmp package.
deep
Package deep provides a deep equality check for use in tests.
Package deep provides a deep equality check for use in tests.
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.
estimator/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.
fs
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.
reporthelper
Package reporthelper reports statistics about TSM files.
Package reporthelper reports statistics about TSM files.
rhh
slices
Package slices contains functions to operate on slices treated as sets.
Package slices contains functions to operate on slices treated as sets.
tar
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.
tracing
Package tracing provides a way for capturing hierarchical traces.
Package tracing provides a way for capturing hierarchical traces.
tracing/wire
Package wire is used to serialize a trace.
Package wire is used to serialize a trace.
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.
control
Package control keeps track of resources and manages queries.
Package control keeps track of resources and manages queries.
fluxlang
Package language exposes the flux parser as an interface.
Package language exposes the flux parser as an interface.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package resource defines an interface for recording changes to InfluxDB resources.
Package resource defines an interface for recording changes to InfluxDB resources.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
task
backend/executor/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
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.
The tenant domain encapsulates all the storage critical metadata services: User Organization Bucket URM's
The tenant domain encapsulates all the storage critical metadata services: User Organization Bucket URM's
Package tests contains a set of integration tests, which run in-memory versions of various 2.0 services.
Package tests contains a set of integration tests, which run in-memory versions of various 2.0 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
cursors/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
engine
Package engine can be imported to initialize and register all available TSDB engines.
Package engine can be imported to initialize and register all available TSDB engines.
engine/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.
index/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.
Package uuid provides functions to create time-based UUIDs.
Package uuid provides functions to create time-based UUIDs.
v1
authorization/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
coordinator
Package coordinator contains abstractions for writing points, executing statements, and accessing meta data.
Package coordinator contains abstractions for writing points, executing statements, and accessing meta data.
services/meta
Package meta provides control over meta data for InfluxDB, such as controlling databases, retention policies, users, etc.
Package meta provides control over meta data for InfluxDB, such as controlling databases, retention policies, users, etc.
services/precreator
Package precreator provides the shard precreation service.
Package precreator provides the shard precreation service.
services/retention
Package retention provides the retention policy enforcement service.
Package retention provides the retention policy enforcement service.

Jump to

Keyboard shortcuts

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