Skip to content

Commit

Permalink
Adjust pointers and clean up types for dash groups
Browse files Browse the repository at this point in the history
  • Loading branch information
cory-signalfx committed Jul 11, 2019
1 parent fb22ff6 commit 6b5591d
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 22 deletions.
6 changes: 4 additions & 2 deletions dashboard/model_charts_single_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@

package dashboard

import "github.com/signalfx/signalfx-go/util"

// A single filter object to apply to the charts in the dashboard. The filter specifies a default or user-defined dimension or custom property. You can either include or exclude all the data that matches the dimension or custom property.
type ChartsSingleFilter struct {
// Flag that indicates how the filter should operate. If `true`, data that matches the criteria is _excluded_ from charts; otherwise, data that matches the criteria is included.
NOT bool `json:"NOT,omitempty"`
// Name of the dimension or custom property to match to the data.<br> **Note:** If the dimension or custom property doesn't exist in any of the charts for the dashboard, and `ChartsFilterObject.NOT` is `true`, the system doesn't display any data in the charts.
Property string `json:"property"`
// A list of values to compare to the value of the dimension or custom property specified in `ChartsFilterObject.property`. If the list contains more than one value, the filter becomes a set of queries between the value of `property` and each element of `value`. The system joins these queries with an implicit OR.
Value StringOrSlice `json:"value"`
ApplyIfExists bool `json:"applyIfExists,omitempty"`
Value util.StringOrSlice `json:"value"`
ApplyIfExists bool `json:"applyIfExists,omitempty"`
}
4 changes: 3 additions & 1 deletion dashboard/model_charts_web_ui_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

package dashboard

import "github.com/signalfx/signalfx-go/util"

