@scaleway/sdk-iot 2.2.1 → 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,533 +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(data.documents, unmarshalListTwinDocumentsResponseDocumentSummary)
255
- };
162
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTwinDocumentsResponse' failed as data isn't a dictionary.`);
163
+ return { documents: unmarshalArrayOfObject(data.documents, unmarshalListTwinDocumentsResponseDocumentSummary) };
256
164
  };
257
165
  const unmarshalRenewDeviceCertificateResponse = (data) => {
258
- if (!isJSONObject(data)) {
259
- throw new TypeError(
260
- `Unmarshalling the type 'RenewDeviceCertificateResponse' failed as data isn't a dictionary.`
261
- );
262
- }
263
- return {
264
- certificate: data.certificate ? unmarshalCertificate(data.certificate) : void 0,
265
- device: data.device ? unmarshalDevice(data.device) : void 0
266
- };
166
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RenewDeviceCertificateResponse' failed as data isn't a dictionary.`);
167
+ return {
168
+ certificate: data.certificate ? unmarshalCertificate(data.certificate) : void 0,
169
+ device: data.device ? unmarshalDevice(data.device) : void 0
170
+ };
267
171
  };
268
- const unmarshalRouteDatabaseConfig = (data) => {
269
- if (!isJSONObject(data)) {
270
- throw new TypeError(
271
- `Unmarshalling the type 'RouteDatabaseConfig' failed as data isn't a dictionary.`
272
- );
273
- }
274
- return {
275
- dbname: data.dbname,
276
- engine: data.engine,
277
- host: data.host,
278
- password: data.password,
279
- port: data.port,
280
- query: data.query,
281
- username: data.username
282
- };
172
+ var unmarshalRouteDatabaseConfig = (data) => {
173
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RouteDatabaseConfig' failed as data isn't a dictionary.`);
174
+ return {
175
+ dbname: data.dbname,
176
+ engine: data.engine,
177
+ host: data.host,
178
+ password: data.password,
179
+ port: data.port,
180
+ query: data.query,
181
+ username: data.username
182
+ };
283
183
  };
284
- const unmarshalRouteRestConfig = (data) => {
285
- if (!isJSONObject(data)) {
286
- throw new TypeError(
287
- `Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`
288
- );
289
- }
290
- return {
291
- headers: data.headers,
292
- uri: data.uri,
293
- verb: data.verb
294
- };
184
+ var unmarshalRouteRestConfig = (data) => {
185
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`);
186
+ return {
187
+ headers: data.headers,
188
+ uri: data.uri,
189
+ verb: data.verb
190
+ };
295
191
  };
296
- const unmarshalRouteS3Config = (data) => {
297
- if (!isJSONObject(data)) {
298
- throw new TypeError(
299
- `Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`
300
- );
301
- }
302
- return {
303
- bucketName: data.bucket_name,
304
- bucketRegion: data.bucket_region,
305
- objectPrefix: data.object_prefix,
306
- strategy: data.strategy
307
- };
192
+ var unmarshalRouteS3Config = (data) => {
193
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`);
194
+ return {
195
+ bucketName: data.bucket_name,
196
+ bucketRegion: data.bucket_region,
197
+ objectPrefix: data.object_prefix,
198
+ strategy: data.strategy
199
+ };
308
200
  };
309
201
  const unmarshalRoute = (data) => {
310
- if (!isJSONObject(data)) {
311
- throw new TypeError(
312
- `Unmarshalling the type 'Route' failed as data isn't a dictionary.`
313
- );
314
- }
315
- return {
316
- createdAt: unmarshalDate(data.created_at),
317
- dbConfig: data.db_config ? unmarshalRouteDatabaseConfig(data.db_config) : void 0,
318
- hubId: data.hub_id,
319
- id: data.id,
320
- name: data.name,
321
- region: data.region,
322
- restConfig: data.rest_config ? unmarshalRouteRestConfig(data.rest_config) : void 0,
323
- s3Config: data.s3_config ? unmarshalRouteS3Config(data.s3_config) : void 0,
324
- topic: data.topic,
325
- type: data.type,
326
- updatedAt: unmarshalDate(data.updated_at)
327
- };
202
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Route' failed as data isn't a dictionary.`);
203
+ return {
204
+ createdAt: unmarshalDate(data.created_at),
205
+ dbConfig: data.db_config ? unmarshalRouteDatabaseConfig(data.db_config) : void 0,
206
+ hubId: data.hub_id,
207
+ id: data.id,
208
+ name: data.name,
209
+ region: data.region,
210
+ restConfig: data.rest_config ? unmarshalRouteRestConfig(data.rest_config) : void 0,
211
+ s3Config: data.s3_config ? unmarshalRouteS3Config(data.s3_config) : void 0,
212
+ topic: data.topic,
213
+ type: data.type,
214
+ updatedAt: unmarshalDate(data.updated_at)
215
+ };
328
216
  };
329
217
  const unmarshalSetDeviceCertificateResponse = (data) => {
330
- if (!isJSONObject(data)) {
331
- throw new TypeError(
332
- `Unmarshalling the type 'SetDeviceCertificateResponse' failed as data isn't a dictionary.`
333
- );
334
- }
335
- return {
336
- certificatePem: data.certificate_pem,
337
- device: data.device ? unmarshalDevice(data.device) : void 0
338
- };
218
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetDeviceCertificateResponse' failed as data isn't a dictionary.`);
219
+ return {
220
+ certificatePem: data.certificate_pem,
221
+ device: data.device ? unmarshalDevice(data.device) : void 0
222
+ };
339
223
  };
340
224
  const unmarshalTwinDocument = (data) => {
341
- if (!isJSONObject(data)) {
342
- throw new TypeError(
343
- `Unmarshalling the type 'TwinDocument' failed as data isn't a dictionary.`
344
- );
345
- }
346
- return {
347
- data: data.data,
348
- documentName: data.document_name,
349
- twinId: data.twin_id,
350
- version: data.version
351
- };
225
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'TwinDocument' failed as data isn't a dictionary.`);
226
+ return {
227
+ data: data.data,
228
+ documentName: data.document_name,
229
+ twinId: data.twin_id,
230
+ version: data.version
231
+ };
352
232
  };
