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