1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Update dependencies

This commit is contained in:
Chris Cummer
2018-10-21 12:48:22 -07:00
parent 8f3ae94b4e
commit 3a0bcd21e7
132 changed files with 18033 additions and 9138 deletions

View File

@@ -14,7 +14,8 @@ install:
- go get -v -t .
script:
- go get -u github.com/golang/lint/golint
- scripts/check-fmt.sh
- go get -u golang.org/x/lint/golint
- golint ./... | grep -v vendor/
- make
- scripts/check-code-generation-ran.sh

View File

@@ -52,14 +52,63 @@ type GraphEvent struct {
}
type Yaxis struct {
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
Scale *string `json:"scale,omitempty"`
Min *float64 `json:"min,omitempty"`
AutoMin bool `json:"-"`
Max *float64 `json:"max,omitempty"`
AutoMax bool `json:"-"`
Scale *string `json:"scale,omitempty"`
}
// UnmarshalJSON is a Custom Unmarshal for Yaxis.Min/Yaxis.Max. If the datadog API
// returns "auto" for min or max, then we should set Yaxis.min or Yaxis.max to nil,
// respectively.
func (y *Yaxis) UnmarshalJSON(data []byte) error {
type Alias Yaxis
wrapper := &struct {
Min *json.Number `json:"min,omitempty"`
Max *json.Number `json:"max,omitempty"`
*Alias
}{
Alias: (*Alias)(y),
}
if err := json.Unmarshal(data, &wrapper); err != nil {
return err
}
if wrapper.Min != nil {
if *wrapper.Min == "auto" {
y.AutoMin = true
y.Min = nil
} else {
f, err := wrapper.Min.Float64()
if err != nil {
return err
}
y.Min = &f
}
}
if wrapper.Max != nil {
if *wrapper.Max == "auto" {
y.AutoMax = true
y.Max = nil
} else {
f, err := wrapper.Max.Float64()
if err != nil {
return err
}
y.Max = &f
}
}
return nil
}
type Style struct {
Palette *string `json:"palette,omitempty"`
PaletteFlip *bool `json:"paletteFlip,omitempty"`
Palette *string `json:"palette,omitempty"`
PaletteFlip *bool `json:"paletteFlip,omitempty"`
FillMin *json.Number `json:"fillMin,omitempty"`
FillMax *json.Number `json:"fillMax,omitempty"`
}
type GraphDefinition struct {
@@ -72,18 +121,18 @@ type GraphDefinition struct {
Yaxis Yaxis `json:"yaxis,omitempty"`
// For query value type graphs
Autoscale *bool `json:"autoscale,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
Precision *string `json:"precision,omitempty"`
CustomUnit *string `json:"custom_unit,omitempty"`
// For hostname type graphs
Style *Style `json:"Style,omitempty"`
Autoscale *bool `json:"autoscale,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
Precision *json.Number `json:"precision,omitempty"`
CustomUnit *string `json:"custom_unit,omitempty"`
// For hostmaps
Style *Style `json:"style,omitempty"`
Groups []string `json:"group,omitempty"`
IncludeNoMetricHosts *bool `json:"noMetricHosts,omitempty"`
Scopes []string `json:"scope,omitempty"`
IncludeUngroupedHosts *bool `json:"noGroupHosts,omitempty"`
NodeType *string `json:"nodeType,omitempty"`
}
// Graph represents a graph that might exist on a dashboard.
@@ -113,10 +162,27 @@ type Dashboard struct {
// DashboardLite represents a user created dashboard. This is the mini
// struct when we load the summaries.
type DashboardLite struct {
Id *int `json:"id,string,omitempty"` // TODO: Remove ',string'.
Resource *string `json:"resource,omitempty"`
Description *string `json:"description,omitempty"`
Title *string `json:"title,omitempty"`
Id *int `json:"id,string,omitempty"` // TODO: Remove ',string'.
Resource *string `json:"resource,omitempty"`
Description *string `json:"description,omitempty"`
Title *string `json:"title,omitempty"`
ReadOnly *bool `json:"read_only,omitempty"`
Created *string `json:"created,omitempty"`
Modified *string `json:"modified,omitempty"`
CreatedBy *CreatedBy `json:"created_by,omitempty"`
}
// CreatedBy represents a field from DashboardLite.
type CreatedBy struct {
Disabled *bool `json:"disabled,omitempty"`
Handle *string `json:"handle,omitempty"`
Name *string `json:"name,omitempty"`
IsAdmin *bool `json:"is_admin,omitempty"`
Role *string `json:"role,omitempty"`
AccessRole *string `json:"access_role,omitempty"`
Verified *bool `json:"verified,omitempty"`
Email *string `json:"email,omitempty"`
Icon *string `json:"icon,omitempty"`
}
// reqGetDashboards from /api/v1/dash

File diff suppressed because it is too large Load Diff

View File

@@ -176,3 +176,66 @@ func (client *Client) GetIntegrationAWS() (*[]IntegrationAWSAccount, error) {
func (client *Client) DeleteIntegrationAWS(awsAccount *IntegrationAWSAccountDeleteRequest) error {
return client.doJsonRequest("DELETE", "/v1/integration/aws", awsAccount, nil)
}
/*
Google Cloud Platform Integration
*/
// IntegrationGCP defines the response for listing Datadog-Google CloudPlatform integration.
type IntegrationGCP struct {
ProjectID *string `json:"project_id"`
ClientEmail *string `json:"client_email"`
HostFilters *string `json:"host_filters"`
}
// IntegrationGCPCreateRequest defines the request payload for creating Datadog-Google CloudPlatform integration.
type IntegrationGCPCreateRequest struct {
Type *string `json:"type"` // Should be service_account
ProjectID *string `json:"project_id"`
PrivateKeyID *string `json:"private_key_id"`
PrivateKey *string `json:"private_key"`
ClientEmail *string `json:"client_email"`
ClientID *string `json:"client_id"`
AuthURI *string `json:"auth_uri"` // Should be https://accounts.google.com/o/oauth2/auth
TokenURI *string `json:"token_uri"` // Should be https://accounts.google.com/o/oauth2/token
AuthProviderX509CertURL *string `json:"auth_provider_x509_cert_url"` // Should be https://www.googleapis.com/oauth2/v1/certs
ClientX509CertURL *string `json:"client_x509_cert_url"` // https://www.googleapis.com/robot/v1/metadata/x509/<CLIENT_EMAIL>
HostFilters *string `json:"host_filters,omitempty"`
}
// IntegrationGCPUpdateRequest defines the request payload for updating Datadog-Google CloudPlatform integration.
type IntegrationGCPUpdateRequest struct {
ProjectID *string `json:"project_id"`
ClientEmail *string `json:"client_email"`
HostFilters *string `json:"host_filters,omitempty"`
}
// IntegrationGCPDeleteRequest defines the request payload for deleting Datadog-Google CloudPlatform integration.
type IntegrationGCPDeleteRequest struct {
ProjectID *string `json:"project_id"`
ClientEmail *string `json:"client_email"`
}
// ListIntegrationGCP gets all Google Cloud Platform Integrations.
func (client *Client) ListIntegrationGCP() ([]*IntegrationGCP, error) {
var list []*IntegrationGCP
if err := client.doJsonRequest("GET", "/v1/integration/gcp", nil, &list); err != nil {
return nil, err
}
return list, nil
}
// CreateIntegrationGCP creates a new Google Cloud Platform Integration.
func (client *Client) CreateIntegrationGCP(cir *IntegrationGCPCreateRequest) error {
return client.doJsonRequest("POST", "/v1/integration/gcp", cir, nil)
}
// UpdateIntegrationGCP updates a Google Cloud Platform Integration.
func (client *Client) UpdateIntegrationGCP(cir *IntegrationGCPUpdateRequest) error {
return client.doJsonRequest("POST", "/v1/integration/gcp/host_filters", cir, nil)
}
// DeleteIntegrationGCP deletes a Google Cloud Platform Integration.
func (client *Client) DeleteIntegrationGCP(cir *IntegrationGCPDeleteRequest) error {
return client.doJsonRequest("DELETE", "/v1/integration/gcp", cir, nil)
}

View File

@@ -57,18 +57,40 @@ type Options struct {
Locked *bool `json:"locked,omitempty"`
}
type TriggeringValue struct {
FromTs *int `json:"from_ts,omitempty"`
ToTs *int `json:"to_ts,omitempty"`
Value *int `json:"value,omitempty"`
}
type GroupData struct {
LastNoDataTs *int `json:"last_nodata_ts,omitempty"`
LastNotifiedTs *int `json:"last_notified_ts,omitempty"`
LastResolvedTs *int `json:"last_resolved_ts,omitempty"`
LastTriggeredTs *int `json:"last_triggered_ts,omitempty"`
Name *string `json:"name,omitempty"`
Status *string `json:"status,omitempty"`
TriggeringValue *TriggeringValue `json:"triggering_value,omitempty"`
}
type State struct {
Groups map[string]GroupData `json:"groups,omitempty"`
}
// Monitor allows watching a metric or check that you care about,
// notifying your team when some defined threshold is exceeded
type Monitor struct {
Creator *Creator `json:"creator,omitempty"`
Id *int `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Query *string `json:"query,omitempty"`
Name *string `json:"name,omitempty"`
Message *string `json:"message,omitempty"`
OverallState *string `json:"overall_state,omitempty"`
Tags []string `json:"tags"`
Options *Options `json:"options,omitempty"`
Creator *Creator `json:"creator,omitempty"`
Id *int `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Query *string `json:"query,omitempty"`
Name *string `json:"name,omitempty"`
Message *string `json:"message,omitempty"`
OverallState *string `json:"overall_state,omitempty"`
OverallStateModified *string `json:"overall_state_modified,omitempty"`
Tags []string `json:"tags"`
Options *Options `json:"options,omitempty"`
State State `json:"state,omitempty"`
}
// Creator contains the creator of the monitor

View File

@@ -22,6 +22,12 @@ import (
"github.com/cenkalti/backoff"
)
// Response contains common fields that might be present in any API response.
type Response struct {
Status string `json:"status"`
Error string `json:"error"`
}
// uriForAPI is to be called with something like "/v1/events" and it will give
// the proper request URI to be posted to.
func (client *Client) uriForAPI(api string) (string, error) {
@@ -99,14 +105,6 @@ func (client *Client) doJsonRequestUnredacted(method, api string,
return fmt.Errorf("API error %s: %s", resp.Status, body)
}
// If they don't care about the body, then we don't care to give them one,
// so bail out because we're done.
if out == nil {
// read the response body so http conn can be reused immediately
io.Copy(ioutil.Discard, resp.Body)
return nil
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
@@ -118,6 +116,27 @@ func (client *Client) doJsonRequestUnredacted(method, api string,
body = []byte{'{', '}'}
}
// Try to parse common response fields to check whether there's an error reported in a response.
var common *Response
err = json.Unmarshal(body, &common)
if err != nil {
// UnmarshalTypeError errors are ignored, because in some cases API response is an array that cannot be
// unmarshalled into a struct.
_, ok := err.(*json.UnmarshalTypeError)
if !ok {
return err
}
}
if common != nil && common.Status == "error" {
return fmt.Errorf("API returned error: %s", common.Error)
}
// If they don't care about the body, then we don't care to give them one,
// so bail out because we're done.
if out == nil {
return nil
}
return json.Unmarshal(body, &out)
}

View File

@@ -1,287 +1,204 @@
package datadog
type TextSize struct {
Size *int
Auto *bool
}
import "encoding/json"
type TileDef struct {
Events []TileDefEvent `json:"events,omitempty"`
Markers []TimeseriesMarker `json:"markers,omitempty"`
Requests []TimeseriesRequest `json:"requests,omitempty"`
Viz *string `json:"viz,omitempty"`
}
Events []TileDefEvent `json:"events,omitempty"`
Markers []TileDefMarker `json:"markers,omitempty"`
Requests []TileDefRequest `json:"requests,omitempty"`
Viz *string `json:"viz,omitempty"`
CustomUnit *string `json:"custom_unit,omitempty"`
Autoscale *bool `json:"autoscale,omitempty"`
Precision *json.Number `json:"precision,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
type TimeseriesRequest struct {
Query *string `json:"q,omitempty"`
Type *string `json:"type,omitempty"`
ConditionalFormats []ConditionalFormat `json:"conditional_formats,omitempty"`
Style *TimeseriesRequestStyle `json:"style,omitempty"`
}
type TimeseriesRequestStyle struct {
Palette *string `json:"palette,omitempty"`
}
type TimeseriesMarker struct {
Label *string `json:"label,omitempty"`
Type *string `json:"type,omitempty"`
Value *string `json:"value,omitempty"`
// For hostmap
NodeType *string `json:"nodeType,omitempty"`
Scope []*string `json:"scope,omitempty"`
Group []*string `json:"group,omitempty"`
NoGroupHosts *bool `json:"noGroupHosts,omitempty"`
NoMetricHosts *bool `json:"noMetricHosts,omitempty"`
Style *TileDefStyle `json:"style,omitempty"`
}
type TileDefEvent struct {
Query *string `json:"q"`
}
type AlertValueWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Precision *int `json:"precision,omitempty"`
AlertId *int `json:"alert_id,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
AddTimeframe *bool `json:"add_timeframe,omitempty"`
Y *int `json:"y,omitempty"`
X *int `json:"x,omitempty"`
TextSize *string `json:"text_size,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
Type *string `json:"type,omitempty"`
Unit *string `json:"unit,omitempty"`
type TileDefMarker struct {
Label *string `json:"label,omitempty"`
Type *string `json:"type,omitempty"`
Value *string `json:"value,omitempty"`
}
type ChangeWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
Aggregator *string `json:"aggregator,omitempty"`
TileDef *TileDef `json:"tile_def,omitempty"`
type TileDefRequest struct {
Query *string `json:"q,omitempty"`
// For Hostmap
Type *string `json:"type,omitempty"`
// For Process
QueryType *string `json:"query_type,omitempty"`
Metric *string `json:"metric,omitempty"`
TextFilter *string `json:"text_filter,omitempty"`
TagFilters []*string `json:"tag_filters"`
Limit *int `json:"limit,omitempty"`
ConditionalFormats []ConditionalFormat `json:"conditional_formats,omitempty"`
Style *TileDefRequestStyle `json:"style,omitempty"`
Aggregator *string `json:"aggregator,omitempty"`
CompareTo *string `json:"compare_to,omitempty"`
ChangeType *string `json:"change_type,omitempty"`
OrderBy *string `json:"order_by,omitempty"`
OrderDir *string `json:"order_dir,omitempty"`
ExtraCol *string `json:"extra_col,omitempty"`
IncreaseGood *bool `json:"increase_good,omitempty"`
}
type GraphWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
Type *string `json:"type,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
LegendSize *int `json:"legend_size,omitempty"`
Legend *bool `json:"legend,omitempty"`
TileDef *TileDef `json:"tile_def,omitempty"`
}
type EventTimelineWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
Type *string `json:"type,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
Query *string `json:"query,omitempty"`
}
type AlertGraphWidget struct {
TitleSize *int `json:"title_size,omitempty"`
VizType *string `json:"timeseries,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
AlertId *int `json:"alert_id,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
Type *string `json:"type,omitempty"`
AddTimeframe *bool `json:"add_timeframe,omitempty"`
}
type HostMapWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
Query *string `json:"query,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
LegendSize *int `json:"legend_size,omitempty"`
Type *string `json:"type,omitempty"`
Legend *bool `json:"legend,omitempty"`
TileDef *TileDef `json:"tile_def,omitempty"`
}
type CheckStatusWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
Tags *string `json:"tags,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
TextSize *string `json:"text_size,omitempty"`
Type *string `json:"type,omitempty"`
Check *string `json:"check,omitempty"`
Group *string `json:"group,omitempty"`
Grouping *string `json:"grouping,omitempty"`
}
type IFrameWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
Url *string `json:"url,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
Type *string `json:"type,omitempty"`
}
type NoteWidget struct {
TitleSize *int `json:"title_size,omitempty"`
Title *bool `json:"title,omitempty"`
RefreshEvery *int `json:"refresh_every,omitempty"`
TickPos *string `json:"tick_pos,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TickEdge *string `json:"tick_edge,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Height *int `json:"height,omitempty"`
Color *string `json:"bgcolor,omitempty"`
Html *string `json:"html,omitempty"`
Y *int `json:"y,omitempty"`
X *int `json:"x,omitempty"`
FontSize *int `json:"font_size,omitempty"`
Tick *bool `json:"tick,omitempty"`
Note *string `json:"type,omitempty"`
Width *int `json:"width,omitempty"`
AutoRefresh *bool `json:"auto_refresh,omitempty"`
}
type TimeseriesWidget struct {
Height *int `json:"height,omitempty"`
Legend *bool `json:"legend,omitempty"`
TileDef *TileDef `json:"tile_def,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleSize *TextSize `json:"title_size,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Type *string `json:"type,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
}
type QueryValueWidget struct {
Timeframe *string `json:"timeframe,omitempty"`
TimeframeAggregator *string `json:"aggr,omitempty"`
Aggregator *string `json:"aggregator,omitempty"`
CalcFunc *string `json:"calc_func,omitempty"`
ConditionalFormats []ConditionalFormat `json:"conditional_formats,omitempty"`
Height *int `json:"height,omitempty"`
IsValidQuery *bool `json:"is_valid_query,omitempty,omitempty"`
Metric *string `json:"metric,omitempty"`
MetricType *string `json:"metric_type,omitempty"`
Precision *int `json:"precision,omitempty"`
Query *string `json:"query,omitempty"`
ResultCalcFunc *string `json:"res_calc_func,omitempty"`
Tags []string `json:"tags,omitempty"`
TextAlign *string `json:"text_align,omitempty"`
TextSize *TextSize `json:"text_size,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleSize *TextSize `json:"title_size,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Type *string `json:"type,omitempty"`
Unit *string `json:"auto,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
}
type ConditionalFormat struct {
Color *string `json:"color,omitempty"`
Palette *string `json:"palette,omitempty"`
Comparator *string `json:"comparator,omitempty"`
Inverted *bool `json:"invert,omitempty"`
Value *int `json:"value,omitempty"`
Invert *bool `json:"invert,omitempty"`
Value *string `json:"value,omitempty"`
ImageURL *string `json:"image_url,omitempty"`
}
type ToplistWidget struct {
Height *int `json:"height,omitempty"`
Legend *bool `json:"legend,omitempty"`
LegendSize *int `json:"legend_size,omitempty"`
TileDef *TileDef `json:"tile_def,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleSize *TextSize `json:"title_size,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Type *string `json:"type,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
type TileDefRequestStyle struct {
Palette *string `json:"palette,omitempty"`
Type *string `json:"type,omitempty"`
Width *string `json:"width,omitempty"`
}
type EventStreamWidget struct {
EventSize *string `json:"event_size,omitempty"`
Height *int `json:"height,omitempty"`
Query *string `json:"query,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleSize *TextSize `json:"title_size,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Type *string `json:"type,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
type TileDefStyle struct {
Palette *string `json:"palette,omitempty"`
PaletteFlip *string `json:"paletteFlip,omitempty"`
FillMin *string `json:"fillMin,omitempty"`
FillMax *string `json:"fillMax,omitempty"`
}
type FreeTextWidget struct {
Color *string `json:"color,omitempty"`
FontSize *string `json:"font_size,omitempty"`
Height *int `json:"height,omitempty"`
Text *string `json:"text,omitempty"`
type Time struct {
LiveSpan *string `json:"live_span,omitempty"`
}
type Widget struct {
// Common attributes
Type *string `json:"type,omitempty"`
Title *bool `json:"title,omitempty"`
TitleText *string `json:"title_text,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleSize *int `json:"title_size,omitempty"`
Height *int `json:"height,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"y,omitempty"`
Y *int `json:"x,omitempty"`
// For Timeseries, TopList, EventTimeline, EvenStream, AlertGraph, CheckStatus, ServiceSummary, LogStream widgets
Time *Time `json:"time,omitempty"`
// For Timeseries, QueryValue, HostMap, Change, Toplist, Process widgets
TileDef *TileDef `json:"tile_def,omitempty"`
// For FreeText widget
Text *string `json:"text,omitempty"`
Color *string `json:"color,omitempty"`
// For AlertValue widget
TextSize *string `json:"text_size,omitempty"`
Unit *string `json:"unit,omitempty"`
Precision *string `json:"precision,omitempty"`
// AlertGraph widget
VizType *string `json:"viz_type,omitempty"`
// For AlertValue, QueryValue, FreeText, Note widgets
TextAlign *string `json:"text_align,omitempty"`
Type *string `json:"type,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
// For FreeText, Note widgets
FontSize *string `json:"font_size,omitempty"`
// For AlertValue, AlertGraph widgets
AlertID *int `json:"alert_id,omitempty"`
AutoRefresh *bool `json:"auto_refresh,omitempty"`
// For Timeseries, QueryValue, Toplist widgets
Legend *bool `json:"legend,omitempty"`
LegendSize *string `json:"legend_size,omitempty"`
// For EventTimeline, EventStream, Hostmap, LogStream widgets
Query *string `json:"query,omitempty"`
// For Image, IFrame widgets
URL *string `json:"url,omitempty"`
// For CheckStatus widget
Tags []*string `json:"tags,omitempty"`
Check *string `json:"check,omitempty"`
Grouping *string `json:"grouping,omitempty"`
GroupBy []*string `json:"group_by,omitempty"`
Group *string `json:"group,omitempty"`
// Note widget
TickPos *string `json:"tick_pos,omitempty"`
TickEdge *string `json:"tick_edge,omitempty"`
HTML *string `json:"html,omitempty"`
Tick *bool `json:"tick,omitempty"`
Bgcolor *string `json:"bgcolor,omitempty"`
// EventStream widget
EventSize *string `json:"event_size,omitempty"`
// Image widget
Sizing *string `json:"sizing,omitempty"`
Margin *string `json:"margin,omitempty"`
// For ServiceSummary (trace_service) widget
Env *string `json:"env,omitempty"`
ServiceService *string `json:"serviceService,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
SizeVersion *string `json:"sizeVersion,omitempty"`
LayoutVersion *string `json:"layoutVersion,omitempty"`
MustShowHits *bool `json:"mustShowHits,omitempty"`
MustShowErrors *bool `json:"mustShowErrors,omitempty"`
MustShowLatency *bool `json:"mustShowLatency,omitempty"`
MustShowBreakdown *bool `json:"mustShowBreakdown,omitempty"`
MustShowDistribution *bool `json:"mustShowDistribution,omitempty"`
MustShowResourceList *bool `json:"mustShowResourceList,omitempty"`
// For MonitorSummary (manage_status) widget
DisplayFormat *string `json:"displayFormat,omitempty"`
ColorPreference *string `json:"colorPreference,omitempty"`
HideZeroCounts *bool `json:"hideZeroCounts,omitempty"`
ManageStatusShowTitle *bool `json:"showTitle,omitempty"`
ManageStatusTitleText *string `json:"titleText,omitempty"`
ManageStatusTitleSize *string `json:"titleSize,omitempty"`
ManageStatusTitleAlign *string `json:"titleAlign,omitempty"`
Params *Params `json:"params,omitempty"`
// For LogStream widget
Columns *string `json:"columns,omitempty"`
Logset *string `json:"logset,omitempty"`
// For Uptime
// Widget is undocumented, subject to breaking API changes, and without customer support
Timeframes []*string `json:"timeframes,omitempty"`
Rules map[string]*Rule `json:"rules,omitempty"`
Monitor *ScreenboardMonitor `json:"monitor,omitempty"`
}
type ImageWidget struct {
Height *int `json:"height,omitempty"`
Sizing *string `json:"sizing,omitempty"`
Title *bool `json:"title,omitempty"`
TitleAlign *string `json:"title_align,omitempty"`
TitleSize *TextSize `json:"title_size,omitempty"`
TitleText *string `json:"title_text,omitempty"`
Type *string `json:"type,omitempty"`
Url *string `json:"url,omitempty"`
Width *int `json:"width,omitempty"`
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
type Params struct {
Sort *string `json:"sort,omitempty"`
Text *string `json:"text,omitempty"`
Count *string `json:"count,omitempty"`
Start *string `json:"start,omitempty"`
}
type Rule struct {
Threshold *json.Number `json:"threshold,omitempty"`
Timeframe *string `json:"timeframe,omitempty"`
Color *string `json:"color,omitempty"`
}
type ScreenboardMonitor struct {
Id *int `json:"id,omitempty"`
}

View File

@@ -20,34 +20,11 @@ type Screenboard struct {
Height *string `json:"height,omitempty"`
Width *string `json:"width,omitempty"`
Shared *bool `json:"shared,omitempty"`
Templated *bool `json:"templated,omitempty"`
TemplateVariables []TemplateVariable `json:"template_variables,omitempty"`
Widgets []Widget `json:"widgets"`
ReadOnly *bool `json:"read_only,omitempty"`
}
//type Widget struct {
type Widget struct {
Default *string `json:"default,omitempty"`
Name *string `json:"name,omitempty"`
Prefix *string `json:"prefix,omitempty"`
TimeseriesWidget *TimeseriesWidget `json:"timeseries,omitempty"`
QueryValueWidget *QueryValueWidget `json:"query_value,omitempty"`
EventStreamWidget *EventStreamWidget `json:"event_stream,omitempty"`
FreeTextWidget *FreeTextWidget `json:"free_text,omitempty"`
ToplistWidget *ToplistWidget `json:"toplist,omitempty"`
ImageWidget *ImageWidget `json:"image,omitempty"`
ChangeWidget *ChangeWidget `json:"change,omitempty"`
GraphWidget *GraphWidget `json:"graph,omitempty"`
EventTimelineWidget *EventTimelineWidget `json:"event_timeline,omitempty"`
AlertValueWidget *AlertValueWidget `json:"alert_value,omitempty"`
AlertGraphWidget *AlertGraphWidget `json:"alert_graph,omitempty"`
HostMapWidget *HostMapWidget `json:"hostmap,omitempty"`
CheckStatusWidget *CheckStatusWidget `json:"check_status,omitempty"`
IFrameWidget *IFrameWidget `json:"iframe,omitempty"`
NoteWidget *NoteWidget `json:"frame,omitempty"`
}
// ScreenboardLite represents a user created screenboard. This is the mini
// struct when we load the summaries.
type ScreenboardLite struct {

View File

@@ -30,12 +30,12 @@ type Metric struct {
// Unit represents a unit definition that we might receive when query for timeseries data.
type Unit struct {
Family string `json:"family"`
Family string `json:"family"`
ScaleFactor float32 `json:"scale_factor"`
Name string `json:"name"`
ShortName string `json:"short_name"`
Plural string `json:"plural"`
Id int `json:"id"`
Name string `json:"name"`
ShortName string `json:"short_name"`
Plural string `json:"plural"`
Id int `json:"id"`
}
// A Series is characterized by 2 units as: x per y