Skip to content

Commit

Permalink
fix(entities): manual adjustments were needed for some dashboard type…
Browse files Browse the repository at this point in the history
…s (pointers)
  • Loading branch information
sanderblue committed Jul 1, 2024
1 parent 4dd2397 commit 5148249
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 25 deletions.
14 changes: 14 additions & 0 deletions .tutone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,20 @@ packages:
- name: EntityAlertViolationInt
create_as: int

# TODO: These should be generated and referenced from the dashboards package
- name: DashboardVariable
skip_type_create: true
- name: DashboardVariableDefaultValue
field_type_override: "*DashboardVariableDefaultValue"
- name: DashboardVariableNRQLQuery
field_type_override: "*DashboardVariableNRQLQuery"
- name: DashboardVariableOptions
field_type_override: "*DashboardVariableOptions"
- name: DashboardVariableDefaultItem
- name: DashboardVariableEnumItem
- name: DashboardVariableReplacementStrategy
- name: DashboardVariableType

#
# Types that our other packages define
# TODO: Fix tutone to figure this out for us
Expand Down
26 changes: 1 addition & 25 deletions pkg/entities/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5272,34 +5272,10 @@ type DashboardTableWidgetConfiguration struct {
NRQLQueries []DashboardWidgetNRQLQuery `json:"nrqlQueries,omitempty"`
}

// DashboardVariable - Definition of a variable that is local to this dashboard. Variables are placeholders for dynamic values in widget NRQLs.
type DashboardVariable struct {
// [DEPRECATED] Default value for this variable. The actual value to be used will depend on the type.
DefaultValue DashboardVariableDefaultValue `json:"defaultValue,omitempty"`
// Default values for this variable. The actual value to be used will depend on the type.
DefaultValues []DashboardVariableDefaultItem `json:"defaultValues,omitempty"`
// Indicates whether this variable supports multiple selection or not. Only applies to variables of type NRQL or ENUM.
IsMultiSelection bool `json:"isMultiSelection,omitempty"`
// List of possible values for variables of type ENUM.
Items []DashboardVariableEnumItem `json:"items,omitempty"`
// Configuration for variables of type NRQL.
NRQLQuery DashboardVariableNRQLQuery `json:"nrqlQuery,omitempty"`
// Variable identifier.
Name string `json:"name,omitempty"`
// Options applied to the variable.
Options DashboardVariableOptions `json:"options,omitempty"`
// Indicates the strategy to apply when replacing a variable in a NRQL query.
ReplacementStrategy DashboardVariableReplacementStrategy `json:"replacementStrategy,omitempty"`
// Human-friendly display string for this variable.
Title string `json:"title,omitempty"`
// Specifies the data type of the variable and where its possible values may come from.
Type DashboardVariableType `json:"type,omitempty"`
}

// DashboardVariableDefaultItem - Represents a possible default value item.
type DashboardVariableDefaultItem struct {
// The value of this default item.
Value DashboardVariableDefaultValue `json:"value,omitempty"`
Value *DashboardVariableDefaultValue `json:"value,omitempty"`
}

// DashboardVariableDefaultValue - Specifies a default value for variables.
Expand Down
24 changes: 24 additions & 0 deletions pkg/entities/types_.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,27 @@ var DashboardPermissionsTypes = struct {
// Public read & write
PUBLIC_READ_WRITE: "PUBLIC_READ_WRITE",
}

// DashboardVariable - Definition of a variable that is local to this dashboard. Variables are placeholders for dynamic values in widget NRQLs.
type DashboardVariable struct {
// [DEPRECATED] Default value for this variable. The actual value to be used will depend on the type.
DefaultValue *DashboardVariableDefaultValue `json:"defaultValue,omitempty"`
// Default values for this variable. The actual value to be used will depend on the type.
DefaultValues *[]DashboardVariableDefaultItem `json:"defaultValues,omitempty"`
// Indicates whether this variable supports multiple selection or not. Only applies to variables of type NRQL or ENUM.
IsMultiSelection bool `json:"isMultiSelection,omitempty"`
// List of possible values for variables of type ENUM.
Items []DashboardVariableEnumItem `json:"items,omitempty"`
// Configuration for variables of type NRQL.
NRQLQuery *DashboardVariableNRQLQuery `json:"nrqlQuery,omitempty"`
// Variable identifier.
Name string `json:"name,omitempty"`
// Options applied to the variable
Options *DashboardVariableOptions `json:"options,omitempty"`
// Indicates the strategy to apply when replacing a variable in a NRQL query.
ReplacementStrategy DashboardVariableReplacementStrategy `json:"replacementStrategy,omitempty"`
// Human-friendly display string for this variable.
Title string `json:"title,omitempty"`
// Specifies the data type of the variable and where its possible values may come from.
Type DashboardVariableType `json:"type,omitempty"`
}

0 comments on commit 5148249

Please sign in to comment.