Documentation ¶
Index ¶
- Constants
- func CheckError(resp *http.Response) (err error)
- func NewClient(scheme string, insecure bool) *http.Client
- func NewURL(addr, path string) (*url.URL, error)
- func SetToken(token string, req *http.Request)
- type BucketService
- type FluxQueryService
- type FluxService
- type OrganizationService
- type QueryDialect
- type QueryRequest
- type WriteService
Constants ¶
const ( // OrgName is the http query parameter to specify an organization by name. OrgName = "org" // OrgID is the http query parameter to specify an organization by ID. OrgID = "orgID" )
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
CheckError reads the http.Response and returns an error if one exists. It will automatically recognize the errors returned by Influx services and decode the error into an internal error type. If the error cannot be determined in that way, it will create a generic error message.
If there is no error, then this returns nil.
Types ¶
type BucketService ¶
type BucketService struct { Addr string Token string InsecureSkipVerify bool // OpPrefix is an additional property for error // find bucket service, when finds nothing. OpPrefix string }
BucketService connects to Influx via HTTP using tokens to manage buckets
func (*BucketService) FindBucket ¶
func (s *BucketService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
FindBucket returns the first bucket that matches filter.
func (*BucketService) FindBuckets ¶
func (s *BucketService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
FindBuckets returns a list of buckets that match filter and the total count of matching buckets. Additional options provide pagination & sorting.
type FluxQueryService ¶
FluxQueryService implements query.QueryService by making HTTP requests to the /api/v2/query API endpoint.
func (*FluxQueryService) Query ¶
func (s *FluxQueryService) Query(ctx context.Context, r *query.Request) (flux.ResultIterator, error)
Query runs a flux query against a influx server and decodes the result
type FluxService ¶
FluxService connects to Influx via HTTP using tokens to run queries.
func (*FluxService) Query ¶
func (s *FluxService) Query(ctx context.Context, w io.Writer, r *query.ProxyRequest) (flux.Statistics, error)
Query runs a flux query against a influx server and sends the results to the io.Writer. Will use the token from the context over the token within the service struct.
type OrganizationService ¶
type OrganizationService struct { Addr string Token string InsecureSkipVerify bool // OpPrefix is for not found errors. OpPrefix string }
OrganizationService connects to Influx via HTTP using tokens to manage organizations.
func (*OrganizationService) FindOrganization ¶
func (s *OrganizationService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
FindOrganization gets a single organization matching the filter using HTTP.
func (*OrganizationService) FindOrganizations ¶
func (s *OrganizationService) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Organization, int, error)
FindOrganizations returns all organizations that match the filter via HTTP.
type QueryDialect ¶
type QueryDialect struct { Header *bool `json:"header"` Delimiter string `json:"delimiter"` CommentPrefix string `json:"commentPrefix"` DateTimeFormat string `json:"dateTimeFormat"` Annotations []string `json:"annotations"` }
QueryDialect is the formatting options for the query response.
type QueryRequest ¶
type QueryRequest struct { Extern *ast.File `json:"extern,omitempty"` Spec *flux.Spec `json:"spec,omitempty"` AST *ast.Package `json:"ast,omitempty"` Query string `json:"query"` Type string `json:"type"` Dialect QueryDialect `json:"dialect"` Org *influxdb.Organization `json:"-"` }
QueryRequest is a flux query request.
func QueryRequestFromProxyRequest ¶
func QueryRequestFromProxyRequest(req *query.ProxyRequest) (*QueryRequest, error)
QueryRequestFromProxyRequest converts a query.ProxyRequest into a QueryRequest. The ProxyRequest must contain supported compilers and dialects otherwise an error occurs.
func (QueryRequest) ProxyRequest ¶
func (r QueryRequest) ProxyRequest() (*query.ProxyRequest, error)
ProxyRequest returns a request to proxy from the flux.
func (QueryRequest) Validate ¶
func (r QueryRequest) Validate() error
Validate checks the query request and returns an error if the request is invalid.
func (QueryRequest) WithDefaults ¶
func (r QueryRequest) WithDefaults() QueryRequest
WithDefaults adds default values to the request.
type WriteService ¶
WriteService sends data over HTTP to influxdb via line protocol.