// The specification for a filter that appears in the web UI. The filter compares the value of a dimension or custom property to a value specified in this filter. You can specify the following in the filter:<br> * A default value * A list of suggested values to display in the web UI * A flag that controls user input; if set to `true`, users are limited to the default and suggested values. <br> You can also force users to choose this filter in order to see data in the dashboard's charts.
type ChartsWebUiFilter struct {
// A label for the filter. The system displays this label in the area preceding the input textarea for the filter in the web UI. <br> **Note:** A good way to indicate that the string is a label is to append a space and a colon (\":\") to it.
Expand All @@ -25,5 +27,5 @@ type ChartsWebUiFilter struct {
// Flag that controls the values allowed in the filter. If `true`, the only allowable values are those specified in the `ChartsWebUIFilter.preferredSuggestsions` array; otherwise, any value is allowed.
Restricted bool `json:"restricted,omitempty"`
// A list of values to compare to the value of the dimension or custom property specified in `ChartsWebUIFilter.property`. If the list contains more than one value, the filter becomes a set of queries between the value of `property` and each element of `value`. The system joins these queries with an implicit OR.
Value StringOrSlice `json:"value"`
Value util.StringOrSlice `json:"value"`
}
4 changes: 3 additions & 1 deletion dashboard/model_event_overlay_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

package dashboard

import "github.com/signalfx/signalfx-go/util"

// Object containing a filter to apply to event overlays, in the form of a comparison expression. Each term in the expression tries to match the values of a dimension or custom property to criteria you specify. Based on the match results, you can include or exclude an event.
type EventOverlayFilter struct {
// Controls the action of the filter. If set to `true`, then the system only selects events that *don't* match the filter.
NOT bool `json:"NOT,omitempty"`
// The custom property or dimension name that provides the value to test in the filter.<br> If the name you specify isn't defined in one or more of the events associated with the dashboard, the filter never matches anything. If the `NOT` property for this filter is set to `true` and the filter never matches, all event overlays are suppressed.
Property string `json:"property"`
// An array of values to test against the specified property. If any of the values match, the system includes the event.<br> **Note:** You must specify at least one element.
Value StringOrSlice `json:"value"`
Value util.StringOrSlice `json:"value"`
}
8 changes: 4 additions & 4 deletions dashboard/model_simple_dashboard_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// Dashboard object that describes the properties needed for a simple dashboard that's specified only by the charts it contains
type SimpleDashboardModel struct {
ChartDensity DashboardChartDensity `json:"chartDensity,omitempty"`
Charts []chart.Chart `json:"charts,omitempty"`
Charts []*chart.Chart `json:"charts,omitempty"`
// The dashboard creation date and time, in the form of a Unix time value (milliseconds since the Unix epoch 1970-01-01 00:00:00 UTC+0). The system sets this value, and you can't modify it.
Created int64 `json:"created,omitempty"`
// SignalFx-assigned user ID of the user that created the dashboard. If the system created this dashboard, the value is \"AAAAAAAAAA\". The system sets this value, and you can't modify it.
Expand All @@ -28,8 +28,8 @@ type SimpleDashboardModel struct {
// Reserved for system use
DiscoveryOptions map[string]interface{} `json:"discoveryOptions,omitempty"`
// Array of event overlay definitions that you can apply to all of the charts of this dashboard. When you apply the overlays, the system displays all the active events that match the specified search term and any specified filter on all the charts in the dashboard. The display uses the color you specify for the overlay and, if selected, vertical lines that mark the event.<br> **Note:** The objects in this array correspond to the *suggested* event overlays specified in the web UI, and they're not automatically applied as active overlays. To set default active event overlays, use the `selectedEventOverlays` property instead.
EventOverlays []EventOverlayFilter `json:"eventOverlays,omitempty"`
Filters ChartsFilters `json:"filters,omitempty"`
EventOverlays []*EventOverlayFilter `json:"eventOverlays,omitempty"`
Filters ChartsFilters `json:"filters,omitempty"`
// ID of an existing dashboard group to associate with this dashboard. If you don't specify a value, the system creates a new dashboard group and assigns its ID to this property during the create process.
GroupId string `json:"groupId,omitempty"`
// The dashboard's SignalFx-assigned ID. This value is \"read-only\" for a create request. The system assigns it and returns it to you in the response.
Expand All @@ -45,7 +45,7 @@ type SimpleDashboardModel struct {
// The displayed name of the chart in the dashboard
Name string `json:"name,omitempty"`
// Array of event overlays that are currently active for the charts in this dashboard. For each overlay, the system displays the active events that match the overlay search term and optional feature, using the the overlay's color and event line settings. To set options for inactive overlays so you can apply them at a later time, use the `eventOverlays` property instead.
SelectedEventOverlays []ChartEventOverlay `json:"selectedEventOverlays,omitempty"`
SelectedEventOverlays []*ChartEventOverlay `json:"selectedEventOverlays,omitempty"`
// An array that contains tag values. You can use tags to search for or filter charts. One use is to tag charts that are in production with the value `prod`. <br> **NOTE:** You can't have more than 50 tags per chart.
Tags []string `json:"tags,omitempty"`
}
2 changes: 1 addition & 1 deletion dashboard_group/model_dashboard_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type DashboardConfig struct {
// String that provides a description override for a mirrored dashboard
DescriptionOverride string `json:"descriptionOverride,omitempty"`
// Filter and dashboard variable overrides for the mirrored dashboard
FiltersOverride Filters `json:"filters,omitempty"`
FiltersOverride *Filters `json:"filters,omitempty"`
// String that overrides the name of the dashboard specified in dashboardId. This property is primarily intended to provide a unique name for a mirrored dashboard.
NameOverride string `json:"nameOverride,omitempty"`
}
4 changes: 3 additions & 1 deletion dashboard_group/model_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

package dashboard_group

import "github.com/signalfx/signalfx-go/util"

// A single filter object to apply to the charts in the dashboard. The filter specifies a default or user-defined dimension or custom property. You can either include or exclude all the data that matches the dimension or custom property.
type Filter struct {
// Flag that indicates how the filter should operate. If `true`, data that matches the criteria is _excluded_ from charts; otherwise, data that matches the criteria is included.
NOT bool `json:"NOT,omitempty"`
// Name of the dimension or custom property to match to the data.<br> **Note:** If the dimension or custom property doesn't exist in any of the charts for the dashboard, and `ChartsFilterObject.NOT` is `true`, the system doesn't display any data in the charts.
Property string `json:"property"`
// A list of values to compare to the value of the dimension or custom property specified in `ChartsFilterObject.property`. If the list contains more than one value, the filter becomes a set of queries between the value of `property` and each element of `value`. The system joins these queries with an implicit OR.
Value []string `json:"value"`
Values util.StringOrSlice `json:"value"`
}
5 changes: 2 additions & 3 deletions dashboard_group/model_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ package dashboard_group
// Specifies the properties of filters to apply to the cloned dashboard. <br> This is an *optional* property that you only need to use if you want to override the `filters` property of the dashboard you're cloning. Filters give you fine-grained control over the data displayed in the charts in the dashboard. You can specify *ad hoc* filters or save them as variables for repeated use of the filter criteria. <br> You can also use filters to apply a custom time window to all of the charts in the dashboard.
type Filters struct {
// List of filter objects to apply to the charts in the dashboard. Each object specifies a single filter for a default or user-defined dimension or custom property.
Sources []Filter `json:"sources,omitempty"`
Time FiltersTime `json:"time,omitempty"`
Sources []*Filter `json:"sources,omitempty"`
// Array of web UI-oriented filters that appear at the top of the dashboard. For each filter you can specify a name and a label for the dimension or custom property to filter against, a list of suggested comparison values to display in the web UI, and other properties that control the web UI display. To see a more detailed description of the options, see the property descriptions for the `ChartsWebUIFilter` model.
Variables []WebUiFilter `json:"variables,omitempty"`
Variables []*WebUiFilter `json:"variables,omitempty"`
}
2 changes: 1 addition & 1 deletion dashboard_group/model_search_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ type SearchResult struct {
// Number of dashboard group objects that matched the provided search criteria.<br> **Note:** This value is a count of the total number of objects in the result set. The number of objects that the system returns is affected by the `limit` and `offset` query parameters. In summary:<br> * `count`: Size of result set * number of returned objects: * (`limit` - `offset`) >= `count`: `count` * (`limit` - `offset`) < `count`: `limit` - `offset`
Count int32 `json:"count,omitempty"`
// Array of dashboard group objects that the system returns as the result of the request. These objects represent dashboard groups that match the search query. The number and location of the objects within the result set depend on the query parameters you specify in the request. To learn more, see the top-level description of the API and the description of the `count` response property.
Results []DashboardGroup `json:"results,omitempty"`
Results []*DashboardGroup `json:"results,omitempty"`
}
11 changes: 4 additions & 7 deletions dashboard_group/model_web_ui_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@

package dashboard_group

import "github.com/signalfx/signalfx-go/util"

// The specification for a filter that appears in the web UI. The filter compares the value of a dimension or custom property to a value specified in this filter. You can specify the following in the filter:<br> * A default value * A list of suggested values to display in the web UI * A flag that controls user input; if set to `true`, users are limited to the default and suggested values. <br> You can also force users to choose this filter in order to see data in the dashboard's charts.
type WebUiFilter struct {
// A label for the filter. The system displays this label in the area preceding the input textarea for the filter in the web UI. <br> **Note:** A good way to indicate that the string is a label is to append a space and a colon (\":\") to it.
Alias string `json:"alias,omitempty"`
// Array of strings containing values to place at the top of the **Suggested Values** dropdown in web UI for the dashboard. If `ChartsWebUIFilter.restricted` is `true`, the filter must use one of the values in this array; users only have a choice of selecting a value from this array.
PreferredSuggestions []string `json:"preferredSuggestions,omitempty"`
PreferredSuggestions util.StringOrSlice `json:"preferredSuggestions,omitempty"`
// Name of a custom property or dimension to filter against.<br> **Note:** If the dimension or custom property doesn't exist in any of the charts for the dashboard, the system doesn't display any data in the charts.
Property string `json:"property"`
// Flag that controls the display of chart data. If `true`, users must use this filter in order to see data; otherwise, users can delete the filter.
Required bool `json:"required,omitempty"`
// Flag that controls the values allowed in the filter. If `true`, the only allowable values are those specified in the `ChartsWebUIFilter.preferredSuggestions` array; otherwise, any value is allowed.
Restricted bool `json:"restricted,omitempty"`
// A list of values to compare to the value of the dimension or custom property specified in `ChartsWebUIFilter.property`. If the list contains more than one value, the filter becomes a set of queries between the value of `property` and each element of `value`. The system joins these queries with an implicit OR.
Value []string `json:"value"`
Value util.StringOrSlice `json:"value"`
}
2 changes: 1 addition & 1 deletion dashboard/string_or_slice.go → util/string_or_slice.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dashboard
package util

import "encoding/json"

Expand Down

0 comments on commit 6b5591d

Please sign in to comment.