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

     1  # dashboards
     2  --
     3      import "."
     4  
     5  
     6  ## Usage
     7  
     8  ```go
     9  var (
    10  	// Visibility specifies the possible options for a dashboard's visibility.
    11  	Visibility = struct {
    12  		Owner VisibilityType
    13  		All   VisibilityType
    14  	}{
    15  		Owner: "owner",
    16  		All:   "all",
    17  	}
    18  
    19  	// Editable specifies the possible options for who can edit a dashboard.
    20  	Editable = struct {
    21  		Owner    EditableType
    22  		All      EditableType
    23  		ReadOnly EditableType
    24  	}{
    25  		Owner:    "editable_by_owner",
    26  		All:      "editable_by_all",
    27  		ReadOnly: "read_only",
    28  	}
    29  )
    30  ```
    31  
    32  #### type Dashboard
    33  
    34  ```go
    35  type Dashboard struct {
    36  	ID         int               `json:"id"`
    37  	Title      string            `json:"title,omitempty"`
    38  	Icon       string            `json:"icon,omitempty"`
    39  	CreatedAt  time.Time         `json:"created_at,omitempty"`
    40  	UpdatedAt  time.Time         `json:"updated_at,omitempty"`
    41  	Visibility VisibilityType    `json:"visibility,omitempty"`
    42  	Editable   EditableType      `json:"editable,omitempty"`
    43  	UIURL      string            `json:"ui_url,omitempty"`
    44  	APIURL     string            `json:"api_url,omitempty"`
    45  	OwnerEmail string            `json:"owner_email,omitempty"`
    46  	Metadata   DashboardMetadata `json:"metadata"`
    47  	Filter     DashboardFilter   `json:"filter,omitempty"`
    48  	Widgets    []DashboardWidget `json:"widgets,omitempty"`
    49  }
    50  ```
    51  
    52  Dashboard represents information about a New Relic dashboard.
    53  
    54  #### type DashboardFilter
    55  
    56  ```go
    57  type DashboardFilter struct {
    58  	EventTypes []string `json:"event_types,omitempty"`
    59  	Attributes []string `json:"attributes,omitempty"`
    60  }
    61  ```
    62  
    63  DashboardFilter represents the filter in a dashboard.
    64  
    65  #### type DashboardMetadata
    66  
    67  ```go
    68  type DashboardMetadata struct {
    69  	Version int `json:"version"`
    70  }
    71  ```
    72  
    73  DashboardMetadata represents metadata about the dashboard (like version)
    74  
    75  #### type DashboardWidget
    76  
    77  ```go
    78  type DashboardWidget struct {
    79  	Visualization string                      `json:"visualization,omitempty"`
    80  	ID            int                         `json:"widget_id,omitempty"`
    81  	AccountID     int                         `json:"account_id,omitempty"`
    82  	Data          []DashboardWidgetData       `json:"data,omitempty"`
    83  	Presentation  DashboardWidgetPresentation `json:"presentation,omitempty"`
    84  	Layout        DashboardWidgetLayout       `json:"layout,omitempty"`
    85  }
    86  ```
    87  
    88  DashboardWidget represents a widget in a dashboard.
    89  
    90  #### type DashboardWidgetData
    91  
    92  ```go
    93  type DashboardWidgetData struct {
    94  	NRQL          string                           `json:"nrql,omitempty"`
    95  	Source        string                           `json:"source,omitempty"`
    96  	Duration      int                              `json:"duration,omitempty"`
    97  	EndTime       int                              `json:"end_time,omitempty"`
    98  	EntityIds     []int                            `json:"entity_ids,omitempty"`
    99  	CompareWith   []DashboardWidgetDataCompareWith `json:"compare_with,omitempty"`
   100  	Metrics       []DashboardWidgetDataMetric      `json:"metrics,omitempty"`
   101  	RawMetricName string                           `json:"raw_metric_name,omitempty"`
   102  	Facet         string                           `json:"facet,omitempty"`
   103  	OrderBy       string                           `json:"order_by,omitempty"`
   104  	Limit         int                              `json:"limit,omitempty"`
   105  }
   106  ```
   107  
   108  DashboardWidgetData represents the data backing a dashboard widget.
   109  
   110  #### type DashboardWidgetDataCompareWith
   111  
   112  ```go
   113  type DashboardWidgetDataCompareWith struct {
   114  	OffsetDuration string                                     `json:"offset_duration,omitempty"`
   115  	Presentation   DashboardWidgetDataCompareWithPresentation `json:"presentation,omitempty"`
   116  }
   117  ```
   118  
   119  DashboardWidgetDataCompareWith represents the compare with configuration of the
   120  widget.
   121  
   122  #### type DashboardWidgetDataCompareWithPresentation
   123  
   124  ```go
   125  type DashboardWidgetDataCompareWithPresentation struct {
   126  	Name  string `json:"name,omitempty"`
   127  	Color string `json:"color,omitempty"`
   128  }
   129  ```
   130  
   131  DashboardWidgetDataCompareWithPresentation represents the compare with
   132  presentation configuration of the widget.
   133  
   134  #### type DashboardWidgetDataMetric
   135  
   136  ```go
   137  type DashboardWidgetDataMetric struct {
   138  	Name   string   `json:"name,omitempty"`
   139  	Units  string   `json:"units,omitempty"`
   140  	Scope  string   `json:"scope,omitempty"`
   141  	Values []string `json:"values,omitempty"`
   142  }
   143  ```
   144  
   145  DashboardWidgetDataMetric represents the metrics data of the widget.
   146  
   147  #### type DashboardWidgetLayout
   148  
   149  ```go
   150  type DashboardWidgetLayout struct {
   151  	Width  int `json:"width"`
   152  	Height int `json:"height"`
   153  	Row    int `json:"row"`
   154  	Column int `json:"column"`
   155  }
   156  ```
   157  
   158  DashboardWidgetLayout represents the layout of a widget in a dashboard.
   159  
   160  #### type DashboardWidgetPresentation
   161  
   162  ```go
   163  type DashboardWidgetPresentation struct {
   164  	Title                string                    `json:"title,omitempty"`
   165  	Notes                string                    `json:"notes,omitempty"`
   166  	DrilldownDashboardID int                       `json:"drilldown_dashboard_id,omitempty"`
   167  	Threshold            *DashboardWidgetThreshold `json:"threshold,omitempty"`
   168  }
   169  ```
   170  
   171  DashboardWidgetPresentation represents the visual presentation of a dashboard
   172  widget.
   173  
   174  #### type DashboardWidgetThreshold
   175  
   176  ```go
   177  type DashboardWidgetThreshold struct {
   178  	Red    float64 `json:"red,omitempty"`
   179  	Yellow float64 `json:"yellow,omitempty"`
   180  }
   181  ```
   182  
   183  DashboardWidgetThreshold represents the threshold configuration of a dashboard
   184  widget.
   185  
   186  #### type Dashboards
   187  
   188  ```go
   189  type Dashboards struct {
   190  }
   191  ```
   192  
   193  Dashboards is used to communicate with the New Relic Dashboards product.
   194  
   195  #### func  New
   196  
   197  ```go
   198  func New(config config.Config) Dashboards
   199  ```
   200  New is used to create a new Dashboards client instance.
   201  
   202  #### func (*Dashboards) CreateDashboard
   203  
   204  ```go
   205  func (dashboards *Dashboards) CreateDashboard(dashboard Dashboard) (*Dashboard, error)
   206  ```
   207  CreateDashboard is used to create a New Relic dashboard.
   208  
   209  #### func (*Dashboards) DeleteDashboard
   210  
   211  ```go
   212  func (dashboards *Dashboards) DeleteDashboard(dashboardID int) (*Dashboard, error)
   213  ```
   214  DeleteDashboard is used to delete a New Relic dashboard.
   215  
   216  #### func (*Dashboards) GetDashboard
   217  
   218  ```go
   219  func (dashboards *Dashboards) GetDashboard(dashboardID int) (*Dashboard, error)
   220  ```
   221  GetDashboard is used to retrieve a single New Relic dashboard.
   222  
   223  #### func (*Dashboards) ListDashboards
   224  
   225  ```go
   226  func (dashboards *Dashboards) ListDashboards(params *ListDashboardsParams) ([]Dashboard, error)
   227  ```
   228  ListDashboards is used to retrieve New Relic dashboards.
   229  
   230  #### func (*Dashboards) UpdateDashboard
   231  
   232  ```go
   233  func (dashboards *Dashboards) UpdateDashboard(dashboard Dashboard) (*Dashboard, error)
   234  ```
   235  UpdateDashboard is used to update a New Relic dashboard.
   236  
   237  #### type EditableType
   238  
   239  ```go
   240  type EditableType string
   241  ```
   242  
   243  EditableType represents an option for the dashboard's editable field.
   244  
   245  #### type ListDashboardsParams
   246  
   247  ```go
   248  type ListDashboardsParams struct {
   249  	Category      string
   250  	CreatedAfter  *time.Time
   251  	CreatedBefore *time.Time
   252  	Page          int
   253  	PerPage       int
   254  	Sort          string
   255  	Title         string
   256  	UpdatedAfter  *time.Time
   257  	UpdatedBefore *time.Time
   258  }
   259  ```
   260  
   261  ListDashboardsParams represents a set of filters to be used when querying New
   262  Relic dashboards.
   263  
   264  #### type VisibilityType
   265  
   266  ```go
   267  type VisibilityType string
   268  ```
   269  
   270  VisibilityType represents an option for the dashboard's visibility field.