Documentation ¶
Index ¶
- Constants
- Variables
- type Bucketing
- 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, ...) (resp *http.Response, err error)
- func (h *Hub) EntitiesMetrics(ctx context.Context, request EntitiesMetricsRequest, ...) (resp *http.Response, err error)
- func (h *Hub) EntitiesMetricsRows(ctx context.Context, request EntityMetricsRowsRequest, ...) (resp *http.Response, err error)
- func (h *Hub) EntitiesSummary(ctx context.Context, request EntitiesSummaryRequest, ...) (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, ...) (resp *http.Response, err error)
- func (h *Hub) EntityMetrics(ctx context.Context, request EntityMetricsRequest, ...) (resp *http.Response, err error)
- func (h *Hub) EntityMetricsData(ctx context.Context, request EntityMetricsDataRequest, ...) (resp *http.Response, err error)
- func (h *Hub) EntityMetricsRows(ctx context.Context, request EntityMetricsRowsRequest, ...) (resp *http.Response, err error)
- func (h *Hub) Get(ctx context.Context, endpoint string, request interface{}, ...) (resp *http.Response, err error)
- func (h *Hub) Login(ctx context.Context, username string, password *config.Plaintext) (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, ...) (resp *http.Response, err error)
- func (h *Hub) Ping(ctx context.Context) (resp *http.Response, err error)
- func (h *Hub) Post(ctx context.Context, endpoint string, request interface{}) (resp *http.Response, err error)
- func (h *Hub) QueryEventRecords(ctx context.Context, request QueryEventRecordsRequest, ...) (resp *http.Response, err error)
- type Metric
- type MetricsAggregation
- type MetricsAggregationsResponse
- type MetricsQueryRequest
- type MetricsQueryResponse
- type Options
- type QueryEventRecordsRequest
- type QueryEventRecordsResponse
- 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 ( 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 ¶
This section is empty.
Types ¶
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"` Range TimeRange `json:"range"` TimeWindows []TimeWindow `json:"timeWindows"` }
type Hub ¶
type Hub struct { BaseURL string // contains filtered or unexported fields }
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) Get ¶
func (h *Hub) Get(ctx context.Context, endpoint string, request interface{}, response interface{}) (resp *http.Response, err error)
Get method
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) Post ¶
func (h *Hub) Post(ctx context.Context, endpoint string, request interface{}) (resp *http.Response, err error)
Post method
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 MetricsQueryResponse struct { Schema interface{} `json:"schema"` Data interface{} `json:"data"` }
type Options ¶
type Options func(*gwhubOptions)
Options are used to control behaviour of ICP functions
func BaseURL ¶
BaseURL sets the root of the REST API URL. The default is "https://localhost:8443"
func HTTPClient ¶
HTTPClient sets the http.Client to use for requests. The default is the default http package client.
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)