@scaleway/sdk-iot 2.2.1 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/index.gen.js +2 -4
- package/dist/v1/api.gen.js +431 -597
- package/dist/v1/content.gen.js +3 -7
- package/dist/v1/index.gen.js +36 -34
- package/dist/v1/marshalling.gen.js +301 -459
- package/package.json +4 -4
|
@@ -1,533 +1,375 @@
|
|
|
1
|
+
import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalTimeSeries } from "@scaleway/sdk-client";
|
|
1
2
|
import randomName from "@scaleway/random-name";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return {
|
|
10
|
-
policy: data.policy,
|
|
11
|
-
topics: data.topics
|
|
12
|
-
};
|
|
3
|
+
var unmarshalDeviceMessageFiltersRule = (data) => {
|
|
4
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DeviceMessageFiltersRule' failed as data isn't a dictionary.`);
|
|
5
|
+
return {
|
|
6
|
+
policy: data.policy,
|
|
7
|
+
topics: data.topics
|
|
8
|
+
};
|
|
13
9
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
publish: data.publish ? unmarshalDeviceMessageFiltersRule(data.publish) : void 0,
|
|
22
|
-
subscribe: data.subscribe ? unmarshalDeviceMessageFiltersRule(data.subscribe) : void 0
|
|
23
|
-
};
|
|
10
|
+
var unmarshalDeviceMessageFilters = (data) => {
|
|
11
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DeviceMessageFilters' failed as data isn't a dictionary.`);
|
|
12
|
+
return {
|
|
13
|
+
publish: data.publish ? unmarshalDeviceMessageFiltersRule(data.publish) : void 0,
|
|
14
|
+
subscribe: data.subscribe ? unmarshalDeviceMessageFiltersRule(data.subscribe) : void 0
|
|
15
|
+
};
|
|
24
16
|
};
|
|
25
17
|
const unmarshalDevice = (data) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
region: data.region,
|
|
44
|
-
status: data.status,
|
|
45
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
46
|
-
};
|
|
18
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Device' failed as data isn't a dictionary.`);
|
|
19
|
+
return {
|
|
20
|
+
allowInsecure: data.allow_insecure,
|
|
21
|
+
allowMultipleConnections: data.allow_multiple_connections,
|
|
22
|
+
createdAt: unmarshalDate(data.created_at),
|
|
23
|
+
description: data.description,
|
|
24
|
+
hasCustomCertificate: data.has_custom_certificate,
|
|
25
|
+
hubId: data.hub_id,
|
|
26
|
+
id: data.id,
|
|
27
|
+
isConnected: data.is_connected,
|
|
28
|
+
lastActivityAt: unmarshalDate(data.last_activity_at),
|
|
29
|
+
messageFilters: data.message_filters ? unmarshalDeviceMessageFilters(data.message_filters) : void 0,
|
|
30
|
+
name: data.name,
|
|
31
|
+
region: data.region,
|
|
32
|
+
status: data.status,
|
|
33
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
34
|
+
};
|
|
47
35
|
};
|
|
48
36
|
const unmarshalNetwork = (data) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
region: data.region,
|
|
61
|
-
topicPrefix: data.topic_prefix,
|
|
62
|
-
type: data.type
|
|
63
|
-
};
|
|
37
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Network' failed as data isn't a dictionary.`);
|
|
38
|
+
return {
|
|
39
|
+
createdAt: unmarshalDate(data.created_at),
|
|
40
|
+
endpoint: data.endpoint,
|
|
41
|
+
hubId: data.hub_id,
|
|
42
|
+
id: data.id,
|
|
43
|
+
name: data.name,
|
|
44
|
+
region: data.region,
|
|
45
|
+
topicPrefix: data.topic_prefix,
|
|
46
|
+
type: data.type
|
|
47
|
+
};
|
|
64
48
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
`Unmarshalling the type 'HubTwinsGraphiteConfig' failed as data isn't a dictionary.`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
pushUri: data.push_uri
|
|
73
|
-
};
|
|
49
|
+
var unmarshalHubTwinsGraphiteConfig = (data) => {
|
|
50
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'HubTwinsGraphiteConfig' failed as data isn't a dictionary.`);
|
|
51
|
+
return { pushUri: data.push_uri };
|
|
74
52
|
};
|
|
75
53
|
const unmarshalHub = (data) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
status: data.status,
|
|
98
|
-
twinsGraphiteConfig: data.twins_graphite_config ? unmarshalHubTwinsGraphiteConfig(data.twins_graphite_config) : void 0,
|
|
99
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
100
|
-
};
|
|
54
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Hub' failed as data isn't a dictionary.`);
|
|
55
|
+
return {
|
|
56
|
+
connectedDeviceCount: data.connected_device_count,
|
|
57
|
+
createdAt: unmarshalDate(data.created_at),
|
|
58
|
+
deviceCount: data.device_count,
|
|
59
|
+
disableEvents: data.disable_events,
|
|
60
|
+
enableDeviceAutoProvisioning: data.enable_device_auto_provisioning,
|
|
61
|
+
enabled: data.enabled,
|
|
62
|
+
endpoint: data.endpoint,
|
|
63
|
+
eventsTopicPrefix: data.events_topic_prefix,
|
|
64
|
+
hasCustomCa: data.has_custom_ca,
|
|
65
|
+
id: data.id,
|
|
66
|
+
name: data.name,
|
|
67
|
+
organizationId: data.organization_id,
|
|
68
|
+
productPlan: data.product_plan,
|
|
69
|
+
projectId: data.project_id,
|
|
70
|
+
region: data.region,
|
|
71
|
+
status: data.status,
|
|
72
|
+
twinsGraphiteConfig: data.twins_graphite_config ? unmarshalHubTwinsGraphiteConfig(data.twins_graphite_config) : void 0,
|
|
73
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
74
|
+
};
|
|
101
75
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
crt: data.crt,
|
|
110
|
-
key: data.key
|
|
111
|
-
};
|
|
76
|
+
var unmarshalCertificate = (data) => {
|
|
77
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Certificate' failed as data isn't a dictionary.`);
|
|
78
|
+
return {
|
|
79
|
+
crt: data.crt,
|
|
80
|
+
key: data.key
|
|
81
|
+
};
|
|
112
82
|
};
|
|
113
83
|
const unmarshalCreateDeviceResponse = (data) => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
certificate: data.certificate ? unmarshalCertificate(data.certificate) : void 0,
|
|
121
|
-
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
122
|
-
};
|
|
84
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'CreateDeviceResponse' failed as data isn't a dictionary.`);
|
|
85
|
+
return {
|
|
86
|
+
certificate: data.certificate ? unmarshalCertificate(data.certificate) : void 0,
|
|
87
|
+
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
88
|
+
};
|
|
123
89
|
};
|
|
124
90
|
const unmarshalCreateNetworkResponse = (data) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
network: data.network ? unmarshalNetwork(data.network) : void 0,
|
|
132
|
-
secret: data.secret
|
|
133
|
-
};
|
|
91
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'CreateNetworkResponse' failed as data isn't a dictionary.`);
|
|
92
|
+
return {
|
|
93
|
+
network: data.network ? unmarshalNetwork(data.network) : void 0,
|
|
94
|
+
secret: data.secret
|
|
95
|
+
};
|
|
134
96
|
};
|
|
135
97
|
const unmarshalGetDeviceCertificateResponse = (data) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
certificatePem: data.certificate_pem,
|
|
143
|
-
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
144
|
-
};
|
|
98
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GetDeviceCertificateResponse' failed as data isn't a dictionary.`);
|
|
99
|
+
return {
|
|
100
|
+
certificatePem: data.certificate_pem,
|
|
101
|
+
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
102
|
+
};
|
|
145
103
|
};
|
|
146
104
|
const unmarshalGetDeviceMetricsResponse = (data) => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
`Unmarshalling the type 'GetDeviceMetricsResponse' failed as data isn't a dictionary.`
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
metrics: unmarshalArrayOfObject(data.metrics, unmarshalTimeSeries)
|
|
154
|
-
};
|
|
105
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GetDeviceMetricsResponse' failed as data isn't a dictionary.`);
|
|
106
|
+
return { metrics: unmarshalArrayOfObject(data.metrics, unmarshalTimeSeries) };
|
|
155
107
|
};
|
|
156
108
|
const unmarshalGetHubCAResponse = (data) => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
`Unmarshalling the type 'GetHubCAResponse' failed as data isn't a dictionary.`
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
caCertPem: data.ca_cert_pem
|
|
164
|
-
};
|
|
109
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GetHubCAResponse' failed as data isn't a dictionary.`);
|
|
110
|
+
return { caCertPem: data.ca_cert_pem };
|
|
165
111
|
};
|
|
166
112
|
const unmarshalGetHubMetricsResponse = (data) => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
`Unmarshalling the type 'GetHubMetricsResponse' failed as data isn't a dictionary.`
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
metrics: unmarshalArrayOfObject(data.metrics, unmarshalTimeSeries)
|
|
174
|
-
};
|
|
113
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GetHubMetricsResponse' failed as data isn't a dictionary.`);
|
|
114
|
+
return { metrics: unmarshalArrayOfObject(data.metrics, unmarshalTimeSeries) };
|
|
175
115
|
};
|
|
176
116
|
const unmarshalListDevicesResponse = (data) => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return {
|
|
183
|
-
devices: unmarshalArrayOfObject(data.devices, unmarshalDevice),
|
|
184
|
-
totalCount: data.total_count
|
|
185
|
-
};
|
|
117
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDevicesResponse' failed as data isn't a dictionary.`);
|
|
118
|
+
return {
|
|
119
|
+
devices: unmarshalArrayOfObject(data.devices, unmarshalDevice),
|
|
120
|
+
totalCount: data.total_count
|
|
121
|
+
};
|
|
186
122
|
};
|
|
187
123
|
const unmarshalListHubsResponse = (data) => {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
hubs: unmarshalArrayOfObject(data.hubs, unmarshalHub),
|
|
195
|
-
totalCount: data.total_count
|
|
196
|
-
};
|
|
124
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListHubsResponse' failed as data isn't a dictionary.`);
|
|
125
|
+
return {
|
|
126
|
+
hubs: unmarshalArrayOfObject(data.hubs, unmarshalHub),
|
|
127
|
+
totalCount: data.total_count
|
|
128
|
+
};
|
|
197
129
|
};
|
|
198
130
|
const unmarshalListNetworksResponse = (data) => {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
networks: unmarshalArrayOfObject(data.networks, unmarshalNetwork),
|
|
206
|
-
totalCount: data.total_count
|
|
207
|
-
};
|
|
131
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNetworksResponse' failed as data isn't a dictionary.`);
|
|
132
|
+
return {
|
|
133
|
+
networks: unmarshalArrayOfObject(data.networks, unmarshalNetwork),
|
|
134
|
+
totalCount: data.total_count
|
|
135
|
+
};
|
|
208
136
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
topic: data.topic,
|
|
222
|
-
type: data.type,
|
|
223
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
224
|
-
};
|
|
137
|
+
var unmarshalRouteSummary = (data) => {
|
|
138
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RouteSummary' failed as data isn't a dictionary.`);
|
|
139
|
+
return {
|
|
140
|
+
createdAt: unmarshalDate(data.created_at),
|
|
141
|
+
hubId: data.hub_id,
|
|
142
|
+
id: data.id,
|
|
143
|
+
name: data.name,
|
|
144
|
+
region: data.region,
|
|
145
|
+
topic: data.topic,
|
|
146
|
+
type: data.type,
|
|
147
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
148
|
+
};
|
|
225
149
|
};
|
|
226
150
|
const unmarshalListRoutesResponse = (data) => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return {
|
|
233
|
-
routes: unmarshalArrayOfObject(data.routes, unmarshalRouteSummary),
|
|
234
|
-
totalCount: data.total_count
|
|
235
|
-
};
|
|
151
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListRoutesResponse' failed as data isn't a dictionary.`);
|
|
152
|
+
return {
|
|
153
|
+
routes: unmarshalArrayOfObject(data.routes, unmarshalRouteSummary),
|
|
154
|
+
totalCount: data.total_count
|
|
155
|
+
};
|
|
236
156
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
`Unmarshalling the type 'ListTwinDocumentsResponseDocumentSummary' failed as data isn't a dictionary.`
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
return {
|
|
244
|
-
documentName: data.document_name
|
|
245
|
-
};
|
|
157
|
+
var unmarshalListTwinDocumentsResponseDocumentSummary = (data) => {
|
|
158
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTwinDocumentsResponseDocumentSummary' failed as data isn't a dictionary.`);
|
|
159
|
+
return { documentName: data.document_name };
|
|
246
160
|
};
|
|
247
161
|
const unmarshalListTwinDocumentsResponse = (data) => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
`Unmarshalling the type 'ListTwinDocumentsResponse' failed as data isn't a dictionary.`
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
documents: unmarshalArrayOfObject(data.documents, unmarshalListTwinDocumentsResponseDocumentSummary)
|
|
255
|
-
};
|
|
162
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTwinDocumentsResponse' failed as data isn't a dictionary.`);
|
|
163
|
+
return { documents: unmarshalArrayOfObject(data.documents, unmarshalListTwinDocumentsResponseDocumentSummary) };
|
|
256
164
|
};
|
|
257
165
|
const unmarshalRenewDeviceCertificateResponse = (data) => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return {
|
|
264
|
-
certificate: data.certificate ? unmarshalCertificate(data.certificate) : void 0,
|
|
265
|
-
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
266
|
-
};
|
|
166
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RenewDeviceCertificateResponse' failed as data isn't a dictionary.`);
|
|
167
|
+
return {
|
|
168
|
+
certificate: data.certificate ? unmarshalCertificate(data.certificate) : void 0,
|
|
169
|
+
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
170
|
+
};
|
|
267
171
|
};
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
port: data.port,
|
|
280
|
-
query: data.query,
|
|
281
|
-
username: data.username
|
|
282
|
-
};
|
|
172
|
+
var unmarshalRouteDatabaseConfig = (data) => {
|
|
173
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RouteDatabaseConfig' failed as data isn't a dictionary.`);
|
|
174
|
+
return {
|
|
175
|
+
dbname: data.dbname,
|
|
176
|
+
engine: data.engine,
|
|
177
|
+
host: data.host,
|
|
178
|
+
password: data.password,
|
|
179
|
+
port: data.port,
|
|
180
|
+
query: data.query,
|
|
181
|
+
username: data.username
|
|
182
|
+
};
|
|
283
183
|
};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
headers: data.headers,
|
|
292
|
-
uri: data.uri,
|
|
293
|
-
verb: data.verb
|
|
294
|
-
};
|
|
184
|
+
var unmarshalRouteRestConfig = (data) => {
|
|
185
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`);
|
|
186
|
+
return {
|
|
187
|
+
headers: data.headers,
|
|
188
|
+
uri: data.uri,
|
|
189
|
+
verb: data.verb
|
|
190
|
+
};
|
|
295
191
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
bucketRegion: data.bucket_region,
|
|
305
|
-
objectPrefix: data.object_prefix,
|
|
306
|
-
strategy: data.strategy
|
|
307
|
-
};
|
|
192
|
+
var unmarshalRouteS3Config = (data) => {
|
|
193
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`);
|
|
194
|
+
return {
|
|
195
|
+
bucketName: data.bucket_name,
|
|
196
|
+
bucketRegion: data.bucket_region,
|
|
197
|
+
objectPrefix: data.object_prefix,
|
|
198
|
+
strategy: data.strategy
|
|
199
|
+
};
|
|
308
200
|
};
|
|
309
201
|
const unmarshalRoute = (data) => {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
topic: data.topic,
|
|
325
|
-
type: data.type,
|
|
326
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
327
|
-
};
|
|
202
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Route' failed as data isn't a dictionary.`);
|
|
203
|
+
return {
|
|
204
|
+
createdAt: unmarshalDate(data.created_at),
|
|
205
|
+
dbConfig: data.db_config ? unmarshalRouteDatabaseConfig(data.db_config) : void 0,
|
|
206
|
+
hubId: data.hub_id,
|
|
207
|
+
id: data.id,
|
|
208
|
+
name: data.name,
|
|
209
|
+
region: data.region,
|
|
210
|
+
restConfig: data.rest_config ? unmarshalRouteRestConfig(data.rest_config) : void 0,
|
|
211
|
+
s3Config: data.s3_config ? unmarshalRouteS3Config(data.s3_config) : void 0,
|
|
212
|
+
topic: data.topic,
|
|
213
|
+
type: data.type,
|
|
214
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
215
|
+
};
|
|
328
216
|
};
|
|
329
217
|
const unmarshalSetDeviceCertificateResponse = (data) => {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return {
|
|
336
|
-
certificatePem: data.certificate_pem,
|
|
337
|
-
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
338
|
-
};
|
|
218
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetDeviceCertificateResponse' failed as data isn't a dictionary.`);
|
|
219
|
+
return {
|
|
220
|
+
certificatePem: data.certificate_pem,
|
|
221
|
+
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
222
|
+
};
|
|
339
223
|
};
|
|
340
224
|
const unmarshalTwinDocument = (data) => {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
documentName: data.document_name,
|
|
349
|
-
twinId: data.twin_id,
|
|
350
|
-
version: data.version
|
|
351
|
-
};
|
|
225
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'TwinDocument' failed as data isn't a dictionary.`);
|
|
226
|
+
return {
|
|
227
|
+
data: data.data,
|
|
228
|
+
documentName: data.document_name,
|
|
229
|
+
twinId: data.twin_id,
|
|
230
|
+
version: data.version
|
|
231
|
+
};
|
|
352
232
|
};
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
233
|
+
var marshalDeviceMessageFiltersRule = (request, defaults) => ({
|
|
234
|
+
policy: request.policy,
|
|
235
|
+
topics: request.topics
|
|
356
236
|
});
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
237
|
+
var marshalDeviceMessageFilters = (request, defaults) => ({
|
|
238
|
+
publish: request.publish !== void 0 ? marshalDeviceMessageFiltersRule(request.publish, defaults) : void 0,
|
|
239
|
+
subscribe: request.subscribe !== void 0 ? marshalDeviceMessageFiltersRule(request.subscribe, defaults) : void 0
|
|
360
240
|
});
|
|
361
241
|
const marshalCreateDeviceRequest = (request, defaults) => ({
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
});
|
|
369
|
-
const marshalHubTwinsGraphiteConfig = (request, defaults) => ({
|
|
370
|
-
push_uri: request.pushUri
|
|
242
|
+
allow_insecure: request.allowInsecure,
|
|
243
|
+
allow_multiple_connections: request.allowMultipleConnections,
|
|
244
|
+
description: request.description,
|
|
245
|
+
hub_id: request.hubId,
|
|
246
|
+
message_filters: request.messageFilters !== void 0 ? marshalDeviceMessageFilters(request.messageFilters, defaults) : void 0,
|
|
247
|
+
name: request.name || randomName("device")
|
|
371
248
|
});
|
|
249
|
+
var marshalHubTwinsGraphiteConfig = (request, defaults) => ({ push_uri: request.pushUri });
|
|
372
250
|
const marshalCreateHubRequest = (request, defaults) => ({
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
])
|
|
251
|
+
disable_events: request.disableEvents,
|
|
252
|
+
events_topic_prefix: request.eventsTopicPrefix,
|
|
253
|
+
name: request.name || randomName("hub"),
|
|
254
|
+
product_plan: request.productPlan,
|
|
255
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
256
|
+
...resolveOneOf([{
|
|
257
|
+
param: "twins_graphite_config",
|
|
258
|
+
value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) : void 0
|
|
259
|
+
}])
|
|
384
260
|
});
|
|
385
261
|
const marshalCreateNetworkRequest = (request, defaults) => ({
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
262
|
+
hub_id: request.hubId,
|
|
263
|
+
name: request.name || randomName("network"),
|
|
264
|
+
topic_prefix: request.topicPrefix,
|
|
265
|
+
type: request.type
|
|
390
266
|
});
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
267
|
+
var marshalCreateRouteRequestDatabaseConfig = (request, defaults) => ({
|
|
268
|
+
dbname: request.dbname,
|
|
269
|
+
engine: request.engine,
|
|
270
|
+
host: request.host,
|
|
271
|
+
password: request.password,
|
|
272
|
+
port: request.port,
|
|
273
|
+
query: request.query,
|
|
274
|
+
username: request.username
|
|
399
275
|
});
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
276
|
+
var marshalCreateRouteRequestRestConfig = (request, defaults) => ({
|
|
277
|
+
headers: request.headers,
|
|
278
|
+
uri: request.uri,
|
|
279
|
+
verb: request.verb
|
|
404
280
|
});
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
281
|
+
var marshalCreateRouteRequestS3Config = (request, defaults) => ({
|
|
282
|
+
bucket_name: request.bucketName,
|
|
283
|
+
bucket_region: request.bucketRegion,
|
|
284
|
+
object_prefix: request.objectPrefix,
|
|
285
|
+
strategy: request.strategy
|
|
410
286
|
});
|
|
411
287
|
const marshalCreateRouteRequest = (request, defaults) => ({
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
288
|
+
hub_id: request.hubId,
|
|
289
|
+
name: request.name || randomName("route"),
|
|
290
|
+
topic: request.topic,
|
|
291
|
+
...resolveOneOf([
|
|
292
|
+
{
|
|
293
|
+
param: "s3_config",
|
|
294
|
+
value: request.s3Config !== void 0 ? marshalCreateRouteRequestS3Config(request.s3Config, defaults) : void 0
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
param: "db_config",
|
|
298
|
+
value: request.dbConfig !== void 0 ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig, defaults) : void 0
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
param: "rest_config",
|
|
302
|
+
value: request.restConfig !== void 0 ? marshalCreateRouteRequestRestConfig(request.restConfig, defaults) : void 0
|
|
303
|
+
}
|
|
304
|
+
])
|
|
429
305
|
});
|
|
430
306
|
const marshalPatchTwinDocumentRequest = (request, defaults) => ({
|
|
431
|
-
|
|
432
|
-
|
|
307
|
+
data: request.data,
|
|
308
|
+
version: request.version
|
|
433
309
|
});
|
|
434
310
|
const marshalPutTwinDocumentRequest = (request, defaults) => ({
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
});
|
|
438
|
-
const marshalSetDeviceCertificateRequest = (request, defaults) => ({
|
|
439
|
-
certificate_pem: request.certificatePem
|
|
311
|
+
data: request.data,
|
|
312
|
+
version: request.version
|
|
440
313
|
});
|
|
314
|
+
const marshalSetDeviceCertificateRequest = (request, defaults) => ({ certificate_pem: request.certificatePem });
|
|
441
315
|
const marshalSetHubCARequest = (request, defaults) => ({
|
|
442
|
-
|
|
443
|
-
|
|
316
|
+
ca_cert_pem: request.caCertPem,
|
|
317
|
+
challenge_cert_pem: request.challengeCertPem
|
|
444
318
|
});
|
|
445
319
|
const marshalUpdateDeviceRequest = (request, defaults) => ({
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
320
|
+
allow_insecure: request.allowInsecure,
|
|
321
|
+
allow_multiple_connections: request.allowMultipleConnections,
|
|
322
|
+
description: request.description,
|
|
323
|
+
hub_id: request.hubId,
|
|
324
|
+
message_filters: request.messageFilters !== void 0 ? marshalDeviceMessageFilters(request.messageFilters, defaults) : void 0
|
|
451
325
|
});
|
|
452
326
|
const marshalUpdateHubRequest = (request, defaults) => ({
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
])
|
|
327
|
+
disable_events: request.disableEvents,
|
|
328
|
+
enable_device_auto_provisioning: request.enableDeviceAutoProvisioning,
|
|
329
|
+
events_topic_prefix: request.eventsTopicPrefix,
|
|
330
|
+
name: request.name,
|
|
331
|
+
product_plan: request.productPlan,
|
|
332
|
+
...resolveOneOf([{
|
|
333
|
+
param: "twins_graphite_config",
|
|
334
|
+
value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) : void 0
|
|
335
|
+
}])
|
|
464
336
|
});
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
337
|
+
var marshalUpdateRouteRequestDatabaseConfig = (request, defaults) => ({
|
|
338
|
+
dbname: request.dbname,
|
|
339
|
+
engine: request.engine,
|
|
340
|
+
host: request.host,
|
|
341
|
+
password: request.password,
|
|
342
|
+
port: request.port,
|
|
343
|
+
query: request.query,
|
|
344
|
+
username: request.username
|
|
473
345
|
});
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
346
|
+
var marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
|
|
347
|
+
headers: request.headers,
|
|
348
|
+
uri: request.uri,
|
|
349
|
+
verb: request.verb
|
|
478
350
|
});
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
351
|
+
var marshalUpdateRouteRequestS3Config = (request, defaults) => ({
|
|
352
|
+
bucket_name: request.bucketName,
|
|
353
|
+
bucket_region: request.bucketRegion,
|
|
354
|
+
object_prefix: request.objectPrefix,
|
|
355
|
+
strategy: request.strategy
|
|
484
356
|
});
|
|
485
357
|
const marshalUpdateRouteRequest = (request, defaults) => ({
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
358
|
+
name: request.name,
|
|
359
|
+
topic: request.topic,
|
|
360
|
+
...resolveOneOf([
|
|
361
|
+
{
|
|
362
|
+
param: "s3_config",
|
|
363
|
+
value: request.s3Config !== void 0 ? marshalUpdateRouteRequestS3Config(request.s3Config, defaults) : void 0
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
param: "db_config",
|
|
367
|
+
value: request.dbConfig !== void 0 ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig, defaults) : void 0
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
param: "rest_config",
|
|
371
|
+
value: request.restConfig !== void 0 ? marshalUpdateRouteRequestRestConfig(request.restConfig, defaults) : void 0
|
|
372
|
+
}
|
|
373
|
+
])
|
|
502
374
|
});
|
|
503
|
-
export {
|
|
504
|
-
marshalCreateDeviceRequest,
|
|
505
|
-
marshalCreateHubRequest,
|
|
506
|
-
marshalCreateNetworkRequest,
|
|
507
|
-
marshalCreateRouteRequest,
|
|
508
|
-
marshalPatchTwinDocumentRequest,
|
|
509
|
-
marshalPutTwinDocumentRequest,
|
|
510
|
-
marshalSetDeviceCertificateRequest,
|
|
511
|
-
marshalSetHubCARequest,
|
|
512
|
-
marshalUpdateDeviceRequest,
|
|
513
|
-
marshalUpdateHubRequest,
|
|
514
|
-
marshalUpdateRouteRequest,
|
|
515
|
-
unmarshalCreateDeviceResponse,
|
|
516
|
-
unmarshalCreateNetworkResponse,
|
|
517
|
-
unmarshalDevice,
|
|
518
|
-
unmarshalGetDeviceCertificateResponse,
|
|
519
|
-
unmarshalGetDeviceMetricsResponse,
|
|
520
|
-
unmarshalGetHubCAResponse,
|
|
521
|
-
unmarshalGetHubMetricsResponse,
|
|
522
|
-
unmarshalHub,
|
|
523
|
-
unmarshalListDevicesResponse,
|
|
524
|
-
unmarshalListHubsResponse,
|
|
525
|
-
unmarshalListNetworksResponse,
|
|
526
|
-
unmarshalListRoutesResponse,
|
|
527
|
-
unmarshalListTwinDocumentsResponse,
|
|
528
|
-
unmarshalNetwork,
|
|
529
|
-
unmarshalRenewDeviceCertificateResponse,
|
|
530
|
-
unmarshalRoute,
|
|
531
|
-
unmarshalSetDeviceCertificateResponse,
|
|
532
|
-
unmarshalTwinDocument
|
|
533
|
-
};
|
|
375
|
+
export { marshalCreateDeviceRequest, marshalCreateHubRequest, marshalCreateNetworkRequest, marshalCreateRouteRequest, marshalPatchTwinDocumentRequest, marshalPutTwinDocumentRequest, marshalSetDeviceCertificateRequest, marshalSetHubCARequest, marshalUpdateDeviceRequest, marshalUpdateHubRequest, marshalUpdateRouteRequest, unmarshalCreateDeviceResponse, unmarshalCreateNetworkResponse, unmarshalDevice, unmarshalGetDeviceCertificateResponse, unmarshalGetDeviceMetricsResponse, unmarshalGetHubCAResponse, unmarshalGetHubMetricsResponse, unmarshalHub, unmarshalListDevicesResponse, unmarshalListHubsResponse, unmarshalListNetworksResponse, unmarshalListRoutesResponse, unmarshalListTwinDocumentsResponse, unmarshalNetwork, unmarshalRenewDeviceCertificateResponse, unmarshalRoute, unmarshalSetDeviceCertificateResponse, unmarshalTwinDocument };
|