-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_notebook_cell_response_attributes.go
234 lines (203 loc) · 9.43 KB
/
model_notebook_cell_response_attributes.go
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
229
230
231
232
233
234
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.
package datadogV1
import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// NotebookCellResponseAttributes - The attributes of a notebook cell response. Valid cell types are `markdown`, `timeseries`, `toplist`, `heatmap`, `distribution`,
// `log_stream`. [More information on each graph visualization type.](https://docs.datadoghq.com/dashboards/widgets/)
type NotebookCellResponseAttributes struct {
NotebookMarkdownCellAttributes *NotebookMarkdownCellAttributes
NotebookTimeseriesCellAttributes *NotebookTimeseriesCellAttributes
NotebookToplistCellAttributes *NotebookToplistCellAttributes
NotebookHeatMapCellAttributes *NotebookHeatMapCellAttributes
NotebookDistributionCellAttributes *NotebookDistributionCellAttributes
NotebookLogStreamCellAttributes *NotebookLogStreamCellAttributes
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject interface{}
}
// NotebookMarkdownCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookMarkdownCellAttributes wrapped in NotebookCellResponseAttributes.
func NotebookMarkdownCellAttributesAsNotebookCellResponseAttributes(v *NotebookMarkdownCellAttributes) NotebookCellResponseAttributes {
return NotebookCellResponseAttributes{NotebookMarkdownCellAttributes: v}
}
// NotebookTimeseriesCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookTimeseriesCellAttributes wrapped in NotebookCellResponseAttributes.
func NotebookTimeseriesCellAttributesAsNotebookCellResponseAttributes(v *NotebookTimeseriesCellAttributes) NotebookCellResponseAttributes {
return NotebookCellResponseAttributes{NotebookTimeseriesCellAttributes: v}
}
// NotebookToplistCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookToplistCellAttributes wrapped in NotebookCellResponseAttributes.
func NotebookToplistCellAttributesAsNotebookCellResponseAttributes(v *NotebookToplistCellAttributes) NotebookCellResponseAttributes {
return NotebookCellResponseAttributes{NotebookToplistCellAttributes: v}
}
// NotebookHeatMapCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookHeatMapCellAttributes wrapped in NotebookCellResponseAttributes.
func NotebookHeatMapCellAttributesAsNotebookCellResponseAttributes(v *NotebookHeatMapCellAttributes) NotebookCellResponseAttributes {
return NotebookCellResponseAttributes{NotebookHeatMapCellAttributes: v}
}
// NotebookDistributionCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookDistributionCellAttributes wrapped in NotebookCellResponseAttributes.
func NotebookDistributionCellAttributesAsNotebookCellResponseAttributes(v *NotebookDistributionCellAttributes) NotebookCellResponseAttributes {
return NotebookCellResponseAttributes{NotebookDistributionCellAttributes: v}
}
// NotebookLogStreamCellAttributesAsNotebookCellResponseAttributes is a convenience function that returns NotebookLogStreamCellAttributes wrapped in NotebookCellResponseAttributes.
func NotebookLogStreamCellAttributesAsNotebookCellResponseAttributes(v *NotebookLogStreamCellAttributes) NotebookCellResponseAttributes {
return NotebookCellResponseAttributes{NotebookLogStreamCellAttributes: v}
}
// UnmarshalJSON turns data into one of the pointers in the struct.
func (obj *NotebookCellResponseAttributes) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into NotebookMarkdownCellAttributes
err = datadog.Unmarshal(data, &obj.NotebookMarkdownCellAttributes)
if err == nil {
if obj.NotebookMarkdownCellAttributes != nil && obj.NotebookMarkdownCellAttributes.UnparsedObject == nil {
jsonNotebookMarkdownCellAttributes, _ := datadog.Marshal(obj.NotebookMarkdownCellAttributes)
if string(jsonNotebookMarkdownCellAttributes) == "{}" { // empty struct
obj.NotebookMarkdownCellAttributes = nil
} else {
match++
}
} else {
obj.NotebookMarkdownCellAttributes = nil
}
} else {
obj.NotebookMarkdownCellAttributes = nil
}
// try to unmarshal data into NotebookTimeseriesCellAttributes
err = datadog.Unmarshal(data, &obj.NotebookTimeseriesCellAttributes)
if err == nil {
if obj.NotebookTimeseriesCellAttributes != nil && obj.NotebookTimeseriesCellAttributes.UnparsedObject == nil {
jsonNotebookTimeseriesCellAttributes, _ := datadog.Marshal(obj.NotebookTimeseriesCellAttributes)
if string(jsonNotebookTimeseriesCellAttributes) == "{}" { // empty struct
obj.NotebookTimeseriesCellAttributes = nil
} else {
match++
}
} else {
obj.NotebookTimeseriesCellAttributes = nil
}
} else {
obj.NotebookTimeseriesCellAttributes = nil
}
// try to unmarshal data into NotebookToplistCellAttributes
err = datadog.Unmarshal(data, &obj.NotebookToplistCellAttributes)
if err == nil {
if obj.NotebookToplistCellAttributes != nil && obj.NotebookToplistCellAttributes.UnparsedObject == nil {
jsonNotebookToplistCellAttributes, _ := datadog.Marshal(obj.NotebookToplistCellAttributes)
if string(jsonNotebookToplistCellAttributes) == "{}" { // empty struct
obj.NotebookToplistCellAttributes = nil
} else {
match++
}
} else {
obj.NotebookToplistCellAttributes = nil
}
} else {
obj.NotebookToplistCellAttributes = nil
}
// try to unmarshal data into NotebookHeatMapCellAttributes
err = datadog.Unmarshal(data, &obj.NotebookHeatMapCellAttributes)
if err == nil {
if obj.NotebookHeatMapCellAttributes != nil && obj.NotebookHeatMapCellAttributes.UnparsedObject == nil {
jsonNotebookHeatMapCellAttributes, _ := datadog.Marshal(obj.NotebookHeatMapCellAttributes)
if string(jsonNotebookHeatMapCellAttributes) == "{}" { // empty struct
obj.NotebookHeatMapCellAttributes = nil
} else {
match++
}
} else {
obj.NotebookHeatMapCellAttributes = nil
}
} else {
obj.NotebookHeatMapCellAttributes = nil
}
// try to unmarshal data into NotebookDistributionCellAttributes
err = datadog.Unmarshal(data, &obj.NotebookDistributionCellAttributes)
if err == nil {
if obj.NotebookDistributionCellAttributes != nil && obj.NotebookDistributionCellAttributes.UnparsedObject == nil {
jsonNotebookDistributionCellAttributes, _ := datadog.Marshal(obj.NotebookDistributionCellAttributes)
if string(jsonNotebookDistributionCellAttributes) == "{}" { // empty struct
obj.NotebookDistributionCellAttributes = nil
} else {
match++
}
} else {
obj.NotebookDistributionCellAttributes = nil
}
} else {
obj.NotebookDistributionCellAttributes = nil
}
// try to unmarshal data into NotebookLogStreamCellAttributes
err = datadog.Unmarshal(data, &obj.NotebookLogStreamCellAttributes)
if err == nil {
if obj.NotebookLogStreamCellAttributes != nil && obj.NotebookLogStreamCellAttributes.UnparsedObject == nil {
jsonNotebookLogStreamCellAttributes, _ := datadog.Marshal(obj.NotebookLogStreamCellAttributes)
if string(jsonNotebookLogStreamCellAttributes) == "{}" { // empty struct
obj.NotebookLogStreamCellAttributes = nil
} else {
match++
}
} else {
obj.NotebookLogStreamCellAttributes = nil
}
} else {
obj.NotebookLogStreamCellAttributes = nil
}
if match != 1 { // more than 1 match
// reset to nil
obj.NotebookMarkdownCellAttributes = nil
obj.NotebookTimeseriesCellAttributes = nil
obj.NotebookToplistCellAttributes = nil
obj.NotebookHeatMapCellAttributes = nil
obj.NotebookDistributionCellAttributes = nil
obj.NotebookLogStreamCellAttributes = nil
return datadog.Unmarshal(data, &obj.UnparsedObject)
}
return nil // exactly one match
}
// MarshalJSON turns data from the first non-nil pointers in the struct to JSON.
func (obj NotebookCellResponseAttributes) MarshalJSON() ([]byte, error) {
if obj.NotebookMarkdownCellAttributes != nil {
return datadog.Marshal(&obj.NotebookMarkdownCellAttributes)
}
if obj.NotebookTimeseriesCellAttributes != nil {
return datadog.Marshal(&obj.NotebookTimeseriesCellAttributes)
}
if obj.NotebookToplistCellAttributes != nil {
return datadog.Marshal(&obj.NotebookToplistCellAttributes)
}
if obj.NotebookHeatMapCellAttributes != nil {
return datadog.Marshal(&obj.NotebookHeatMapCellAttributes)
}
if obj.NotebookDistributionCellAttributes != nil {
return datadog.Marshal(&obj.NotebookDistributionCellAttributes)
}
if obj.NotebookLogStreamCellAttributes != nil {
return datadog.Marshal(&obj.NotebookLogStreamCellAttributes)
}
if obj.UnparsedObject != nil {
return datadog.Marshal(obj.UnparsedObject)
}
return nil, nil // no data in oneOf schemas
}
// GetActualInstance returns the actual instance.
func (obj *NotebookCellResponseAttributes) GetActualInstance() interface{} {
if obj.NotebookMarkdownCellAttributes != nil {
return obj.NotebookMarkdownCellAttributes
}
if obj.NotebookTimeseriesCellAttributes != nil {
return obj.NotebookTimeseriesCellAttributes
}
if obj.NotebookToplistCellAttributes != nil {
return obj.NotebookToplistCellAttributes
}
if obj.NotebookHeatMapCellAttributes != nil {
return obj.NotebookHeatMapCellAttributes
}
if obj.NotebookDistributionCellAttributes != nil {
return obj.NotebookDistributionCellAttributes
}
if obj.NotebookLogStreamCellAttributes != nil {
return obj.NotebookLogStreamCellAttributes
}
// all schemas are nil
return nil
}