| `hide` | integer | **Yes** | | Determine if the variable shows on dashboard<br/>Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).<br/>Possible values are: `0`, `1`, `2`. |
| `id` | string | **Yes** | `00000000-0000-0000-0000-000000000000` | Unique numeric identifier for the variable. |
| `name` | string | **Yes** | | Name of variable |
| `skipUrlSync` | boolean | **Yes** | `false` | Whether the variable value should be managed by URL query params or not |
| `type` | string | **Yes** | | Dashboard variable type<br/>`query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.<br/>`adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).<br/>`constant`: Define a hidden constant.<br/>`datasource`: Quickly change the data source for an entire dashboard.<br/>`interval`: Interval variables represent time spans.<br/>`textbox`: Display a free text input field with an optional default value.<br/>`custom`: Define the variable options manually using a comma-separated list.<br/>`system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables<br/>Possible values are: `query`, `adhoc`, `constant`, `datasource`, `interval`, `textbox`, `custom`, `system`. |
| `allFormat` | string | No | | Format to use while fetching all values from data source, eg: wildcard, glob, regex, pipe, etc. |
| `current` | [VariableOption](#variableoption) | No | | Option to be selected in a variable. |
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
| `description` | string | No | | Description of variable. It can be defined but `null`. |
| `label` | string | No | | Optional display name |
| `multi` | boolean | No | `false` | Whether multiple values can be selected or not from variable value list |
| `options` | [VariableOption](#variableoption)[] | No | | Options that can be selected for a variable. |
| `query` | | No | | Query used to fetch values for a variable |
| `refresh` | integer | No | | Options to config when to refresh a variable<br/>`0`: Never refresh the variable<br/>`1`: Queries the data source every time the dashboard loads.<br/>`2`: Queries the data source when the dashboard time range changes.<br/>Possible values are: `0`, `1`, `2`. |
| `name` | string | **Yes** | | Name of variable |
| `type` | string | **Yes** | | Dashboard variable type<br/>`query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.<br/>`adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).<br/>`constant`: Define a hidden constant.<br/>`datasource`: Quickly change the data source for an entire dashboard.<br/>`interval`: Interval variables represent time spans.<br/>`textbox`: Display a free text input field with an optional default value.<br/>`custom`: Define the variable options manually using a comma-separated list.<br/>`system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables<br/>Possible values are: `query`, `adhoc`, `constant`, `datasource`, `interval`, `textbox`, `custom`, `system`. |
| `current` | [VariableOption](#variableoption) | No | | Option to be selected in a variable. |
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
| `description` | string | No | | Description of variable. It can be defined but `null`. |
| `hide` | integer | No | | Determine if the variable shows on dashboard<br/>Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).<br/>Possible values are: `0`, `1`, `2`. |
| `label` | string | No | | Optional display name |
| `multi` | boolean | No | `false` | Whether multiple values can be selected or not from variable value list |
| `options` | [VariableOption](#variableoption)[] | No | | Options that can be selected for a variable. |
| `query` | | No | | Query used to fetch values for a variable |
| `refresh` | integer | No | | Options to config when to refresh a variable<br/>`0`: Never refresh the variable<br/>`1`: Queries the data source every time the dashboard loads.<br/>`2`: Queries the data source when the dashboard time range changes.<br/>Possible values are: `0`, `1`, `2`. |
| `skipUrlSync` | boolean | No | `false` | Whether the variable value should be managed by URL query params or not |
// Accepted values are `NotStarted` (the request is not started), `Loading` (waiting for response), `Streaming` (pulling continuous data), `Done` (response received successfully) or `Error` (failed request).
// A variable is a placeholder for a value. You can use variables in metric queries and in panel titles.
typeVariableModelstruct{
// Format to use while fetching all values from data source, eg: wildcard, glob, regex, pipe, etc.
AllFormat*string`json:"allFormat,omitempty"`
// Option to be selected in a variable.
Current*VariableOption`json:"current,omitempty"`
@ -914,10 +922,7 @@ type VariableModel struct {
// Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
HideVariableHide`json:"hide"`
// Unique numeric identifier for the variable.
Idstring`json:"id"`
Hide*VariableHide`json:"hide,omitempty"`
// Optional display name
Label*string`json:"label,omitempty"`
@ -941,7 +946,18 @@ type VariableModel struct {
Refresh*VariableRefresh`json:"refresh,omitempty"`
// Whether the variable value should be managed by URL query params or not
SkipUrlSyncbool`json:"skipUrlSync"`
SkipUrlSync*bool`json:"skipUrlSync,omitempty"`
// Sort variable options
// Accepted values are:
// `0`: No sorting
// `1`: Alphabetical ASC
// `2`: Alphabetical DESC
// `3`: Numerical ASC
// `4`: Numerical DESC
// `5`: Alphabetical Case Insensitive ASC
// `6`: Alphabetical Case Insensitive DESC
Sort*VariableSort`json:"sort,omitempty"`
// Dashboard variable type
// `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
@ -973,6 +989,17 @@ type VariableOption struct {
// `2`: Queries the data source when the dashboard time range changes.
typeVariableRefreshint
// Sort variable options
// Accepted values are:
// `0`: No sorting
// `1`: Alphabetical ASC
// `2`: Alphabetical DESC
// `3`: Numerical ASC
// `4`: Numerical DESC
// `5`: Alphabetical Case Insensitive ASC
// `6`: Alphabetical Case Insensitive DESC
typeVariableSortint
// Dashboard variable type
// `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
// `adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).