353
- const marshalDeviceMessageFiltersRule = (request, defaults) => ({
354
- policy: request.policy,
355
- topics: request.topics
233
+ var marshalDeviceMessageFiltersRule = (request, defaults) => ({
234
+ policy: request.policy,
235
+ topics: request.topics
356
236
  });
357
- const marshalDeviceMessageFilters = (request, defaults) => ({
358
- publish: request.publish !== void 0 ? marshalDeviceMessageFiltersRule(request.publish) : void 0,
359
- 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
360
240
  });
361
241
  const marshalCreateDeviceRequest = (request, defaults) => ({
362
- allow_insecure: request.allowInsecure,
363
- allow_multiple_connections: request.allowMultipleConnections,
364
- description: request.description,
365
- hub_id: request.hubId,
366
- message_filters: request.messageFilters !== void 0 ? marshalDeviceMessageFilters(request.messageFilters) : void 0,
367
- name: request.name || randomName("device")
368
- });
369
- const marshalHubTwinsGraphiteConfig = (request, defaults) => ({
370
- push_uri: request.pushUri
242
+ allow_insecure: request.allowInsecure,
243
+ allow_multiple_connections: request.allowMultipleConnections,
244
+ description: request.description,
245
+ hub_id: request.hubId,
246
+ message_filters: request.messageFilters !== void 0 ? marshalDeviceMessageFilters(request.messageFilters, defaults) : void 0,
247
+ name: request.name || randomName("device")
371
248
  });
249
+ var marshalHubTwinsGraphiteConfig = (request, defaults) => ({ push_uri: request.pushUri });
372
250
  const marshalCreateHubRequest = (request, defaults) => ({
373
- disable_events: request.disableEvents,
374
- events_topic_prefix: request.eventsTopicPrefix,
375
- name: request.name || randomName("hub"),
376
- product_plan: request.productPlan,
377
- project_id: request.projectId ?? defaults.defaultProjectId,
378
- ...resolveOneOf([
379
- {
380
- param: "twins_graphite_config",
381
- value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : void 0
382
- }
383
- ])
251
+ disable_events: request.disableEvents,
252
+ events_topic_prefix: request.eventsTopicPrefix,
253
+ name: request.name || randomName("hub"),
254
+ product_plan: request.productPlan,
255
+ project_id: request.projectId ?? defaults.defaultProjectId,
256
+ ...resolveOneOf([{
257
+ param: "twins_graphite_config",
258
+ value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) : void 0
259
+ }])
384
260
  });
385
261
  const marshalCreateNetworkRequest = (request, defaults) => ({
386
- hub_id: request.hubId,
387
- name: request.name || randomName("network"),
388
- topic_prefix: request.topicPrefix,
389
- type: request.type
262
+ hub_id: request.hubId,
263
+ name: request.name || randomName("network"),
264
+ topic_prefix: request.topicPrefix,
265
+ type: request.type
390
266
  });
391
- const marshalCreateRouteRequestDatabaseConfig = (request, defaults) => ({
392
- dbname: request.dbname,
393
- engine: request.engine,
394
- host: request.host,
395
- password: request.password,
396
- port: request.port,
397
- query: request.query,
398
- 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
399
275
  });
400
- const marshalCreateRouteRequestRestConfig = (request, defaults) => ({
401
- headers: request.headers,
402
- uri: request.uri,
403
- verb: request.verb
276
+ var marshalCreateRouteRequestRestConfig = (request, defaults) => ({
277
+ headers: request.headers,
278
+ uri: request.uri,
279
+ verb: request.verb
404
280
  });
405
- const marshalCreateRouteRequestS3Config = (request, defaults) => ({
406
- bucket_name: request.bucketName,
407
- bucket_region: request.bucketRegion,
408
- object_prefix: request.objectPrefix,
409
- 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
410
286
  });
411
287
  const marshalCreateRouteRequest = (request, defaults) => ({
412
- hub_id: request.hubId,
413
- name: request.name || randomName("route"),
414
- topic: request.topic,
415
- ...resolveOneOf([
416
- {
417
- param: "s3_config",
418
- value: request.s3Config !== void 0 ? marshalCreateRouteRequestS3Config(request.s3Config) : void 0
419
- },
420
- {
421
- param: "db_config",
422
- value: request.dbConfig !== void 0 ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig) : void 0
423
- },
424
- {
425
- param: "rest_config",
426
- value: request.restConfig !== void 0 ? marshalCreateRouteRequestRestConfig(request.restConfig) : void 0
427
- }
428
- ])
288
+ hub_id: request.hubId,
289
+ name: request.name || randomName("route"),
290
+ topic: request.topic,
291
+ ...resolveOneOf([
292
+ {
293
+ param: "s3_config",
294
+ value: request.s3Config !== void 0 ? marshalCreateRouteRequestS3Config(request.s3Config, defaults) : void 0
295
+ },
296
+ {
297
+ param: "db_config",
298
+ value: request.dbConfig !== void 0 ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig, defaults) : void 0
299
+ },
300
+ {
301
+ param: "rest_config",
302
+ value: request.restConfig !== void 0 ? marshalCreateRouteRequestRestConfig(request.restConfig, defaults) : void 0
303
+ }
304
+ ])
429
305
  });
430
306
  const marshalPatchTwinDocumentRequest = (request, defaults) => ({
431
- data: request.data,
432
- version: request.version
307
+ data: request.data,
308
+ version: request.version
433
309
  });
434
310
  const marshalPutTwinDocumentRequest = (request, defaults) => ({
435
- data: request.data,
436
- version: request.version
437
- });
438
- const marshalSetDeviceCertificateRequest = (request, defaults) => ({
439
- certificate_pem: request.certificatePem
311
+ data: request.data,
312
+ version: request.version
440
313
  });
314
+ const marshalSetDeviceCertificateRequest = (request, defaults) => ({ certificate_pem: request.certificatePem });
441
315
  const marshalSetHubCARequest = (request, defaults) => ({
442
- ca_cert_pem: request.caCertPem,
443
- challenge_cert_pem: request.challengeCertPem
316
+ ca_cert_pem: request.caCertPem,
317
+ challenge_cert_pem: request.challengeCertPem
444
318
  });
445
319
  const marshalUpdateDeviceRequest = (request, defaults) => ({
446
- allow_insecure: request.allowInsecure,
447
- allow_multiple_connections: request.allowMultipleConnections,
448
- description: request.description,
449
- hub_id: request.hubId,
450
- 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
451
325
  });
452
326
  const marshalUpdateHubRequest = (request, defaults) => ({
453
- disable_events: request.disableEvents,
454
- enable_device_auto_provisioning: request.enableDeviceAutoProvisioning,
455
- events_topic_prefix: request.eventsTopicPrefix,
456
- name: request.name,
457
- product_plan: request.productPlan,
458
- ...resolveOneOf([
459
- {
460
- param: "twins_graphite_config",
461
- value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : void 0
462
- }
463
- ])
327
+ disable_events: request.disableEvents,
328
+ enable_device_auto_provisioning: request.enableDeviceAutoProvisioning,
329
+ events_topic_prefix: request.eventsTopicPrefix,
330
+ name: request.name,
331
+ product_plan: request.productPlan,
332
+ ...resolveOneOf([{
333
+ param: "twins_graphite_config",
334
+ value: request.twinsGraphiteConfig !== void 0 ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig, defaults) : void 0
335
+ }])
464
336
  });
