github.com/newrelic/newrelic-client-go@v1.1.0/pkg/dashboards/dashboards_types.go (about)

     1  package dashboards
     2  
     3  import "time"
     4  
     5  // Dashboard represents information about a New Relic dashboard.
     6  type Dashboard struct {
     7  	ID              int                 `json:"id"`
     8  	Title           string              `json:"title,omitempty"`
     9  	Icon            DashboardIconType   `json:"icon,omitempty"`
    10  	CreatedAt       time.Time           `json:"created_at,omitempty"`
    11  	UpdatedAt       time.Time           `json:"updated_at,omitempty"`
    12  	Visibility      VisibilityType      `json:"visibility,omitempty"`
    13  	Editable        EditableType        `json:"editable,omitempty"`
    14  	UIURL           string              `json:"ui_url,omitempty"`
    15  	APIURL          string              `json:"api_url,omitempty"`
    16  	OwnerEmail      string              `json:"owner_email,omitempty"`
    17  	Metadata        DashboardMetadata   `json:"metadata"`
    18  	Filter          DashboardFilter     `json:"filter,omitempty"`
    19  	Widgets         []DashboardWidget   `json:"widgets,omitempty"`
    20  	GridColumnCount GridColumnCountType `json:"grid_column_count,omitempty"`
    21  }
    22  
    23  // GridColumnCountType represents an option for the dashboard's grid column count.
    24  // New Relic Insights supports a 3 column grid.
    25  // New Relic One supports a 12 column grid.
    26  type GridColumnCountType int
    27  
    28  var (
    29  	GridColumnCountTypes = struct {
    30  		Insights GridColumnCountType
    31  		One      GridColumnCountType
    32  	}{
    33  		Insights: 3,
    34  		One:      12,
    35  	}
    36  )
    37  
    38  // VisibilityType represents an option for the dashboard's visibility field.
    39  type VisibilityType string
    40  
    41  var (
    42  	// VisibilityTypes specifies the possible options for a dashboard's visibility.
    43  	VisibilityTypes = struct {
    44  		Owner VisibilityType
    45  		All   VisibilityType
    46  	}{
    47  		Owner: "owner",
    48  		All:   "all",
    49  	}
    50  )
    51  
    52  // EditableType represents an option for the dashboard's editable field.
    53  type EditableType string
    54  
    55  var (
    56  	// EditableTypes specifies the possible options for who can edit a dashboard.
    57  	EditableTypes = struct {
    58  		Owner    EditableType
    59  		All      EditableType
    60  		ReadOnly EditableType
    61  	}{
    62  		Owner:    "editable_by_owner",
    63  		All:      "editable_by_all",
    64  		ReadOnly: "read_only",
    65  	}
    66  )
    67  
    68  // DashboardIconType represents an option for the dashboard's icon field.
    69  type DashboardIconType string
    70  
    71  var (
    72  	// DashboardIconTypes specifies the possible options for dashboard icons.
    73  	DashboardIconTypes = struct {
    74  		Adjust       DashboardIconType
    75  		Archive      DashboardIconType
    76  		BarChart     DashboardIconType
    77  		Bell         DashboardIconType
    78  		Bolt         DashboardIconType
    79  		Bug          DashboardIconType
    80  		Bullhorn     DashboardIconType
    81  		Bullseye     DashboardIconType
    82  		Clock        DashboardIconType
    83  		Cloud        DashboardIconType
    84  		Cog          DashboardIconType
    85  		Comments     DashboardIconType
    86  		Crosshairs   DashboardIconType
    87  		Dashboard    DashboardIconType
    88  		Envelope     DashboardIconType
    89  		Fire         DashboardIconType
    90  		Flag         DashboardIconType
    91  		Flask        DashboardIconType
    92  		Globe        DashboardIconType
    93  		Heart        DashboardIconType
    94  		Leaf         DashboardIconType
    95  		Legal        DashboardIconType
    96  		LifeRing     DashboardIconType
    97  		LineChart    DashboardIconType
    98  		Magic        DashboardIconType
    99  		Mobile       DashboardIconType
   100  		Money        DashboardIconType
   101  		None         DashboardIconType
   102  		PaperPlane   DashboardIconType
   103  		PieChart     DashboardIconType
   104  		PuzzlePiece  DashboardIconType
   105  		Road         DashboardIconType
   106  		Rocket       DashboardIconType
   107  		ShoppingCart DashboardIconType
   108  		Sitemap      DashboardIconType
   109  		Sliders      DashboardIconType
   110  		Tablet       DashboardIconType
   111  		ThumbsDown   DashboardIconType
   112  		ThumbsUp     DashboardIconType
   113  		Trophy       DashboardIconType
   114  		USD          DashboardIconType
   115  		User         DashboardIconType
   116  		Users        DashboardIconType
   117  	}{
   118  		Adjust:       "adjust",
   119  		Archive:      "archive",
   120  		BarChart:     "bar-chart",
   121  		Bell:         "bell",
   122  		Bolt:         "bolt",
   123  		Bug:          "bug",
   124  		Bullhorn:     "bullhorn",
   125  		Bullseye:     "bullseye",
   126  		Clock:        "clock-o",
   127  		Cloud:        "cloud",
   128  		Cog:          "cog",
   129  		Comments:     "comments-o",
   130  		Crosshairs:   "crosshairs",
   131  		Dashboard:    "dashboard",
   132  		Envelope:     "envelope",
   133  		Fire:         "fire",
   134  		Flag:         "flag",
   135  		Flask:        "flask",
   136  		Globe:        "globe",
   137  		Heart:        "heart",
   138  		Leaf:         "leaf",
   139  		Legal:        "legal",
   140  		LifeRing:     "life-ring",
   141  		LineChart:    "line-chart",
   142  		Magic:        "magic",
   143  		Mobile:       "mobile",
   144  		Money:        "money",
   145  		None:         "none",
   146  		PaperPlane:   "paper-plane",
   147  		PieChart:     "pie-chart",
   148  		PuzzlePiece:  "puzzle-piece",
   149  		Road:         "road",
   150  		Rocket:       "rocket",
   151  		ShoppingCart: "shopping-cart",
   152  		Sitemap:      "sitemap",
   153  		Sliders:      "sliders",
   154  		Tablet:       "tablet",
   155  		ThumbsDown:   "thumbs-down",
   156  		ThumbsUp:     "thumbs-up",
   157  		Trophy:       "trophy",
   158  		USD:          "usd",
   159  		User:         "user",
   160  		Users:        "users",
   161  	}
   162  )
   163  
   164  // VisualizationType represents an option for adashboard widget's type.
   165  type VisualizationType string
   166  
   167  var (
   168  	// VisualizationTypes specifies the possible options for dashboard widget types.
   169  	VisualizationTypes = struct {
   170  		ApplicationBreakdown VisualizationType
   171  		AttributeSheet       VisualizationType
   172  		Billboard            VisualizationType
   173  		BillboardComparison  VisualizationType
   174  		ComparisonLineChart  VisualizationType
   175  		EventFeed            VisualizationType
   176  		EventTable           VisualizationType
   177  		FacetBarChart        VisualizationType
   178  		FacetPieChart        VisualizationType
   179  		FacetTable           VisualizationType
   180  		FacetedAreaChart     VisualizationType
   181  		FacetedLineChart     VisualizationType
   182  		Funnel               VisualizationType
   183  		Gauge                VisualizationType
   184  		Heatmap              VisualizationType
   185  		Histogram            VisualizationType
   186  		LineChart            VisualizationType
   187  		Markdown             VisualizationType
   188  		MetricLineChart      VisualizationType
   189  		RawJSON              VisualizationType
   190  		SingleEvent          VisualizationType
   191  		UniquesList          VisualizationType
   192  	}{
   193  		ApplicationBreakdown: "application_breakdown",
   194  		AttributeSheet:       "attribute_sheet",
   195  		Billboard:            "billboard",
   196  		BillboardComparison:  "billboard_comparison",
   197  		ComparisonLineChart:  "comparison_line_chart",
   198  		EventFeed:            "event_feed",
   199  		EventTable:           "event_table",
   200  		FacetBarChart:        "facet_bar_chart",
   201  		FacetPieChart:        "facet_pie_chart",
   202  		FacetTable:           "facet_table",
   203  		FacetedAreaChart:     "faceted_area_chart",
   204  		FacetedLineChart:     "faceted_line_chart",
   205  		Funnel:               "funnel",
   206  		Gauge:                "gauge",
   207  		Heatmap:              "heatmap",
   208  		Histogram:            "histogram",
   209  		LineChart:            "line_chart",
   210  		Markdown:             "markdown",
   211  		MetricLineChart:      "metric_line_chart",
   212  		RawJSON:              "raw_json",
   213  		SingleEvent:          "single_event",
   214  		UniquesList:          "uniques_list",
   215  	}
   216  )
   217  
   218  // DashboardMetadata represents metadata about the dashboard (like version)
   219  type DashboardMetadata struct {
   220  	Version int `json:"version"`
   221  }
   222  
   223  // DashboardWidget represents a widget in a dashboard.
   224  type DashboardWidget struct {
   225  	Visualization VisualizationType           `json:"visualization,omitempty"`
   226  	ID            int                         `json:"widget_id,omitempty"`
   227  	AccountID     int                         `json:"account_id,omitempty"`
   228  	Data          []DashboardWidgetData       `json:"data,omitempty"`
   229  	Presentation  DashboardWidgetPresentation `json:"presentation,omitempty"`
   230  	Layout        DashboardWidgetLayout       `json:"layout,omitempty"`
   231  }
   232  
   233  // DashboardWidgetData represents the data backing a dashboard widget.
   234  type DashboardWidgetData struct {
   235  	NRQL          string                           `json:"nrql,omitempty"`
   236  	Source        string                           `json:"source,omitempty"`
   237  	Duration      int                              `json:"duration,omitempty"`
   238  	EndTime       int                              `json:"end_time,omitempty"`
   239  	EntityIds     []int                            `json:"entity_ids,omitempty"`
   240  	CompareWith   []DashboardWidgetDataCompareWith `json:"compare_with,omitempty"`
   241  	Metrics       []DashboardWidgetDataMetric      `json:"metrics,omitempty"`
   242  	RawMetricName string                           `json:"raw_metric_name,omitempty"`
   243  	Facet         string                           `json:"facet,omitempty"`
   244  	OrderBy       string                           `json:"order_by,omitempty"`
   245  	Limit         int                              `json:"limit,omitempty"`
   246  }
   247  
   248  // DashboardWidgetDataCompareWith represents the compare with configuration of the widget.
   249  type DashboardWidgetDataCompareWith struct {
   250  	OffsetDuration string                                     `json:"offset_duration,omitempty"`
   251  	Presentation   DashboardWidgetDataCompareWithPresentation `json:"presentation,omitempty"`
   252  }
   253  
   254  // DashboardWidgetDataCompareWithPresentation represents the compare with presentation configuration of the widget.
   255  type DashboardWidgetDataCompareWithPresentation struct {
   256  	Name  string `json:"name,omitempty"`
   257  	Color string `json:"color,omitempty"`
   258  }
   259  
   260  // DashboardWidgetDataMetric represents the metrics data of the widget.
   261  type DashboardWidgetDataMetric struct {
   262  	Name   string   `json:"name,omitempty"`
   263  	Units  string   `json:"units,omitempty"`
   264  	Scope  string   `json:"scope,omitempty"`
   265  	Values []string `json:"values,omitempty"`
   266  }
   267  
   268  // DashboardWidgetPresentation represents the visual presentation of a dashboard widget.
   269  type DashboardWidgetPresentation struct {
   270  	Title                string                    `json:"title,omitempty"`
   271  	Notes                string                    `json:"notes,omitempty"`
   272  	DrilldownDashboardID int                       `json:"drilldown_dashboard_id,omitempty"`
   273  	Threshold            *DashboardWidgetThreshold `json:"threshold,omitempty"`
   274  }
   275  
   276  // DashboardWidgetThreshold represents the threshold configuration of a dashboard widget.
   277  type DashboardWidgetThreshold struct {
   278  	Red    float64 `json:"red,omitempty"`
   279  	Yellow float64 `json:"yellow,omitempty"`
   280  }
   281  
   282  // DashboardWidgetLayout represents the layout of a widget in a dashboard.
   283  type DashboardWidgetLayout struct {
   284  	Width  int `json:"width"`
   285  	Height int `json:"height"`
   286  	Row    int `json:"row"`
   287  	Column int `json:"column"`
   288  }
   289  
   290  // DashboardFilter represents the filter in a dashboard.
   291  type DashboardFilter struct {
   292  	EventTypes []string `json:"event_types,omitempty"`
   293  	Attributes []string `json:"attributes,omitempty"`
   294  }
   295  
   296  // RawConfiguration represents the configuration for widgets, it's a replacement for configuration field
   297  type RawConfiguration struct {
   298  	// Used by all widgets
   299  	NRQLQueries     []DashboardWidgetNRQLQueryInput  `json:"nrqlQueries,omitempty"`
   300  	PlatformOptions *RawConfigurationPlatformOptions `json:"platformOptions,omitempty"`
   301  
   302  	// Used by viz.bullet
   303  	Limit float64 `json:"limit,omitempty"`
   304  
   305  	// Used by viz.markdown
   306  	Text string `json:"text,omitempty"`
   307  
   308  	// Used by viz.billboard
   309  	Thresholds []DashboardBillboardWidgetThresholdInput `json:"thresholds,omitempty"`
   310  }
   311  
   312  // RawConfigurationPlatformOptions represents the platform widget options
   313  type RawConfigurationPlatformOptions struct {
   314  	IgnoreTimeRange bool `json:"ignoreTimeRange,omitempty"`
   315  }