-
Notifications
You must be signed in to change notification settings - Fork 302
/
identifiers_json.pb.go
351 lines (333 loc) · 10.5 KB
/
identifiers_json.pb.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
// Code generated by protoc-gen-go-json. DO NOT EDIT.
// versions:
// - protoc-gen-go-json v1.4.0
// - protoc v3.9.1
// source: lorawan-stack/api/identifiers.proto
package ttnpb
import (
gogo "github.com/TheThingsIndustries/protoc-gen-go-json/gogo"
jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
types "go.thethings.network/lorawan-stack/v3/pkg/types"
)
// MarshalProtoJSON marshals the EndDeviceIdentifiers message to JSON.
func (x *EndDeviceIdentifiers) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.DeviceId != "" || s.HasField("device_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("device_id")
s.WriteString(x.DeviceId)
}
if x.ApplicationIds != nil || s.HasField("application_ids") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("application_ids")
// NOTE: ApplicationIdentifiers does not seem to implement MarshalProtoJSON.
gogo.MarshalMessage(s, x.ApplicationIds)
}
if len(x.DevEui) > 0 || s.HasField("dev_eui") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("dev_eui")
types.MarshalHEXBytes(s.WithField("dev_eui"), x.DevEui)
}
if len(x.JoinEui) > 0 || s.HasField("join_eui") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("join_eui")
types.MarshalHEXBytes(s.WithField("join_eui"), x.JoinEui)
}
if len(x.DevAddr) > 0 || s.HasField("dev_addr") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("dev_addr")
types.MarshalHEXBytes(s.WithField("dev_addr"), x.DevAddr)
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the EndDeviceIdentifiers to JSON.
func (x *EndDeviceIdentifiers) MarshalJSON() ([]byte, error) {
return jsonplugin.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the EndDeviceIdentifiers message from JSON.
func (x *EndDeviceIdentifiers) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "device_id", "deviceId":
s.AddField("device_id")
x.DeviceId = s.ReadString()
case "application_ids", "applicationIds":
s.AddField("application_ids")
if s.ReadNil() {
x.ApplicationIds = nil
return
}
// NOTE: ApplicationIdentifiers does not seem to implement UnmarshalProtoJSON.
var v ApplicationIdentifiers
gogo.UnmarshalMessage(s, &v)
x.ApplicationIds = &v
case "dev_eui", "devEui":
s.AddField("dev_eui")
x.DevEui = types.Unmarshal8Bytes(s.WithField("dev_eui", false))
case "join_eui", "joinEui":
s.AddField("join_eui")
x.JoinEui = types.Unmarshal8Bytes(s.WithField("join_eui", false))
case "dev_addr", "devAddr":
s.AddField("dev_addr")
x.DevAddr = types.Unmarshal4Bytes(s.WithField("dev_addr", false))
}
})
}
// UnmarshalJSON unmarshals the EndDeviceIdentifiers from JSON.
func (x *EndDeviceIdentifiers) UnmarshalJSON(b []byte) error {
return jsonplugin.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
// MarshalProtoJSON marshals the GatewayIdentifiers message to JSON.
func (x *GatewayIdentifiers) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.GatewayId != "" || s.HasField("gateway_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("gateway_id")
s.WriteString(x.GatewayId)
}
if len(x.Eui) > 0 || s.HasField("eui") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("eui")
types.MarshalHEXBytes(s.WithField("eui"), x.Eui)
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the GatewayIdentifiers to JSON.
func (x *GatewayIdentifiers) MarshalJSON() ([]byte, error) {
return jsonplugin.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the GatewayIdentifiers message from JSON.
func (x *GatewayIdentifiers) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "gateway_id", "gatewayId":
s.AddField("gateway_id")
x.GatewayId = s.ReadString()
case "eui":
s.AddField("eui")
x.Eui = types.Unmarshal8Bytes(s.WithField("eui", false))
}
})
}
// UnmarshalJSON unmarshals the GatewayIdentifiers from JSON.
func (x *GatewayIdentifiers) UnmarshalJSON(b []byte) error {
return jsonplugin.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
// MarshalProtoJSON marshals the EntityIdentifiers message to JSON.
func (x *EntityIdentifiers) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.Ids != nil {
switch ov := x.Ids.(type) {
case *EntityIdentifiers_ApplicationIds:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("application_ids")
// NOTE: ApplicationIdentifiers does not seem to implement MarshalProtoJSON.
gogo.MarshalMessage(s, ov.ApplicationIds)
case *EntityIdentifiers_ClientIds:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("client_ids")
// NOTE: ClientIdentifiers does not seem to implement MarshalProtoJSON.
gogo.MarshalMessage(s, ov.ClientIds)
case *EntityIdentifiers_DeviceIds:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("device_ids")
ov.DeviceIds.MarshalProtoJSON(s.WithField("device_ids"))
case *EntityIdentifiers_GatewayIds:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("gateway_ids")
ov.GatewayIds.MarshalProtoJSON(s.WithField("gateway_ids"))
case *EntityIdentifiers_OrganizationIds:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("organization_ids")
// NOTE: OrganizationIdentifiers does not seem to implement MarshalProtoJSON.
gogo.MarshalMessage(s, ov.OrganizationIds)
case *EntityIdentifiers_UserIds:
s.WriteMoreIf(&wroteField)
s.WriteObjectField("user_ids")
// NOTE: UserIdentifiers does not seem to implement MarshalProtoJSON.
gogo.MarshalMessage(s, ov.UserIds)
}
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the EntityIdentifiers to JSON.
func (x *EntityIdentifiers) MarshalJSON() ([]byte, error) {
return jsonplugin.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the EntityIdentifiers message from JSON.
func (x *EntityIdentifiers) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "application_ids", "applicationIds":
s.AddField("application_ids")
ov := &EntityIdentifiers_ApplicationIds{}
x.Ids = ov
if s.ReadNil() {
ov.ApplicationIds = nil
return
}
// NOTE: ApplicationIdentifiers does not seem to implement UnmarshalProtoJSON.
var v ApplicationIdentifiers
gogo.UnmarshalMessage(s, &v)
ov.ApplicationIds = &v
case "client_ids", "clientIds":
s.AddField("client_ids")
ov := &EntityIdentifiers_ClientIds{}
x.Ids = ov
if s.ReadNil() {
ov.ClientIds = nil
return
}
// NOTE: ClientIdentifiers does not seem to implement UnmarshalProtoJSON.
var v ClientIdentifiers
gogo.UnmarshalMessage(s, &v)
ov.ClientIds = &v
case "device_ids", "deviceIds":
ov := &EntityIdentifiers_DeviceIds{}
x.Ids = ov
if s.ReadNil() {
ov.DeviceIds = nil
return
}
ov.DeviceIds = &EndDeviceIdentifiers{}
ov.DeviceIds.UnmarshalProtoJSON(s.WithField("device_ids", true))
case "gateway_ids", "gatewayIds":
ov := &EntityIdentifiers_GatewayIds{}
x.Ids = ov
if s.ReadNil() {
ov.GatewayIds = nil
return
}
ov.GatewayIds = &GatewayIdentifiers{}
ov.GatewayIds.UnmarshalProtoJSON(s.WithField("gateway_ids", true))
case "organization_ids", "organizationIds":
s.AddField("organization_ids")
ov := &EntityIdentifiers_OrganizationIds{}
x.Ids = ov
if s.ReadNil() {
ov.OrganizationIds = nil
return
}
// NOTE: OrganizationIdentifiers does not seem to implement UnmarshalProtoJSON.
var v OrganizationIdentifiers
gogo.UnmarshalMessage(s, &v)
ov.OrganizationIds = &v
case "user_ids", "userIds":
s.AddField("user_ids")
ov := &EntityIdentifiers_UserIds{}
x.Ids = ov
if s.ReadNil() {
ov.UserIds = nil
return
}
// NOTE: UserIdentifiers does not seem to implement UnmarshalProtoJSON.
var v UserIdentifiers
gogo.UnmarshalMessage(s, &v)
ov.UserIds = &v
}
})
}
// UnmarshalJSON unmarshals the EntityIdentifiers from JSON.
func (x *EntityIdentifiers) UnmarshalJSON(b []byte) error {
return jsonplugin.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
// MarshalProtoJSON marshals the NetworkIdentifiers message to JSON.
func (x *NetworkIdentifiers) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if len(x.NetId) > 0 || s.HasField("net_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("net_id")
types.MarshalHEXBytes(s.WithField("net_id"), x.NetId)
}
if x.TenantId != "" || s.HasField("tenant_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("tenant_id")
s.WriteString(x.TenantId)
}
if x.ClusterId != "" || s.HasField("cluster_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("cluster_id")
s.WriteString(x.ClusterId)
}
if x.ClusterAddress != "" || s.HasField("cluster_address") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("cluster_address")
s.WriteString(x.ClusterAddress)
}
if x.TenantAddress != "" || s.HasField("tenant_address") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("tenant_address")
s.WriteString(x.TenantAddress)
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the NetworkIdentifiers to JSON.
func (x *NetworkIdentifiers) MarshalJSON() ([]byte, error) {
return jsonplugin.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the NetworkIdentifiers message from JSON.
func (x *NetworkIdentifiers) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "net_id", "netId":
s.AddField("net_id")
x.NetId = types.Unmarshal3Bytes(s.WithField("net_id", false))
case "tenant_id", "tenantId":
s.AddField("tenant_id")
x.TenantId = s.ReadString()
case "cluster_id", "clusterId":
s.AddField("cluster_id")
x.ClusterId = s.ReadString()
case "cluster_address", "clusterAddress":
s.AddField("cluster_address")
x.ClusterAddress = s.ReadString()
case "tenant_address", "tenantAddress":
s.AddField("tenant_address")
x.TenantAddress = s.ReadString()
}
})
}
// UnmarshalJSON unmarshals the NetworkIdentifiers from JSON.
func (x *NetworkIdentifiers) UnmarshalJSON(b []byte) error {
return jsonplugin.DefaultUnmarshalerConfig.Unmarshal(b, x)
}