465
- const marshalUpdateRouteRequestDatabaseConfig = (request, defaults) => ({
466
- dbname: request.dbname,
467
- engine: request.engine,
468
- host: request.host,
469
- password: request.password,
470
- port: request.port,
471
- query: request.query,
472
- 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
473
345
  });
474
- const marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
475
- headers: request.headers,
476
- uri: request.uri,
477
- verb: request.verb
346
+ var marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
347
+ headers: request.headers,
348
+ uri: request.uri,
349
+ verb: request.verb
478
350
  });
479
- const marshalUpdateRouteRequestS3Config = (request, defaults) => ({
480
- bucket_name: request.bucketName,
481
- bucket_region: request.bucketRegion,
482
- object_prefix: request.objectPrefix,
483
- 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
484
356
  });
485
357
  const marshalUpdateRouteRequest = (request, defaults) => ({
486
- name: request.name,
487
- topic: request.topic,
488
- ...resolveOneOf([
489
- {
490
- param: "s3_config",
491
- value: request.s3Config !== void 0 ? marshalUpdateRouteRequestS3Config(request.s3Config) : void 0
492
- },
493
- {
494
- param: "db_config",
495
- value: request.dbConfig !== void 0 ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig) : void 0
496
- },
497
- {
498
- param: "rest_config",
499
- value: request.restConfig !== void 0 ? marshalUpdateRouteRequestRestConfig(request.restConfig) : void 0
500
- }
501
- ])
358
+ name: request.name,
359
+ topic: request.topic,
360
+ ...resolveOneOf([
361
+ {
362
+ param: "s3_config",
363
+ value: request.s3Config !== void 0 ? marshalUpdateRouteRequestS3Config(request.s3Config, defaults) : void 0
364
+ },
365
+ {
366
+ param: "db_config",
367
+ value: request.dbConfig !== void 0 ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig, defaults) : void 0
368
+ },
369
+ {
370
+ param: "rest_config",
371
+ value: request.restConfig !== void 0 ? marshalUpdateRouteRequestRestConfig(request.restConfig, defaults) : void 0
372
+ }
373
+ ])
502
374
  });
