@scaleway/sdk-iot 2.2.0 → 2.3.0
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 -589
- package/dist/v1/content.gen.js +2 -3
- package/dist/v1/index.gen.d.ts +1 -1
- package/dist/v1/index.gen.js +36 -34
- package/dist/v1/marshalling.gen.js +301 -462
- package/package.json +4 -4
|
@@ -1,536 +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(
|
|
255
|
-
data.documents,
|
|
256
|
-
unmarshalListTwinDocumentsResponseDocumentSummary
|
|
257
|
-
)
|
|
258
|
-
};
|
|
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) };
|
|
259
164
|
};
|
|
260
165
|
const unmarshalRenewDeviceCertificateResponse = (data) => {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return {
|
|
267
|
-
certificate: data.certificate ? unmarshalCertificate(data.certificate) : void 0,
|
|
268
|
-
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
269
|
-
};
|
|
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
|
+
};
|
|
270
171
|
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
port: data.port,
|
|
283
|
-
query: data.query,
|
|
284
|
-
username: data.username
|
|
285
|
-
};
|
|
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
|
+
};
|
|
286
183
|
};
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
headers: data.headers,
|
|
295
|
-
uri: data.uri,
|
|
296
|
-
verb: data.verb
|
|
297
|
-
};
|
|
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
|
+
};
|
|
298
191
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
bucketRegion: data.bucket_region,
|
|
308
|
-
objectPrefix: data.object_prefix,
|
|
309
|
-
strategy: data.strategy
|
|
310
|
-
};
|
|
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
|
+
};
|
|
311
200
|
};
|
|
312
201
|
const unmarshalRoute = (data) => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
topic: data.topic,
|
|
328
|
-
type: data.type,
|
|
329
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
330
|
-
};
|
|
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
|
+
};
|
|
331
216
|
};
|
|
332
217
|
const unmarshalSetDeviceCertificateResponse = (data) => {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
return {
|
|
339
|
-
certificatePem: data.certificate_pem,
|
|
340
|
-
device: data.device ? unmarshalDevice(data.device) : void 0
|
|
341
|
-
};
|
|
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
|
+
};
|
|
342
223
|
};
|
|
343
224
|
const unmarshalTwinDocument = (data) => {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
documentName: data.document_name,
|
|
352
|
-
twinId: data.twin_id,
|
|
353
|
-
version: data.version
|
|
354
|
-
};
|
|
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
|
+
};
|
|
355
232
|
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
233
|
+
var marshalDeviceMessageFiltersRule = (request, defaults) => ({
|
|
234
|
+
policy: request.policy,
|
|
235
|
+
topics: request.topics
|
|
359
236
|
});
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
|
363
240
|
});
|
|
364
241
|
const marshalCreateDeviceRequest = (request, defaults) => ({
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
});
|
|
372
|
-
const marshalHubTwinsGraphiteConfig = (request, defaults) => ({
|
|
373
|
-
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")
|
|
374
248
|
});
|
|
249
|
+
var marshalHubTwinsGraphiteConfig = (request, defaults) => ({ push_uri: request.pushUri });
|
|
375
250
|
const marshalCreateHubRequest = (request, defaults) => ({
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
386
|
-
])
|
|
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
|
+
}])
|
|
387
260
|
});
|
|
388
261
|
const marshalCreateNetworkRequest = (request, defaults) => ({
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
262
|
+
hub_id: request.hubId,
|
|
263
|
+
name: request.name || randomName("network"),
|
|
264
|
+
topic_prefix: request.topicPrefix,
|
|
265
|
+
type: request.type
|
|
393
266
|
});
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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
|
|
402
275
|
});
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
276
|
+
var marshalCreateRouteRequestRestConfig = (request, defaults) => ({
|
|
277
|
+
headers: request.headers,
|
|
278
|
+
uri: request.uri,
|
|
279
|
+
verb: request.verb
|
|
407
280
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
281
|
+
var marshalCreateRouteRequestS3Config = (request, defaults) => ({
|
|
282
|
+
bucket_name: request.bucketName,
|
|
283
|
+
bucket_region: request.bucketRegion,
|
|
284
|
+
object_prefix: request.objectPrefix,
|
|
285
|
+
strategy: request.strategy
|
|
413
286
|
});
|
|
414
287
|
const marshalCreateRouteRequest = (request, defaults) => ({
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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
|
+
])
|
|
432
305
|
});
|
|
433
306
|
const marshalPatchTwinDocumentRequest = (request, defaults) => ({
|
|
434
|
-
|
|
435
|
-
|
|
307
|
+
data: request.data,
|
|
308
|
+
version: request.version
|
|
436
309
|
});
|
|
437
310
|
const marshalPutTwinDocumentRequest = (request, defaults) => ({
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
});
|
|
441
|
-
const marshalSetDeviceCertificateRequest = (request, defaults) => ({
|
|
442
|
-
certificate_pem: request.certificatePem
|
|
311
|
+
data: request.data,
|
|
312
|
+
version: request.version
|
|
443
313
|
});
|
|
314
|
+
const marshalSetDeviceCertificateRequest = (request, defaults) => ({ certificate_pem: request.certificatePem });
|
|
444
315
|
const marshalSetHubCARequest = (request, defaults) => ({
|
|
445
|
-
|
|
446
|
-
|
|
316
|
+
ca_cert_pem: request.caCertPem,
|
|
317
|
+
challenge_cert_pem: request.challengeCertPem
|
|
447
318
|
});
|
|
448
319
|
const marshalUpdateDeviceRequest = (request, defaults) => ({
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
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
|
|
454
325
|
});
|
|
455
326
|
const marshalUpdateHubRequest = (request, defaults) => ({
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
])
|
|
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
|
+
}])
|
|
467
336
|
});
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
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
|
|
476
345
|
});
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
346
|
+
var marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
|
|
347
|
+
headers: request.headers,
|
|
348
|
+
uri: request.uri,
|
|
349
|
+
verb: request.verb
|
|
481
350
|
});
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
351
|
+
var marshalUpdateRouteRequestS3Config = (request, defaults) => ({
|
|
352
|
+
bucket_name: request.bucketName,
|
|
353
|
+
bucket_region: request.bucketRegion,
|
|
354
|
+
object_prefix: request.objectPrefix,
|
|
355
|
+
strategy: request.strategy
|
|
487
356
|
});
|
|
488
357
|
const marshalUpdateRouteRequest = (request, defaults) => ({
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
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
|
+
])
|
|
505
374
|
});
|
|
506
|
-
export {
|
|
507
|
-
marshalCreateDeviceRequest,
|
|
508
|
-
marshalCreateHubRequest,
|
|
509
|
-
marshalCreateNetworkRequest,
|
|
510
|
-
marshalCreateRouteRequest,
|
|
511
|
-
marshalPatchTwinDocumentRequest,
|
|
512
|
-
marshalPutTwinDocumentRequest,
|
|
513
|
-
marshalSetDeviceCertificateRequest,
|
|
514
|
-
marshalSetHubCARequest,
|
|
515
|
-
marshalUpdateDeviceRequest,
|
|
516
|
-
marshalUpdateHubRequest,
|
|
517
|
-
marshalUpdateRouteRequest,
|
|
518
|
-
unmarshalCreateDeviceResponse,
|
|
519
|
-
unmarshalCreateNetworkResponse,
|
|
520
|
-
unmarshalDevice,
|
|
521
|
-
unmarshalGetDeviceCertificateResponse,
|
|
522
|
-
unmarshalGetDeviceMetricsResponse,
|
|
523
|
-
unmarshalGetHubCAResponse,
|
|
524
|
-
unmarshalGetHubMetricsResponse,
|
|
525
|
-
unmarshalHub,
|
|
526
|
-
unmarshalListDevicesResponse,
|
|
527
|
-
unmarshalListHubsResponse,
|
|
528
|
-
unmarshalListNetworksResponse,
|
|
529
|
-
unmarshalListRoutesResponse,
|
|
530
|
-
unmarshalListTwinDocumentsResponse,
|
|
531
|
-
unmarshalNetwork,
|
|
532
|
-
unmarshalRenewDeviceCertificateResponse,
|
|
533
|
-
unmarshalRoute,
|
|
534
|
-
unmarshalSetDeviceCertificateResponse,
|
|
535
|
-
unmarshalTwinDocument
|
|
536
|
-
};
|
|
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 };
|