Documentation ¶
Overview ¶
Package influxdb implements InfluxDB’s 2.x's golang client. This client is not compatible with InfluxDB 1.x -- if you are looking for the 1.x golang client you can find it at https://github.com/influxdata/influxdb1-client.
Example:
influx, err := influxdb.New( myHTTPInfluxAddress, myToken, influxdb.WithHTTPClient(myHTTPClient)) if err != nil { return err } defer influx.Close() // closes the client. After this the client is useless. // we use client.NewRowMetric for the example because it's easy, but if you // need extra performance it is fine to manually build the []client.Metric{}. metrics := []influxdb.Metric{ influxdb.NewRowMetric( map[string]interface{}{"memory": 1000, "cpu": 0.93}, "system-metrics", map[string]string{"hostname": "hal9000"}, time.Date(2018, 3, 4, 5, 6, 7, 8, time.UTC)), influxdb.NewRowMetric( map[string]interface{}{"memory": 1000, "cpu": 0.93}, "system-metrics", map[string]string{"hostname": "hal9000"}, time.Date(2018, 3, 4, 5, 6, 7, 9, time.UTC)), } // the actual write. this method can be called concurrently. if _, err := influx.write(context.background(), "my-awesome-bucket", "my-very-awesome-org", metrics...); err != nil { return err }
Index ¶
- Constants
- Variables
- func HTTPClientWithTLSConfig(conf *tls.Config) *http.Client
- func NewWriteGzipRequest(url *url.URL, userAgent, token, bucket, org string, compressionLevel int, ...) (*http.Request, error)
- func NewWriteRequest(url *url.URL, userAgent, token, bucket, org string, body io.Reader) (*http.Request, error)
- type AuthorizationCreated
- type AuthorizationDetails
- type AuthorizationsList
- type BucketCreate
- type BucketLogs
- type BucketMemberAdded
- type BucketOwner
- type BucketOwnerAdded
- type BucketSource
- type BucketUsers
- type Client
- func (c *Client) AddLabelToBucket(bucketID string, labelID string) (*LabelsOfBucket, error)
- func (c *Client) AddMemberToBucket(bucketID string, memberID string, memberName string) (*BucketMemberAdded, error)
- func (c *Client) AddOwnerToBucket(bucketID string, ownerID string, ownerName string) (*BucketOwnerAdded, error)
- func (c *Client) Close() error
- func (c *Client) CreateAuthorization(description string, orgID string, permissions []Permissions, status string) (*AuthorizationCreated, error)
- func (c *Client) CreateBucket(description string, name string, orgID string, retentionRules []RetentionRules, ...) (*BucketCreate, error)
- func (c *Client) CreateUser(name string, oauthID string, status string) (*User, error)
- func (c *Client) DeleteABucket(bucketID string) error
- func (c *Client) DeleteALabelFromBucket(bucketID string, labelID string) error
- func (c *Client) DeleteAnAuthorization(authID string) error
- func (c *Client) DeleteUser(userID string) error
- func (c *Client) GetAllAuthorizations(org string, orgID string, user string, userID string) (*AuthorizationsList, error)
- func (c *Client) GetAllUsers() (*UserList, error)
- func (c *Client) GetAuthorizationById(authID string) (*AuthorizationDetails, error)
- func (c *Client) GetBucketByID(bucketID string) (*SimpleBucket, error)
- func (c *Client) GetBuckets(limit int, name string, offset int, org string, orgID string) (*BucketSource, error)
- func (c *Client) GetBucketsInSource(id string) (*BucketSource, error)
- func (c *Client) GetHealth(ctx context.Context) (*Health, error)
- func (c *Client) GetListUsersOfBucket(bucketID string) (*BucketUsers, error)
- func (c *Client) GetLogsOfBucket(bucketID string, limit int, offset int) (*BucketLogs, error)
- func (c *Client) GetLogsOfUser(userID string, limit int, offset int) (*UserLogs, error)
- func (c *Client) GetOwnersOfBucket(bucketID string) (*BucketOwner, error)
- func (c *Client) GetSetup() (*Setup, error)
- func (c *Client) GetUrl() (string, error)
- func (c *Client) GetUserById(userID string) (*User, error)
- func (c *Client) ListLabelsForABucket(bucketID string) (*LabelsOfBucket, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) QueryCSV(ctx context.Context, flux string, org string, extern ...interface{}) (*QueryCSVResult, error)
- func (c *Client) Ready(ctx context.Context) (*ReadyResult, error)
- func (c *Client) RemoveMemberOfBucket(bucketID string, userID string) error
- func (c *Client) RemoveOwnerFromBucket(bucketID string, ownerID string) error
- func (c *Client) Setup(ctx context.Context, username, password, bucket string, org string, ...) (*SetupResult, error)
- func (c *Client) UpdateABucket(bucketID string, description string, labels []Labels, name string, ...) (*SimpleBucket, error)
- func (c *Client) UpdateAnAuthorizationStatus(authID string, description string, status string) (*AuthorizationDetails, error)
- func (c *Client) UpdatePasswordOfUser(userID string, password string) error
- func (c *Client) UpdateUser(userID string, name string, oauthID string, status string) (*User, error)
- func (c *Client) Write(ctx context.Context, bucket, org string, m ...Metric) (n int, err error)
- type Error
- type Field
- type HTTPConfig
- type Health
- type Labels
- type LabelsOfBucket
- type Metric
- type NewUser
- type Option
- type Password
- type Permissions
- type QueryCSVResult
- type ReadyResult
- type Resource
- type RetentionRules
- type RowMetric
- func (m *RowMetric) AddField(k string, v interface{})
- func (m *RowMetric) AddTag(k, v string)
- func (m *RowMetric) FieldList() []*lp.Field
- func (m *RowMetric) Name() string
- func (m *RowMetric) SortFields()
- func (m *RowMetric) SortTags()
- func (m *RowMetric) TagList() []*lp.Tag
- func (m *RowMetric) Time() time.Time
- type Setup
- type SetupCreateBucket
- type SetupNewAuthorization
- type SetupRequest
- type SetupResult
- type SetupUpdateBucket
- type SimpleBucket
- type Status
- type Tag
- type User
- type UserList
- type UserLogs
Examples ¶
Constants ¶
const ( EInternal = "internal error" ENotFound = "not found" EConflict = "conflict" // action cannot be performed EInvalid = "invalid" // validation failed EUnprocessableEntity = "unprocessable entity" // data type is correct, but out of range EEmptyValue = "empty value" EForbidden = "forbidden" ETooManyRequests = "too many requests" EMethodNotAllowed = "method not allowed" ETooLarge = "request too large" )
Error code constants copied from influxdb
Variables ¶
var ErrUnimplemented = errors.New("unimplemented")
ErrUnimplemented is an error for when pieces of the client's functionality is unimplemented.
Functions ¶
func HTTPClientWithTLSConfig ¶
HTTPClientWithTLSConfig returns an *http.Client with sane timeouts and the provided TLSClientConfig.
func NewWriteGzipRequest ¶
Types ¶
type AuthorizationCreated ¶
type AuthorizationCreated struct { Status string `json:"status"` Description string `json:"description"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` OrgID string `json:"orgID"` Permissions []struct { Action string `json:"action"` Resource struct { Type string `json:"type"` Id string `json:"id"` Name string `json:"name"` OrgId string `json:"orgID"` Org string `json:"org"` } `json:"resource"` } `json:"permissions"` Id string `json:"id"` Token string `json:"token"` UserID string `json:"userID"` User string `json:"user"` Org string `json:"user"` Links struct { Self string `json:"self"` User string `json:"user"` } `json:"links"` }
type AuthorizationDetails ¶
type AuthorizationDetails struct { Status string `json:"status"` Description string `json:"description"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` OrgID string `json:"orgID"` Permissions []struct { Action string `json:"action"` Resource struct { Type string `json:"type"` Id string `json:"id"` Name string `json:"name"` OrgID string `json:"orgID"` Org string `json:"org"` } `json:"resource"` } `json:"permissions"` Id string `json:"id"` Token string `json:"token"` UserID string `json:"userID"` User string `json:"user"` Org string `json:"org"` Links struct { Self string `json:"self"` User string `json:"user"` } `json:"links"` }
type AuthorizationsList ¶
type AuthorizationsList struct { Links struct { Next string `json:"next"` Self string `json:"self"` Prev string `json:"prev"` } `json:"links"` Authorizations []struct { Status string `json:"status"` Description string `json:"description"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` OrgID string `json:"orgID"` Permissions []struct { Action string `json:"action"` Resource struct { Type string `json:"type"` Id string `json:"id"` Name string `json:"name"` OrgID string `json:"orgID"` Org string `json:"org"` } `json:"resource"` } `json:"permissions"` Id string `json:"id"` Token string `json:"token"` UserID string `json:"userID"` User string `json:"user"` Org string `json:"org"` Links struct { Self string `json:"self"` User string `json:"user"` } `json:"links"` } `json:"authorizations"` }
type BucketCreate ¶
type BucketCreate struct { Links struct { Labels string `json:"labels"` Logs string `json:"logs"` Members string `json:"members"` Org string `json:"org"` Owners string `json:"owners"` Self string `json:"self"` Write string `json:"write"` } `json:"links"` Id string `json:"id"` Type string `json:"user"` Name string `json:"name"` Description string `json:"description"` OrgID string `json:"orgID"` Rp string `json:"rp"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` RetentionRules []RetentionRules `json:"retentionRules"` Labels []struct { Id string `json:"id"` OrgID string `json:"orgID"` Name string `json:"name"` Properties string `json:"properties"` } `json:"labels"` }
type BucketLogs ¶
type BucketLogs struct { Logs []struct { Description string `json:"description"` Time string `json:"time"` UserID string `json:"userID"` Links struct { User string `json:"user"` } `json:"links"` } `json:"logs"` Links struct { Next string `json:"next"` Self string `json:"self"` Prev string `json:"prev"` } `json:"links"` }
type BucketMemberAdded ¶
type BucketOwner ¶
type BucketOwner struct { Links struct { Self string `json:"self"` } `json:"links"` Users []struct { Id string `json:"id"` OauthID string `json:"oauthID"` Name string `json:"name"` Status string `json:"status"` Links struct { Self string `json:"self"` Logs string `json:"logs"` } `json:"links"` Role string `json:"role"` } `json:"users"` }
type BucketOwnerAdded ¶
type BucketSource ¶
type BucketSource struct { Links struct { Next string `json:"next"` Self string `json:"self"` Prev string `json:"prev"` } `json:"links"` Buckets []struct { Links struct { Labels string `json:"labels"` Logs string `json:"logs"` Members string `json:"members"` Org string `json:"org"` Owners string `json:"owners"` Self string `json:"self"` Write string `json:"write"` } `json:"links"` Id string `json:"id"` Type string `json:"type"` Name string `json:"name"` Description string `json:"description"` OrgId string `json:"orgId"` Rp string `json:"rp"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` RetentionRules []RetentionRules `json:"retentionRules"` } `json:"buckets"` Labels []struct { Id string `json:"id"` OrgId string `json:"orgId"` Name string `json:"name"` Properties string `json:"properties"` Color string `json:"color"` Description string `json:"description"` } `json:"labels"` }
type BucketUsers ¶
type BucketUsers struct { Links struct { Self string `json:"self"` } `json:"links"` Users []struct { Id string `json:"id"` OauthID string `json:"oauthID"` Name string `json:"name"` Status string `json:"status"` Links []struct { Self string `json:"self"` Logs string `json:"logs"` } `json:"links"` Role string `json:"role"` } `json:"users"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for writing to influx.
func New ¶
New creates a new Client. The client is concurrency safe, so feel free to use it and abuse it to your heart's content.
func (*Client) AddLabelToBucket ¶
func (c *Client) AddLabelToBucket(bucketID string, labelID string) (*LabelsOfBucket, error)
func (*Client) AddMemberToBucket ¶
func (*Client) AddOwnerToBucket ¶
func (*Client) CreateAuthorization ¶
func (c *Client) CreateAuthorization(description string, orgID string, permissions []Permissions, status string) (*AuthorizationCreated, error)
func (*Client) CreateBucket ¶
func (c *Client) CreateBucket(description string, name string, orgID string, retentionRules []RetentionRules, rp string) (*BucketCreate, error)
func (*Client) CreateUser ¶
func (*Client) DeleteABucket ¶
func (*Client) DeleteALabelFromBucket ¶
func (*Client) DeleteAnAuthorization ¶
func (*Client) DeleteUser ¶
func (*Client) GetAllAuthorizations ¶
func (*Client) GetAllUsers ¶
func (*Client) GetAuthorizationById ¶
func (c *Client) GetAuthorizationById(authID string) (*AuthorizationDetails, error)
func (*Client) GetBucketByID ¶
func (c *Client) GetBucketByID(bucketID string) (*SimpleBucket, error)
func (*Client) GetBuckets ¶
func (*Client) GetBucketsInSource ¶
func (c *Client) GetBucketsInSource(id string) (*BucketSource, error)
func (*Client) GetListUsersOfBucket ¶
func (c *Client) GetListUsersOfBucket(bucketID string) (*BucketUsers, error)
func (*Client) GetLogsOfBucket ¶
func (*Client) GetLogsOfUser ¶
func (*Client) GetOwnersOfBucket ¶
func (c *Client) GetOwnersOfBucket(bucketID string) (*BucketOwner, error)
func (*Client) ListLabelsForABucket ¶
func (c *Client) ListLabelsForABucket(bucketID string) (*LabelsOfBucket, error)
func (*Client) QueryCSV ¶
func (c *Client) QueryCSV(ctx context.Context, flux string, org string, extern ...interface{}) (*QueryCSVResult, error)
QueryCSV returns the result of a flux query. TODO: annotations
func (*Client) RemoveMemberOfBucket ¶
func (*Client) RemoveOwnerFromBucket ¶
func (*Client) Setup ¶
func (c *Client) Setup(ctx context.Context, username, password, bucket string, org string, retentionPeriodHrs int) (*SetupResult, error)
Setup sets up a new influxdbv2 server. It requires a client be set up with a username and password. If successful will add a token to the client. RetentionPeriodHrs of zero will result in infinite retention.
Example ¶
// just us setting up the server so the example will work. You will likely have to use the old fasioned way to get an *http.Client and address // alternatively you can leave the *http.Client nil, and it will intelligently create one with sane defaults. myHTTPClient, myHTTPInfluxAddress, teardown := setupMockServer() defer teardown() // we shut down our server at the end of the test, obviously you won't be doing this. influx, err := influxdb.New(myHTTPInfluxAddress, "", influxdb.WithUserAndPass("my-username", "my-password"), influxdb.WithHTTPClient(myHTTPClient)) if err != nil { panic(err) // error handling here, normally we wouldn't use fmt, but it works for the example } resp, err := influx.Setup(context.Background(), "my-user", "my-password", "my-bucket", "my-org", 32) if err != nil { log.Fatal(err) } fmt.Println(resp.Auth.Token) myMetrics := []influxdb.Metric{ influxdb.NewRowMetric( map[string]interface{}{"memory": 1000, "cpu": 0.93}, "system-metrics", map[string]string{"hostname": "hal9000"}, time.Date(2018, 3, 4, 5, 6, 7, 8, time.UTC)), } // We can now do a write even though we didn't put a token in if _, err := influx.Write(context.Background(), "my-awesome-bucket", "my-very-awesome-org", myMetrics...); err != nil { log.Fatal(err) } influx.Close() // close the client after this the client is useless.
Output: d7odFhI50cR8WcLrbfD1pkVenWy51zEM6WC2Md5McGGTxRbOEi5KS0qrXrTEweiH2z5uQjkNa-0YVmpTQlwM3w== system-metrics,hostname=hal9000 cpu=0.93,memory=1000i 1520139967000000008
func (*Client) UpdateABucket ¶
func (c *Client) UpdateABucket(bucketID string, description string, labels []Labels, name string, orgID string, retentionRules []RetentionRules, rp string) (*SimpleBucket, error)
func (*Client) UpdateAnAuthorizationStatus ¶
func (*Client) UpdatePasswordOfUser ¶
func (*Client) UpdateUser ¶
func (*Client) Write ¶
Write writes metrics to a bucket, and org. The result n is the number of points written.
Example (Basic) ¶
ExampleClient_Write_basic is an example of basic writing to influxdb over http(s). While this is fine in a VPN or VPC, we recommend using TLS/HTTPS if you are sending data over the internet, or anywhere your tokens could be intercepted.
// just us setting up the server so the example will work. You will likely have to use the old fasioned way to get an *http.Client and address // alternatively you can leave the *http.Client nil, and it will intelligently create one with sane defaults. myHTTPClient, myHTTPInfluxAddress, teardown := setupMockServer() defer teardown() // we shut down our server at the end of the test, obviously you won't be doing this. influx, err := influxdb.New(myHTTPInfluxAddress, "mytoken", influxdb.WithHTTPClient(myHTTPClient)) if err != nil { panic(err) // error handling here, normally we wouldn't use fmt, but it works for the example } // we use client.NewRowMetric for the example because its easy, but if you need extra performance // it is fine to manually build the []client.Metric{}. myMetrics := []influxdb.Metric{ influxdb.NewRowMetric( map[string]interface{}{"memory": 1000, "cpu": 0.93}, "system-metrics", map[string]string{"hostname": "hal9000"}, time.Date(2018, 3, 4, 5, 6, 7, 8, time.UTC)), influxdb.NewRowMetric( map[string]interface{}{"memory": 1000, "cpu": 0.93}, "system-metrics", map[string]string{"hostname": "hal9000"}, time.Date(2018, 3, 4, 5, 6, 7, 9, time.UTC)), } // The actual write..., this method can be called concurrently. if _, err := influx.Write(context.Background(), "my-awesome-bucket", "my-very-awesome-org", myMetrics...); err != nil { log.Fatal(err) // as above use your own error handling here. } influx.Close() // closes the client. After this the client is useless.
Output: system-metrics,hostname=hal9000 cpu=0.93,memory=1000i 1520139967000000008 system-metrics,hostname=hal9000 cpu=0.93,memory=1000i 1520139967000000009
Example (TlsMutualAuthentication) ¶
// just us setting up the server so the example will work. You will likely have to use the old fasioned way to get an *http.Client and address _, certFileName, keyfileName, myHTTPInfluxAddress, teardown := setupTLSMockserver() defer teardown() // we shut down our server at the end of the test, obviously you won't be doing this. certPem, err := ioutil.ReadFile(certFileName) if err != nil { log.Fatal(err) } keyPem, err := ioutil.ReadFile(keyfileName) if err != nil { log.Fatal(err) } cert, err := tls.X509KeyPair(certPem, keyPem) if err != nil { log.Fatal(err) } certPool := x509.NewCertPool() // read in the ca cert, in our case since we are self-signing, we are using the same cert caCertPem, err := ioutil.ReadFile(certFileName) if err != nil { log.Fatal(err) } certPool.AppendCertsFromPEM(caCertPem) if err != nil { log.Fatal(err) } tlsConfig := &tls.Config{ // Reject any TLS certificate that cannot be validated ClientAuth: tls.RequireAndVerifyClientCert, // Ensure that we only use our "CA" to validate certificates // Force it server side Certificates: []tls.Certificate{cert}, RootCAs: certPool, } tlsConfig.BuildNameToCertificate() influx, err := influxdb.New(myHTTPInfluxAddress, "mytoken", influxdb.WithHTTPClient(influxdb.HTTPClientWithTLSConfig(tlsConfig))) if err != nil { log.Fatal(err) } // we use client.NewRowMetric for the example because its easy, but if you need extra performance // it is fine to manually build the []client.Metric{} myMetrics := []influxdb.Metric{ influxdb.NewRowMetric( map[string]interface{}{"memory": 1000, "cpu": 0.93}, "system-metrics", map[string]string{"hostname": "hal9000"}, time.Date(2018, 3, 4, 5, 6, 7, 8, time.UTC)), influxdb.NewRowMetric( map[string]interface{}{"memory": 1000, "cpu": 0.93}, "system-metrics", map[string]string{"hostname": "hal9000"}, time.Date(2018, 3, 4, 5, 6, 7, 9, time.UTC)), } // The actual write... if _, err := influx.Write(context.Background(), "my-awesome-bucket", "my-very-awesome-org", myMetrics...); err != nil { log.Fatal(err) } influx.Close() // close the client after this the client is useless.
Output: system-metrics,hostname=hal9000 cpu=0.93,memory=1000i 1520139967000000008 system-metrics,hostname=hal9000 cpu=0.93,memory=1000i 1520139967000000009
type Error ¶
type Error struct { StatusCode int Code string Message string Err string Op string Line *int32 MaxLength *int32 RetryAfter *int32 }
Error is an error returned by a client operation It contains a number of contextual fields which describe the nature and cause of the error
type Field ¶
Field is just a github.com/influxdata/line-protocol.Field. We alias here to keep abstractions from leaking.
type HTTPConfig ¶
type HTTPConfig struct { // Addr should be of the form "http://host:port" // or "http://[ipv6-host%zone]:port". Addr string // Username is the influxdb username, optional. Username string // Password is the influxdb password, optional. Password string // UserAgent is the http User Agent, defaults to "InfluxDBClient" plus os and version info. UserAgent string // Timeout for influxdb writes, if set to zero, it defaults to a 20 second timeout. This is a difference from the influxdb1-client. Timeout time.Duration // InsecureSkipVerify gets passed to the http client, if true, it will // skip https certificate verification. Defaults to false. // this currently isn't supported, set on the http client. InsecureSkipVerify bool // TLSConfig allows the user to set their own TLS config for the HTTP // Client. If set, this option overrides InsecureSkipVerify. // this currently isn't supported, set on the http client. TLSConfig *tls.Config // Proxy configures the Proxy function on the HTTP client. // this currently isn't supported Proxy func(req *http.Request) (*url.URL, error) // If HTTPClient is nil, the New Client function will use an http client with sane defaults. HTTPClient *http.Client }
HTTPConfig is an https://github.com/influxdata/influxdb1-client compatible client for setting config options. This is here to make transition to the influxdb2 client easy from the old influxdb 1 client library. It is recommended that you set the options using the With___ functions instead.
type LabelsOfBucket ¶
type LabelsOfBucket struct { Labels []struct { Id string `json:"id"` OrgId string `json:"orgID"` Name string `json:"name"` Properties struct { Color string `json:"color"` Description string `json:"description"` } `json:"properties"` } `json:"labels"` Links struct { Next string `json:"next"` Self string `json:"self"` Prev string `json:"prev"` } `json:"links"` }
type Metric ¶
Metric is just a github.com/influxdata/line-protocol.Metric. We alias here to keep abstractions from leaking.
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option is an option for the client config. If you pass multiple incompatible Options the later one should override.
func WithGZIP ¶
WithGZIP returns an option for setting gzip compression level. The default (should this option not be used ) is level 4.
func WithHTTPClient ¶
WithHTTPClient returns an option for setting a custom HTTP Client
func WithMaxLineBytes ¶
WithMaxLineBytes returns an option for setting the max length of a line of influx line-protocol in bytes.
func WithNoCompression ¶
func WithNoCompression() Option
WithNoCompression returns an option for writing the data to influxdb without compression.
func WithUserAgent ¶
WithUserAgent returns an option for setting a custom useragent string.
func WithUserAndPass ¶
WithUserAndPass returns an option for setting a username and password, which generates a session for use. TODO(docmerlin): session logic.
func WithV1Config ¶
func WithV1Config(conf *HTTPConfig) Option
WithV1Config is an option for setting config in a way that makes it easy to convert from the old influxdb1 client config.
type Permissions ¶
type QueryCSVResult ¶
type QueryCSVResult struct { io.ReadCloser Row []string ColNames []string Err error // contains filtered or unexported fields }
QueryCSVResult is the result of a flux query in CSV format
func (*QueryCSVResult) Next ¶
func (q *QueryCSVResult) Next() bool
Next iterates to the next row in the data set. Typically this is called like so:
for q.Next(){ ... // do thing here }
It will call Close() on the result when it encounters EOF. Note: error columns are represented as columns not as QueryCSVResult.Err. QueryCSVResult.Err is for errors that do not show up as error columns, error columns in flux are treated as ordinary columns.
func (*QueryCSVResult) Unmarshal ¶
func (q *QueryCSVResult) Unmarshal(x interface{}) error
Unmarshal alows you to easily unmarshal rows of results into your own types.
type ReadyResult ¶
type RetentionRules ¶
type RowMetric ¶
RowMetric is a Metric, that has methods to make it easy to add tags and fields
func NewRowMetric ¶
func NewRowMetric( fields map[string]interface{}, name string, tags map[string]string, ts time.Time, ) *RowMetric
NewRowMetric creates a *RowMetric from tags, fields and a timestamp.
func (*RowMetric) SortFields ¶
func (m *RowMetric) SortFields()
SortFields orders the fields of a metric alphnumerically by key.
func (*RowMetric) SortTags ¶
func (m *RowMetric) SortTags()
SortTags orders the tags of a metric alphnumerically by key. This is just here as a helper, to make it easy to keep tags sorted if you are creating a RowMetric manually.
type SetupCreateBucket ¶
type SetupCreateBucket struct { Description string `json:"description"` Name string `json:"name"` OrgID string `json:"orgID"` RetentionRules []RetentionRules `json:"retentionRules"` Rp string `json:"rp"` }
type SetupNewAuthorization ¶
type SetupNewAuthorization struct { Description string `json:"description"` OrgID string `json:"orgID"` Permissions []Permissions `json:"permissions"` Status string `json:"status"` }
type SetupRequest ¶
type SetupRequest struct { Username string `json:"username"` Password string `json:"password"` Org string `json:"org"` Bucket string `json:"bucket"` RetentionPeriodHrs int `json:"retentionPeriodHrs"` }
SetupRequest is a request to setup a new influx instance.
type SetupResult ¶
type SetupResult struct { Code string `json:"code"` Message string `json:"message"` User struct { Links struct { Logs string `json:"logs"` Self string `json:"self"` } `json:"links"` ID string `json:"id"` Name string `json:"name"` } `json:"user"` Bucket struct { ID string `json:"id"` OrganizationID string `json:"organizationID"` Organization string `json:"organization"` Name string `json:"name"` RetentionRules []struct { Type string `json:"type"` EverySeconds int `json:"everySeconds"` } `json:"retentionRules"` Links struct { Labels string `json:"labels"` Logs string `json:"logs"` Members string `json:"members"` Org string `json:"org"` Owners string `json:"owners"` Self string `json:"self"` Write string `json:"write"` } `json:"links"` } `json:"bucket"` Org struct { Links struct { Buckets string `json:"buckets"` Dashboards string `json:"dashboards"` Labels string `json:"labels"` Logs string `json:"logs"` Members string `json:"members"` Owners string `json:"owners"` Secrets string `json:"secrets"` Self string `json:"self"` Tasks string `json:"tasks"` } `json:"links"` ID string `json:"id"` Name string `json:"name"` } `json:"org"` Auth struct { ID string `json:"id"` Token string `json:"token"` Status string `json:"status"` Description string `json:"description"` OrgID string `json:"orgID"` Org string `json:"org"` UserID string `json:"userID"` User string `json:"user"` Permissions []struct { Action string `json:"action"` Resource struct { Type string `json:"type"` } `json:"resource"` } `json:"permissions"` Links struct { Self string `json:"self"` User string `json:"user"` } `json:"links"` } `json:"auth"` }
SetupResult is the result of setting up a new influx instance.
type SetupUpdateBucket ¶
type SimpleBucket ¶
type SimpleBucket struct { Links struct { Labels string `json:"labels"` Logs string `json:"logs"` Members string `json:"members"` Org string `json:"org"` Owners string `json:"owners"` Self string `json:"self"` Write string `json:"write"` } `json:"links"` Id string `json:"id"` Type string `json:"user"` Name string `json:"name"` Description string `json:"description"` OrgID string `json:"orgID"` Rp string `json:"rp"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` RetentionRules []RetentionRules `json:"retentionRules"` Labels []struct { Id string `json:"id"` OrgID string `json:"orgID"` Name string `json:"name"` Properties struct { Color string `json:"color"` Description string `json:"description"` } `json:"properties"` } `json:"labels"` }
type Tag ¶
Tag is just a github.com/influxdata/line-protocol.Tag. We alias here to keep abstractions from leaking.
type UserLogs ¶
type UserLogs struct { Logs []struct { Description string `json:"description"` Time string `json:"time"` UserID string `json:"userID"` Links struct { User string `json:"user"` } `json:"links"` } `json:"logs"` Links struct { Next string `json:"next"` Self string `json:"self"` Prev string `json:"prev"` } `json:"links"` }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Code generated for client DO NOT EDIT.
|
Code generated for client DO NOT EDIT. |
internal
|
|
ast
Package ast provides tools for manipulating the flux ast.
|
Package ast provides tools for manipulating the flux ast. |
Package writer contains useful types for buffering, batching and periodically syncing writes onto a provided metric writing client.
|
Package writer contains useful types for buffering, batching and periodically syncing writes onto a provided metric writing client. |