503
- export {
504
- marshalCreateDeviceRequest,
505
- marshalCreateHubRequest,
506
- marshalCreateNetworkRequest,
507
- marshalCreateRouteRequest,
508
- marshalPatchTwinDocumentRequest,
509
- marshalPutTwinDocumentRequest,
510
- marshalSetDeviceCertificateRequest,
511
- marshalSetHubCARequest,
512
- marshalUpdateDeviceRequest,
513
- marshalUpdateHubRequest,
514
- marshalUpdateRouteRequest,
515
- unmarshalCreateDeviceResponse,
516
- unmarshalCreateNetworkResponse,
517
- unmarshalDevice,
518
- unmarshalGetDeviceCertificateResponse,
519
- unmarshalGetDeviceMetricsResponse,
520
- unmarshalGetHubCAResponse,
521
- unmarshalGetHubMetricsResponse,
522
- unmarshalHub,
523
- unmarshalListDevicesResponse,
524
- unmarshalListHubsResponse,
525
- unmarshalListNetworksResponse,
526
- unmarshalListRoutesResponse,
527
- unmarshalListTwinDocumentsResponse,
528
- unmarshalNetwork,
529
- unmarshalRenewDeviceCertificateResponse,
530
- unmarshalRoute,
531
- unmarshalSetDeviceCertificateResponse,
532
- unmarshalTwinDocument
533
- };
375
+ export { marshalCreateDeviceRequest, marshalCreateHubRequest, marshalCreateNetworkRequest, marshalCreateRouteRequest, marshalPatchTwinDocumentRequest, marshalPutTwinDocumentRequest, marshalSetDeviceCertificateRequest, marshalSetHubCARequest, marshalUpdateDeviceRequest, marshalUpdateHubRequest, marshalUpdateRouteRequest, unmarshalCreateDeviceResponse, unmarshalCreateNetworkResponse, unmarshalDevice, unmarshalGetDeviceCertificateResponse, unmarshalGetDeviceMetricsResponse, unmarshalGetHubCAResponse, unmarshalGetHubMetricsResponse, unmarshalHub, unmarshalListDevicesResponse, unmarshalListHubsResponse, unmarshalListNetworksResponse, unmarshalListRoutesResponse, unmarshalListTwinDocumentsResponse, unmarshalNetwork, unmarshalRenewDeviceCertificateResponse, unmarshalRoute, unmarshalSetDeviceCertificateResponse, unmarshalTwinDocument };