1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
use serde::{Serialize, Deserialize};
use serde_json::Value;

#[derive(Serialize, Deserialize, Debug)]
pub struct Annotations {
    list: Vec<Value>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Dashboard {
    pub annotations: Option<Annotations>,
    pub editable: bool,
    #[serde(rename = "gnetId")]
    pub gnet_id: Value,
    #[serde(rename = "graphTooltip")]
    pub graph_tooltip: Option<i64>,
    #[serde(rename = "hideControls")]
    pub hide_controls: Option<bool>,
    pub id: i64,
    pub links: Option<Vec<Value>>,
    pub panels: Vec<Panels>,
    #[serde(rename = "schemaVersion")]
    pub schema_version: i64,
    pub style: Option<String>,
    pub tags: Option<Vec<Value>>,
    pub templating: Option<Annotations>,
    pub time: Option<Time>,
    pub timepicker: Option<Timepicker>,
    pub timezone: Option<String>,
    pub title: String,
    pub uid: String,
    pub version: i64,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Dimensions {
    #[serde(rename = "FunctionName")]
    function_name: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct GridPos {
    h: i64,
    w: i64,
    x: i64,
    y: i64,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Legend {
    avg: bool,
    current: bool,
    max: bool,
    min: bool,
    show: bool,
    total: bool,
    values: bool,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct List {
    #[serde(rename = "builtIn")]
    built_in: i64,
    datasource: String,
    enable: bool,
    hide: bool,
    #[serde(rename = "iconColor")]
    icon_color: String,
    name: String,
    #[serde(rename = "type")]
    _type: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Meta {
    #[serde(rename = "type")]
    _type: String,
    #[serde(rename = "canSave")]
    can_save: bool,
    #[serde(rename = "canEdit")]
    can_edit: bool,
    #[serde(rename = "canAdmin")]
    can_admin: bool,
    #[serde(rename = "canStar")]
    can_star: bool,
    slug: String,
    url: String,
    expires: String,
    created: String,
    updated: String,
    #[serde(rename = "updatedBy")]
    updated_by: String,
    #[serde(rename = "createdBy")]
    created_by: String,
    version: i64,
    #[serde(rename = "hasAcl")]
    has_acl: bool,
    #[serde(rename = "isFolder")]
    is_folder: bool,
    #[serde(rename = "folderId")]
    folder_id: i64,
    #[serde(rename = "folderTitle")]
    folder_title: String,
    #[serde(rename = "folderUrl")]
    folder_url: String,
    provisioned: bool,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Panels {
    #[serde(rename = "aliasColors")]
    alias_colors: Option<Value>,
    bars: Option<bool>,
    #[serde(rename = "dashLength")]
    dash_length: Option<i64>,
    dashes: Option<bool>,
    datasource: Option<String>,
    fill: Option<i64>,
    #[serde(rename = "gridPos")]
    grid_pos: Option<GridPos>,
    id: Option<i64>,
    legend: Option<Legend>,
    lines: Option<bool>,
    linewidth: Option<i64>,
    #[serde(rename = "nullPointMode")]
    null_point_mode: Option<String>,
    percentage: Option<bool>,
    pointradius: Option<i64>,
    points: Option<bool>,
    renderer: Option<String>,
    #[serde(rename = "seriesOverrides")]
    series_overrides: Option<Vec<Value>>,
    #[serde(rename = "spaceLength")]
    space_length: Option<i64>,
    stack: Option<bool>,
    #[serde(rename = "steppedLine")]
    stepped_line: Option<bool>,
    targets: Option<Vec<Targets>>,
    thresholds: Option<Vec<Value>>,
    #[serde(rename = "timeFrom")]
    time_from: Option<Value>,
    #[serde(rename = "timeShift")]
    time_shift: Option<Value>,
    title: Option<String>,
    tooltip: Option<Tooltip>,
    #[serde(rename = "type")]
    _type: Option<String>,
    xaxis: Option<Xaxis>,
    yaxes: Option<Vec<Yaxes>>,
    yaxis: Option<Yaxis>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RootInterface {
    pub meta: Option<Meta>,
    pub dashboard: Dashboard,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Targets {
    dimensions: Dimensions,
    #[serde(rename = "highResolution")]
    high_resolution: bool,
    #[serde(rename = "metricName")]
    metric_name: String,
    namespace: String,
    period: String,
    #[serde(rename = "refId")]
    ref_id: String,
    region: String,
    statistics: Vec<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Time {
    from: String,
    to: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Timepicker {
    refresh_intervals: Vec<String>,
    time_options: Vec<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Tooltip {
    shared: bool,
    sort: i64,
    value_type: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Xaxis {
    buckets: Value,
    mode: String,
    name: Value,
    show: bool,
    values: Vec<Value>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Yaxes {
    format: String,
    label: Value,
    #[serde(rename = "logBase")]
    log_base: i64,
    max: Value,
    min: Value,
    show: bool,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Yaxis {
    align: bool,
    #[serde(rename = "alignLevel")]
    align_level: Value,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct MutateDashboardResponse {
    pub id: i64,
    pub slug: String,
    pub status: String,
    pub uid: String,
    pub url: String,
    pub version: i64
}