@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.
@@ -1,536 +1,375 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalTimeSeries } from "@scaleway/sdk-client";
1
2
  import randomName from "@scaleway/random-name";
2
- import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate, unmarshalTimeSeries } from "@scaleway/sdk-client";
3
- const unmarshalDeviceMessageFiltersRule = (data) => {
4
- if (!isJSONObject(data)) {
5
- throw new TypeError(
6
- `Unmarshalling the type 'DeviceMessageFiltersRule' failed as data isn't a dictionary.`
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
- const unmarshalDeviceMessageFilters = (data) => {
15
- if (!isJSONObject(data)) {
16
- throw new TypeError(
17
- `Unmarshalling the type 'DeviceMessageFilters' failed as data isn't a dictionary.`
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
- if (!isJSONObject(data)) {
27
- throw new TypeError(
28
- `Unmarshalling the type 'Device' failed as data isn't a dictionary.`
29
- );
30
- }
31
- return {
32
- allowInsecure: data.allow_insecure,
33
- allowMultipleConnections: data.allow_multiple_connections,
34
- createdAt: unmarshalDate(data.created_at),
35
- description: data.description,
36
- hasCustomCertificate: data.has_custom_certificate,
37
- hubId: data.hub_id,
38
- id: data.id,
39
- isConnected: data.is_connected,
40
- lastActivityAt: unmarshalDate(data.last_activity_at),
41
- messageFilters: data.message_filters ? unmarshalDeviceMessageFilters(data.message_filters) : void 0,
42
- name: data.name,
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
- if (!isJSONObject(data)) {
50
- throw new TypeError(
51
- `Unmarshalling the type 'Network' failed as data isn't a dictionary.`
52
- );
53
- }
54
- return {
55
- createdAt: unmarshalDate(data.created_at),
56
- endpoint: data.endpoint,
57
- hubId: data.hub_id,
58
- id: data.id,
59
- name: data.name,
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
- const unmarshalHubTwinsGraphiteConfig = (data) => {
66
- if (!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
- };
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
- if (!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: 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: 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
- const unmarshalCertificate = (data) => {
103
- if (!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
- };
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
- if (!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
- };
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
- if (!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
- };
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
- if (!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
- };
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
- if (!isJSONObject(data)) {
148
- throw new TypeError(
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
- if (!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
- };
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
- if (!isJSONObject(data)) {
168
- throw new TypeError(
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
- if (!isJSONObject(data)) {
178
- throw new TypeError(
179
- `Unmarshalling the type 'ListDevicesResponse' failed as data isn't a dictionary.`
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
- if (!isJSONObject(data)) {
189
- throw new TypeError(
190
- `Unmarshalling the type 'ListHubsResponse' failed as data isn't a dictionary.`
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
- if (!isJSONObject(data)) {
200
- throw new TypeError(
201
- `Unmarshalling the type 'ListNetworksResponse' failed as data isn't a dictionary.`
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
- const unmarshalRouteSummary = (data) => {
210
- if (!isJSONObject(data)) {
211
- throw new TypeError(
212
- `Unmarshalling the type 'RouteSummary' failed as data isn't a dictionary.`
213
- );
214
- }
215
- return {
216
- createdAt: unmarshalDate(data.created_at),
217
- hubId: data.hub_id,
218
- id: data.id,
219
- name: data.name,
220
- region: data.region,
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
- if (!isJSONObject(data)) {
228
- throw new TypeError(
229
- `Unmarshalling the type 'ListRoutesResponse' failed as data isn't a dictionary.`
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
- const unmarshalListTwinDocumentsResponseDocumentSummary = (data) => {
238
- if (!isJSONObject(data)) {
239
- throw new TypeError(
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
- if (!isJSONObject(data)) {
249
- throw new TypeError(
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
- if (!isJSONObject(data)) {
262
- throw new TypeError(
263
- `Unmarshalling the type 'RenewDeviceCertificateResponse' failed as data isn't a dictionary.`
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
- const unmarshalRouteDatabaseConfig = (data) => {
272
- if (!isJSONObject(data)) {
273
- throw new TypeError(
274
- `Unmarshalling the type 'RouteDatabaseConfig' failed as data isn't a dictionary.`
275
- );
276
- }
277
- return {
278
- dbname: data.dbname,
279
- engine: data.engine,
280
- host: data.host,
281
- password: data.password,
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
- const unmarshalRouteRestConfig = (data) => {
288
- if (!isJSONObject(data)) {
289
- throw new TypeError(
290
- `Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`
291
- );
292
- }
293
- return {
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
- const unmarshalRouteS3Config = (data) => {
300
- if (!isJSONObject(data)) {
301
- throw new TypeError(
302
- `Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`
303
- );
304
- }
305
- return {
306
- bucketName: data.bucket_name,
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
- if (!isJSONObject(data)) {
314
- throw new TypeError(
315
- `Unmarshalling the type 'Route' failed as data isn't a dictionary.`
316
- );
317
- }
318
- return {
319
- createdAt: unmarshalDate(data.created_at),
320
- dbConfig: data.db_config ? unmarshalRouteDatabaseConfig(data.db_config) : void 0,
321
- hubId: data.hub_id,
322
- id: data.id,
323
- name: data.name,
324
- region: data.region,
325
- restConfig: data.rest_config ? unmarshalRouteRestConfig(data.rest_config) : void 0,
326
- s3Config: data.s3_config ? unmarshalRouteS3Config(data.s3_config) : void 0,
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
- if (!isJSONObject(data)) {
334
- throw new TypeError(
335
- `Unmarshalling the type 'SetDeviceCertificateResponse' failed as data isn't a dictionary.`
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
- if (!isJSONObject(data)) {
345
- throw new TypeError(
346
- `Unmarshalling the type 'TwinDocument' failed as data isn't a dictionary.`
347
- );
348
- }
349
- return {
350
- data: data.data,
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
- const marshalDeviceMessageFiltersRule = (request, defaults) => ({
357
- policy: request.policy,
358
- topics: request.topics
233
+ var marshalDeviceMessageFiltersRule = (request, defaults) => ({
234
+ policy: request.policy,
235
+ topics: request.topics
359
236
  });
360
- const marshalDeviceMessageFilters = (request, defaults) => ({
361
- publish: request.publish !== void 0 ? marshalDeviceMessageFiltersRule(request.publish) : void 0,
362
- subscribe: request.subscribe !== void 0 ? marshalDeviceMessageFiltersRule(request.subscribe) : void 0
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
- allow_insecure: request.allowInsecure,
366
- allow_multiple_connections: request.allowMultipleConnections,
367
- description: request.description,
368
- hub_id: request.hubId,
369
- message_filters: request.messageFilters !== void 0 ? marshalDeviceMessageFilters(request.messageFilters) : void 0,
370
- name: request.name || randomName("device")
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
- disable_events: request.disableEvents,
377
- events_topic_prefix: request.eventsTopicPrefix,
378
- name: request.name || randomName("hub"),
379
- product_plan: request.productPlan,
380
- project_id: request.projectId ?? defaults.defaultProjectId,
381
- ...resolveOneOf([
382
- {
383
- param: "twins_graphite_config",
384
- value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : void 0
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
- hub_id: request.hubId,
390
- name: request.name || randomName("network"),
391
- topic_prefix: request.topicPrefix,
392
- type: request.type
262
+ hub_id: request.hubId,
263
+ name: request.name || randomName("network"),
264
+ topic_prefix: request.topicPrefix,
265
+ type: request.type
393
266
  });
394
- const marshalCreateRouteRequestDatabaseConfig = (request, defaults) => ({
395
- dbname: request.dbname,
396
- engine: request.engine,
397
- host: request.host,
398
- password: request.password,
399
- port: request.port,
400
- query: request.query,
401
- username: request.username
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
- const marshalCreateRouteRequestRestConfig = (request, defaults) => ({
404
- headers: request.headers,
405
- uri: request.uri,
406
- verb: request.verb
276
+ var marshalCreateRouteRequestRestConfig = (request, defaults) => ({
277
+ headers: request.headers,
278
+ uri: request.uri,
279
+ verb: request.verb
407
280
  });
408
- const marshalCreateRouteRequestS3Config = (request, defaults) => ({
409
- bucket_name: request.bucketName,
410
- bucket_region: request.bucketRegion,
411
- object_prefix: request.objectPrefix,
412
- strategy: request.strategy
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
- hub_id: request.hubId,
416
- name: request.name || randomName("route"),
417
- topic: request.topic,
418
- ...resolveOneOf([
419
- {
420
- param: "s3_config",
421
- value: request.s3Config !== void 0 ? marshalCreateRouteRequestS3Config(request.s3Config) : void 0
422
- },
423
- {
424
- param: "db_config",
425
- value: request.dbConfig !== void 0 ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig) : void 0
426
- },
427
- {
428
- param: "rest_config",
429
- value: request.restConfig !== void 0 ? marshalCreateRouteRequestRestConfig(request.restConfig) : void 0
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
- data: request.data,
435
- version: request.version
307
+ data: request.data,
308
+ version: request.version
436
309
  });
437
310
  const marshalPutTwinDocumentRequest = (request, defaults) => ({
438
- data: request.data,
439
- version: request.version
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
- ca_cert_pem: request.caCertPem,
446
- challenge_cert_pem: request.challengeCertPem
316
+ ca_cert_pem: request.caCertPem,
317
+ challenge_cert_pem: request.challengeCertPem
447
318
  });
448
319
  const marshalUpdateDeviceRequest = (request, defaults) => ({
449
- allow_insecure: request.allowInsecure,
450
- allow_multiple_connections: request.allowMultipleConnections,
451
- description: request.description,
452
- hub_id: request.hubId,
453
- message_filters: request.messageFilters !== void 0 ? marshalDeviceMessageFilters(request.messageFilters) : void 0
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
- disable_events: request.disableEvents,
457
- enable_device_auto_provisioning: request.enableDeviceAutoProvisioning,
458
- events_topic_prefix: request.eventsTopicPrefix,
459
- name: request.name,
460
- product_plan: request.productPlan,
461
- ...resolveOneOf([
462
- {
463
- param: "twins_graphite_config",
464
- value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : void 0
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
- const marshalUpdateRouteRequestDatabaseConfig = (request, defaults) => ({
469
- dbname: request.dbname,
470
- engine: request.engine,
471
- host: request.host,
472
- password: request.password,
473
- port: request.port,
474
- query: request.query,
475
- username: request.username
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
- const marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
478
- headers: request.headers,
479
- uri: request.uri,
480
- verb: request.verb
346
+ var marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
347
+ headers: request.headers,
348
+ uri: request.uri,
349
+ verb: request.verb
481
350
  });
482
- const marshalUpdateRouteRequestS3Config = (request, defaults) => ({
483
- bucket_name: request.bucketName,
484
- bucket_region: request.bucketRegion,
485
- object_prefix: request.objectPrefix,
486
- strategy: request.strategy
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
- name: request.name,
490
- topic: request.topic,
491
- ...resolveOneOf([
492
- {
493
- param: "s3_config",
494
- value: request.s3Config !== void 0 ? marshalUpdateRouteRequestS3Config(request.s3Config) : void 0
495
- },
496
- {
497
- param: "db_config",
498
- value: request.dbConfig !== void 0 ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig) : void 0
499
- },
500
- {
501
- param: "rest_config",
502
- value: request.restConfig !== void 0 ? marshalUpdateRouteRequestRestConfig(request.restConfig) : void 0
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 };