Documentation
¶
Index ¶
- Constants
- Variables
- func FormatDuration(d time.Duration) (iso string)
- func ParseDuration(isoDuration string) (time.Duration, error)
- type Bucketing
- type Data
- type DataGrouping
- type EntitiesAttributeRequest
- type EntitiesAttributesRequest
- type EntitiesAttributesResponse
- type EntitiesMetricsRequest
- type EntitiesMetricsResponse
- type EntitiesMetricsRowsRequest
- type EntitiesMetricsRowsResponse
- type EntitiesRequest
- type EntitiesResponse
- type EntitiesSummariesCount
- type EntitiesSummary
- type EntitiesSummaryRequest
- type EntitiesSummaryResponse
- type Entity
- type EntityAttributeResponse
- type EntityAttributes
- type EntityMetric
- type EntityMetricMapping
- type EntityMetricsDataRequest
- type EntityMetricsDataResponse
- type EntityMetricsDataValue
- type EntityMetricsRequest
- type EntityMetricsResponse
- type EntityMetricsRowsRequest
- type EntityMetricsRowsResponse
- type Event
- type EventData
- type Filter
- type Hub
- func (h *Hub) Entities(ctx context.Context, request EntitiesRequest) (response EntitiesResponse, resp *http.Response, err error)
- func (h *Hub) EntitiesAttributes(ctx context.Context, request EntitiesAttributesRequest) (response EntitiesAttributesResponse, resp *http.Response, err error)
- func (h *Hub) EntitiesMetrics(ctx context.Context, request EntitiesMetricsRequest) (response EntitiesMetricsResponse, resp *http.Response, err error)
- func (h *Hub) EntitiesMetricsRows(ctx context.Context, request EntityMetricsRowsRequest) (response EntityMetricsRowsResponse, resp *http.Response, err error)
- func (h *Hub) EntitiesSummary(ctx context.Context, request EntitiesSummaryRequest) (response EntitiesSummaryResponse, resp *http.Response, err error)
- func (h *Hub) Entity(ctx context.Context, entity int) (response Entity, resp *http.Response, err error)
- func (h *Hub) EntityAttributeValues(ctx context.Context, request EntitiesAttributeRequest) (response EntityAttributeResponse, resp *http.Response, err error)
- func (h *Hub) EntityMetrics(ctx context.Context, request EntityMetricsRequest) (response EntityMetricsResponse, resp *http.Response, err error)
- func (h *Hub) EntityMetricsData(ctx context.Context, request EntityMetricsDataRequest) (response EntityMetricsDataResponse, resp *http.Response, err error)
- func (h *Hub) EntityMetricsRows(ctx context.Context, request EntityMetricsRowsRequest) (response EntityMetricsRowsResponse, resp *http.Response, err error)
- func (h *Hub) MetricsAggregations(ctx context.Context) (response MetricsAggregationsResponse, resp *http.Response, err error)
- func (h *Hub) MetricsQuery(ctx context.Context, request MetricsQueryRequest) (response MetricsQueryResponse, resp *http.Response, err error)
- func (hub *Hub) Ping(ctx context.Context) (resp *http.Response, err error)
- func (h *Hub) QueryEventRecords(ctx context.Context, request QueryEventRecordsRequest) (response QueryEventRecordsResponse, resp *http.Response, err error)
- type Metric
- type MetricsAggregation
- type MetricsAggregationsResponse
- type MetricsQueryRequest
- type MetricsQueryResponse
- type QueryEventRecordsRequest
- type QueryEventRecordsResponse
- type Schema
- type TimeRange
- type TimeWindow
Constants ¶
const ( PingEndpoint = "/ping" MetricsQueryEndpoint = "/metrics/query" MetricsAggregationsEndpoint = "/metrics/aggregations" QueryEventRecordsEndpoint = "/events/recordsQuery" EntitiesEndpoint = "/entities" EntitiesSummaryEndpoint = "/entities/summary" EntitiesMetricsEndpoint = "/entities/metrics" EntitiesMetricsRowsEndpoint = "/entities/metrics/rows" EntitiesAttributesEndpoint = "/entities/attributes" )
const ( Day = 24 * time.Hour Week = 7 * Day )
const ( PT1M = 1 * time.Minute PT5M = 5 * time.Minute PT15M = 15 * time.Minute PT1H = 1 * time.Hour PT3H = 3 * time.Hour PT12H = 12 * time.Hour P1D = 24 * time.Hour P1W = 7 * 24 * time.Hour )
ISO8601 durations used by GW Hub
const ( Monday = "monday" Tuesday = "tuesday" Wednesday = "wednesday" )
Time Windows
Variables ¶
var ErrServerError = errors.New("error from server (HTTP Status > 299)")
ErrServerError makes it a little easier for the caller to check the underlying HTTP response
Functions ¶
func FormatDuration ¶ added in v1.7.1
FormatDuration converts a time.Duration to an ISO8601 duration up to weeks. Months and years are not supported.
func ParseDuration ¶ added in v1.7.1
ParseDuration parses an ISO 8601 string representing a duration, and returns the resultant golang time.Duration instance.
From https://github.com/spatialtime/iso8601 but "fixed" to allow durations without 'T'
Types ¶
type DataGrouping ¶ added in v1.7.1
type EntitiesAttributeRequest ¶ added in v1.6.1
type EntitiesAttributeRequest struct {
Name string `url:"-"`
Filter string `url:"filter,omitempty"`
IncludeDeleted bool `url:"includeDeleted,omitempty"`
}
EntitiesAttributeRequest type
type EntitiesAttributesRequest ¶ added in v1.6.1
type EntitiesAttributesRequest struct {
Filter string `url:"filter,omitempty"`
IncludeDeleted bool `url:"includeDeleted,omitempty"`
}
EntitiesAttributesRequest type
type EntitiesAttributesResponse ¶ added in v1.6.1
type EntitiesAttributesResponse []EntityAttributes
EntitiesAttributesResponse type
type EntitiesMetricsRequest ¶ added in v1.6.1
type EntitiesMetricsRequest struct {
Filter string `url:"filter,omitempty"`
Plugin string `url:"plugin,omitempty"`
IncludeMappings bool `url:"includeMappings,omitempty"`
IncludeDeleted bool `url:"includeDeleted,omitempty"`
IncludeNonNumeric bool `url:"includeNonNumeric,omitempty"`
}
EntitiesMetricsRequest type
type EntitiesMetricsResponse ¶ added in v1.6.1
type EntitiesMetricsResponse []EntityMetric
EntitiesMetricsResponse type
type EntitiesMetricsRowsRequest ¶ added in v1.6.1
type EntitiesMetricsRowsRequest struct {
Filter string `url:"filter,omitempty"`
Path string `url:"path"`
UpdatedSince time.Time `url:"updatedSince,omitempty"`
}
EntitiesMetricsRowsRequest type
type EntitiesMetricsRowsResponse ¶ added in v1.6.1
type EntitiesMetricsRowsResponse []string
EntitiesMetricsRowsResponse type
type EntitiesRequest ¶ added in v1.6.1
type EntitiesRequest struct {
Filter string `url:"filter,omitempty"`
IncludeDeleted bool `url:"includeDeleted"`
}
EntitiesRequest type
type EntitiesSummariesCount ¶ added in v1.6.1
type EntitiesSummariesCount struct {
States map[string]string `json:"states"`
Count int `json:"count"`
SampleEntities []int `json:"sampleEntities"`
}
EntitiesSummariesCount type
type EntitiesSummary ¶ added in v1.6.1
type EntitiesSummary struct {
Attributes map[string]string `json:"attributes"`
Count int `json:"count"`
SampleEntityCount int `json:"sampleEntityCount"`
Counts []EntitiesSummariesCount `json:"counts"`
}
EntitiesSummary type
type EntitiesSummaryRequest ¶ added in v1.7.0
type EntitiesSummaryRequest struct {
Filter string `url:"filter,omitempty"`
GroupBy []string `url:"groupBy,omitempty"`
Samples int `url:"nrSamples,omitempty"`
IncludeDeleted bool `url:"includeDeleted,omitempty"`
}
EntitiesSummaryRequest
type EntitiesSummaryResponse ¶ added in v1.6.1
type EntitiesSummaryResponse []EntitiesSummary
EntitiesSummaryResponse type
type Entity ¶
type Entity struct {
ID int `json:"id"`
Attributes map[string]string `json:"attributes"`
IsDeleted bool `json:"isDeleted"`
}
Entity type
type EntityAttributeResponse ¶ added in v1.6.1
type EntityAttributeResponse []string
EntityAttributeResponse type
type EntityAttributes ¶
EntityAttributes type
type EntityMetric ¶ added in v1.6.1
type EntityMetric struct {
Name string `json:"name"`
Type string `json:"type"`
Unit string `json:"unit"`
Mappings []EntityMetricMapping
}
EntityMetric type
type EntityMetricMapping ¶ added in v1.6.1
type EntityMetricMapping struct {
LegacyPath string `json:"legacyPath"`
DataviewID int `json:"dataviewId"`
IsDeleted bool `json:"isDeleted"`
}
EntityMetricMapping type
type EntityMetricsDataRequest ¶ added in v1.6.1
type EntityMetricsDataRequest struct {
EntityID int `url:"-"`
Path string `url:"path"`
From time.Time `url:"from"`
To time.Time `url:"to"`
Skip int `url:"skip"`
Limit int `url:"limit"`
}
EntityMetricsDataRequest type
type EntityMetricsDataResponse ¶ added in v1.6.1
type EntityMetricsDataResponse struct {
TotalCount int `json:"totalCount"`
Values []EntityMetricsDataValue
}
EntityMetricsDataResponse type
type EntityMetricsDataValue ¶ added in v1.6.1
type EntityMetricsDataValue struct {
Timestamp time.Time `json:"timestamp"`
Value string `json:"value"`
}
EntityMetricsDataValue type
type EntityMetricsRequest ¶ added in v1.6.1
type EntityMetricsRequest struct {
EntityID int `url:"-"`
IncludeDeleted bool `url:"includeDeleted,omitempty"`
IncludeNonNumeric bool `url:"includeNonNumeric,omitempty"`
}
EntityMetricsRequest type
type EntityMetricsResponse ¶ added in v1.6.1
type EntityMetricsResponse []EntityMetric
EntityMetricsResponse type
type EntityMetricsRowsRequest ¶ added in v1.6.1
type EntityMetricsRowsRequest struct {
EntityID int `url:"-"`
Path string `url:"path"`
UpdatedSince time.Time `url:"updatedSince,omitempty"`
}
EntityMetricsRowsRequest type
type EntityMetricsRowsResponse ¶ added in v1.6.1
type EntityMetricsRowsResponse []string
EntityMetricsRowsResponse type
type Filter ¶
type Filter struct {
Entities string `json:"entities,omitempty"`
Range TimeRange `json:"range"`
TimeWindows []TimeWindow `json:"timeWindows,omitempty"`
}
type Hub ¶
Hub holds connection details for a GW Hub
func (*Hub) Entities ¶
func (h *Hub) Entities(ctx context.Context, request EntitiesRequest) (response EntitiesResponse, resp *http.Response, err error)
Entities request
func (*Hub) EntitiesAttributes ¶
func (h *Hub) EntitiesAttributes(ctx context.Context, request EntitiesAttributesRequest) (response EntitiesAttributesResponse, resp *http.Response, err error)
EntitiesAttributes request
func (*Hub) EntitiesMetrics ¶ added in v1.6.1
func (h *Hub) EntitiesMetrics(ctx context.Context, request EntitiesMetricsRequest) (response EntitiesMetricsResponse, resp *http.Response, err error)
EntitiesMetrics request
func (*Hub) EntitiesMetricsRows ¶ added in v1.6.1
func (h *Hub) EntitiesMetricsRows(ctx context.Context, request EntityMetricsRowsRequest) (response EntityMetricsRowsResponse, resp *http.Response, err error)
EntitiesMetricsRows request
func (*Hub) EntitiesSummary ¶ added in v1.6.1
func (h *Hub) EntitiesSummary(ctx context.Context, request EntitiesSummaryRequest) (response EntitiesSummaryResponse, resp *http.Response, err error)
EntitiesSummary request
func (*Hub) Entity ¶ added in v1.6.1
func (h *Hub) Entity(ctx context.Context, entity int) (response Entity, resp *http.Response, err error)
Entity request
func (*Hub) EntityAttributeValues ¶
func (h *Hub) EntityAttributeValues(ctx context.Context, request EntitiesAttributeRequest) (response EntityAttributeResponse, resp *http.Response, err error)
EntityAttributeValues request
func (*Hub) EntityMetrics ¶ added in v1.6.1
func (h *Hub) EntityMetrics(ctx context.Context, request EntityMetricsRequest) (response EntityMetricsResponse, resp *http.Response, err error)
EntityMetrics request
func (*Hub) EntityMetricsData ¶ added in v1.6.1
func (h *Hub) EntityMetricsData(ctx context.Context, request EntityMetricsDataRequest) (response EntityMetricsDataResponse, resp *http.Response, err error)
EntityMetricsData request
func (*Hub) EntityMetricsRows ¶ added in v1.6.1
func (h *Hub) EntityMetricsRows(ctx context.Context, request EntityMetricsRowsRequest) (response EntityMetricsRowsResponse, resp *http.Response, err error)
EntityMetricsRows request
func (*Hub) MetricsAggregations ¶
func (h *Hub) MetricsAggregations(ctx context.Context) (response MetricsAggregationsResponse, resp *http.Response, err error)
MetricsAggregations request
func (*Hub) MetricsQuery ¶
func (h *Hub) MetricsQuery(ctx context.Context, request MetricsQueryRequest) (response MetricsQueryResponse, resp *http.Response, err error)
MetricsQuery request
func (*Hub) QueryEventRecords ¶
func (h *Hub) QueryEventRecords(ctx context.Context, request QueryEventRecordsRequest) (response QueryEventRecordsResponse, resp *http.Response, err error)
QueryEventRecords request
type MetricsAggregation ¶
type MetricsAggregation struct {
Parameters []map[string]string `json:"parameters"`
Description string `json:"description"`
}
MetricsAggregation type
type MetricsAggregationsResponse ¶
type MetricsAggregationsResponse map[string]MetricsAggregation
MetricsAggregationsResponse type
type MetricsQueryRequest ¶
type MetricsQueryResponse ¶
type TimeRange ¶
func (TimeRange) MarshalJSON ¶ added in v1.7.0
MarshalJSON is needed as Hub only accepts short form ISO times
type TimeWindow ¶
type TimeWindow struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
On []string `json:"on,omitempty"`
}
TimeWindow is only time-of-day
func (TimeWindow) MarshalJSON ¶ added in v1.7.0
func (t TimeWindow) MarshalJSON() ([]byte, error)