forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsm.py
More file actions
596 lines (457 loc) · 25.4 KB
/
Copy pathsm.py
File metadata and controls
596 lines (457 loc) · 25.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
class SM(object):
def __init__(self, session):
super(SM, self).__init__()
self._session = session
def createNetworkSmBypassActivationLockAttempt(self, networkId: str, ids: list):
"""
**Bypass activation lock attempt**
https://developer.cisco.com/meraki/api/#!create-network-sm-bypass-activation-lock-attempt
- networkId (string)
- ids (array): The ids of the devices to attempt activation lock bypass.
"""
kwargs = locals()
metadata = {
'tags': ['SM'],
'operation': 'createNetworkSmBypassActivationLockAttempt',
}
resource = f'/networks/{networkId}/sm/bypassActivationLockAttempts'
body_params = ['ids']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.post(metadata, resource, payload)
def getNetworkSmBypassActivationLockAttempt(self, networkId: str, attemptId: str):
"""
**Bypass activation lock attempt status**
https://developer.cisco.com/meraki/api/#!get-network-sm-bypass-activation-lock-attempt
- networkId (string)
- attemptId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmBypassActivationLockAttempt',
}
resource = f'/networks/{networkId}/sm/bypassActivationLockAttempts/{attemptId}'
return self._session.get(metadata, resource)
def updateNetworkSmDeviceFields(self, networkId: str, deviceFields: dict, **kwargs):
"""
**Modify the fields of a device**
https://developer.cisco.com/meraki/api/#!update-network-sm-device-fields
- networkId (string)
- deviceFields (object): The new fields of the device. Each field of this object is optional.
- wifiMac (string): The wifiMac of the device to be modified.
- id (string): The id of the device to be modified.
- serial (string): The serial of the device to be modified.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'updateNetworkSmDeviceFields',
}
resource = f'/networks/{networkId}/sm/device/fields'
body_params = ['wifiMac', 'id', 'serial', 'deviceFields']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def wipeNetworkSmDevice(self, networkId: str, **kwargs):
"""
**Wipe a device**
https://developer.cisco.com/meraki/api/#!wipe-network-sm-device
- networkId (string)
- wifiMac (string): The wifiMac of the device to be wiped.
- id (string): The id of the device to be wiped.
- serial (string): The serial of the device to be wiped.
- pin (integer): The pin number (a six digit value) for wiping a macOS device. Required only for macOS devices.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'wipeNetworkSmDevice',
}
resource = f'/networks/{networkId}/sm/device/wipe'
body_params = ['wifiMac', 'id', 'serial', 'pin']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def refreshNetworkSmDeviceDetails(self, networkId: str, deviceId: str):
"""
**Refresh the details of a device**
https://developer.cisco.com/meraki/api/#!refresh-network-sm-device-details
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'refreshNetworkSmDeviceDetails',
}
resource = f'/networks/{networkId}/sm/device/{deviceId}/refreshDetails'
return self._session.post(metadata, resource)
def getNetworkSmDevices(self, networkId: str, **kwargs):
"""
**List the devices enrolled in an SM network with various specified fields and filters**
https://developer.cisco.com/meraki/api/#!get-network-sm-devices
- networkId (string)
- fields (string): Additional fields that will be displayed for each device. Multiple fields can be passed in as comma separated values.
The default fields are: id, name, tags, ssid, wifiMac, osName, systemModel, uuid, and serialNumber. The additional fields are: ip,
systemType, availableDeviceCapacity, kioskAppName, biosVersion, lastConnected, missingAppsCount, userSuppliedAddress, location, lastUser,
ownerEmail, ownerUsername, publicIp, phoneNumber, diskInfoJson, deviceCapacity, isManaged, hadMdm, isSupervised, meid, imei, iccid,
simCarrierNetwork, cellularDataUsed, isHotspotEnabled, createdAt, batteryEstCharge, quarantined, avName, avRunning, asName, fwName,
isRooted, loginRequired, screenLockEnabled, screenLockDelay, autoLoginDisabled, autoTags, hasMdm, hasDesktopAgent, diskEncryptionEnabled,
hardwareEncryptionCaps, passCodeLock, usesHardwareKeystore, and androidSecurityPatchVersion.
- wifiMacs (string): Filter devices by wifi mac(s). Multiple wifi macs can be passed in as comma separated values.
- serials (string): Filter devices by serial(s). Multiple serials can be passed in as comma separated values.
- ids (string): Filter devices by id(s). Multiple ids can be passed in as comma separated values.
- scope (string): Specify a scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags as comma separated values.
- batchSize (integer): Number of devices to return, 1000 is the default as well as the max.
- batchToken (string): If the network has more devices than the batch size, a batch token will be returned
as a part of the device list. To see the remainder of the devices, pass in the batchToken as a parameter in the next request.
Requests made with the batchToken do not require additional parameters as the batchToken includes the parameters passed in
with the original request. Additional parameters passed in with the batchToken will be ignored.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmDevices',
}
resource = f'/networks/{networkId}/sm/devices'
query_params = ['fields', 'wifiMacs', 'serials', 'ids', 'scope', 'batchSize', 'batchToken']
params = {k: v for (k, v) in kwargs.items() if k in query_params}
return self._session.get(metadata, resource, params)
def checkinNetworkSmDevices(self, networkId: str, **kwargs):
"""
**Force check-in a set of devices**
https://developer.cisco.com/meraki/api/#!checkin-network-sm-devices
- networkId (string)
- wifiMacs (string): The wifiMacs of the devices to be checked-in.
- ids (string): The ids of the devices to be checked-in.
- serials (string): The serials of the devices to be checked-in.
- scope (string): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be checked-in.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'checkinNetworkSmDevices',
}
resource = f'/networks/{networkId}/sm/devices/checkin'
body_params = ['wifiMacs', 'ids', 'serials', 'scope']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def moveNetworkSmDevices(self, networkId: str, newNetwork: str, **kwargs):
"""
**Move a set of devices to a new network**
https://developer.cisco.com/meraki/api/#!move-network-sm-devices
- networkId (string)
- newNetwork (string): The new network to which the devices will be moved.
- wifiMacs (string): The wifiMacs of the devices to be moved.
- ids (string): The ids of the devices to be moved.
- serials (string): The serials of the devices to be moved.
- scope (string): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be moved.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'moveNetworkSmDevices',
}
resource = f'/networks/{networkId}/sm/devices/move'
body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'newNetwork']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def updateNetworkSmDevicesTags(self, networkId: str, tags: str, updateAction: str, **kwargs):
"""
**Add, delete, or update the tags of a set of devices**
https://developer.cisco.com/meraki/api/#!update-network-sm-devices-tags
- networkId (string)
- tags (string): The tags to be added, deleted, or updated.
- updateAction (string): One of add, delete, or update. Only devices that have been modified will be returned.
- wifiMacs (string): The wifiMacs of the devices to be modified.
- ids (string): The ids of the devices to be modified.
- serials (string): The serials of the devices to be modified.
- scope (string): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be modified.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'updateNetworkSmDevicesTags',
}
resource = f'/networks/{networkId}/sm/devices/tags'
body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'tags', 'updateAction']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def unenrollNetworkSmDevice(self, networkId: str, deviceId: str):
"""
**Unenroll a device**
https://developer.cisco.com/meraki/api/#!unenroll-network-sm-device
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'unenrollNetworkSmDevice',
}
resource = f'/networks/{networkId}/sm/devices/{deviceId}/unenroll'
return self._session.post(metadata, resource)
def getNetworkSmProfiles(self, networkId: str):
"""
**List all the profiles in the network**
https://developer.cisco.com/meraki/api/#!get-network-sm-profiles
- networkId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmProfiles',
}
resource = f'/networks/{networkId}/sm/profiles'
return self._session.get(metadata, resource)
def getNetworkSmUserDeviceProfiles(self, networkId: str, userId: str):
"""
**Get the profiles associated with a user**
https://developer.cisco.com/meraki/api/#!get-network-sm-user-device-profiles
- networkId (string)
- userId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmUserDeviceProfiles',
}
resource = f'/networks/{networkId}/sm/user/{userId}/deviceProfiles'
return self._session.get(metadata, resource)
def getNetworkSmUserSoftwares(self, networkId: str, userId: str):
"""
**Get a list of softwares associated with a user**
https://developer.cisco.com/meraki/api/#!get-network-sm-user-softwares
- networkId (string)
- userId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmUserSoftwares',
}
resource = f'/networks/{networkId}/sm/user/{userId}/softwares'
return self._session.get(metadata, resource)
def getNetworkSmUsers(self, networkId: str, **kwargs):
"""
**List the owners in an SM network with various specified fields and filters**
https://developer.cisco.com/meraki/api/#!get-network-sm-users
- networkId (string)
- ids (string): Filter users by id(s). Multiple ids can be passed in as comma separated values.
- usernames (string): Filter users by username(s). Multiple usernames can be passed in as comma separated values.
- emails (string): Filter users by email(s). Multiple emails can be passed in as comma separated values.
- scope (string): Specifiy a scope (one of all, none, withAny, withAll, withoutAny, withoutAll) and a set of tags as comma separated values.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmUsers',
}
resource = f'/networks/{networkId}/sm/users'
query_params = ['ids', 'usernames', 'emails', 'scope']
params = {k: v for (k, v) in kwargs.items() if k in query_params}
return self._session.get(metadata, resource, params)
def getNetworkSmCellularUsageHistory(self, networkId: str, deviceId: str):
"""
**Return the client's daily cellular data usage history. Usage data is in kilobytes.**
https://developer.cisco.com/meraki/api/#!get-network-sm-cellular-usage-history
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmCellularUsageHistory',
}
resource = f'/networks/{networkId}/sm/{deviceId}/cellularUsageHistory'
return self._session.get(metadata, resource)
def getNetworkSmCerts(self, networkId: str, deviceId: str):
"""
**List the certs on a device**
https://developer.cisco.com/meraki/api/#!get-network-sm-certs
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmCerts',
}
resource = f'/networks/{networkId}/sm/{deviceId}/certs'
return self._session.get(metadata, resource)
def getNetworkSmDeviceProfiles(self, networkId: str, deviceId: str):
"""
**Get the profiles associated with a device**
https://developer.cisco.com/meraki/api/#!get-network-sm-device-profiles
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmDeviceProfiles',
}
resource = f'/networks/{networkId}/sm/{deviceId}/deviceProfiles'
return self._session.get(metadata, resource)
def getNetworkSmNetworkAdapters(self, networkId: str, deviceId: str):
"""
**List the network adapters of a device**
https://developer.cisco.com/meraki/api/#!get-network-sm-network-adapters
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmNetworkAdapters',
}
resource = f'/networks/{networkId}/sm/{deviceId}/networkAdapters'
return self._session.get(metadata, resource)
def getNetworkSmRestrictions(self, networkId: str, deviceId: str):
"""
**List the restrictions on a device**
https://developer.cisco.com/meraki/api/#!get-network-sm-restrictions
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmRestrictions',
}
resource = f'/networks/{networkId}/sm/{deviceId}/restrictions'
return self._session.get(metadata, resource)
def getNetworkSmSecurityCenters(self, networkId: str, deviceId: str):
"""
**List the security centers on a device**
https://developer.cisco.com/meraki/api/#!get-network-sm-security-centers
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmSecurityCenters',
}
resource = f'/networks/{networkId}/sm/{deviceId}/securityCenters'
return self._session.get(metadata, resource)
def getNetworkSmSoftwares(self, networkId: str, deviceId: str):
"""
**Get a list of softwares associated with a device**
https://developer.cisco.com/meraki/api/#!get-network-sm-softwares
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmSoftwares',
}
resource = f'/networks/{networkId}/sm/{deviceId}/softwares'
return self._session.get(metadata, resource)
def getNetworkSmWlanLists(self, networkId: str, deviceId: str):
"""
**List the saved SSID names on a device**
https://developer.cisco.com/meraki/api/#!get-network-sm-wlan-lists
- networkId (string)
- deviceId (string)
"""
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmWlanLists',
}
resource = f'/networks/{networkId}/sm/{deviceId}/wlanLists'
return self._session.get(metadata, resource)
def lockNetworkSmDevices(self, network_id: str, **kwargs):
"""
**Lock a set of devices**
https://developer.cisco.com/meraki/api/#!lock-network-sm-devices
- network_id (string)
- wifiMacs (string): The wifiMacs of the devices to be locked.
- ids (string): The ids of the devices to be locked.
- serials (string): The serials of the devices to be locked.
- scope (string): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be wiped.
- pin (integer): The pin number for locking macOS devices (a six digit number). Required only for macOS devices.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'lockNetworkSmDevices',
}
resource = f'/networks/{network_id}/sm/devices/lock'
body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'pin']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def getNetworkSmConnectivity(self, network_id: str, id: str, total_pages=1, direction='next', **kwargs):
"""
**Returns historical connectivity data (whether a device is regularly checking in to Dashboard).**
https://developer.cisco.com/meraki/api/#!get-network-sm-connectivity
- network_id (string)
- id (string)
- total_pages (integer or string): total number of pages to retrieve, -1 or "all" for all pages
- direction (string): direction to paginate, either "next" (default) or "prev" page
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
- startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmConnectivity',
}
resource = f'/networks/{network_id}/sm/{id}/connectivity'
query_params = ['perPage', 'startingAfter', 'endingBefore']
params = {k: v for (k, v) in kwargs.items() if k in query_params}
return self._session.get_pages(metadata, resource, params, total_pages, direction)
def getNetworkSmDesktopLogs(self, network_id: str, id: str, total_pages=1, direction='next', **kwargs):
"""
**Return historical records of various Systems Manager network connection details for desktop devices.**
https://developer.cisco.com/meraki/api/#!get-network-sm-desktop-logs
- network_id (string)
- id (string)
- total_pages (integer or string): total number of pages to retrieve, -1 or "all" for all pages
- direction (string): direction to paginate, either "next" (default) or "prev" page
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
- startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmDesktopLogs',
}
resource = f'/networks/{network_id}/sm/{id}/desktopLogs'
query_params = ['perPage', 'startingAfter', 'endingBefore']
params = {k: v for (k, v) in kwargs.items() if k in query_params}
return self._session.get_pages(metadata, resource, params, total_pages, direction)
def getNetworkSmDeviceCommandLogs(self, network_id: str, id: str, total_pages=1, direction='next', **kwargs):
"""
** Return historical records of commands sent to Systems Manager devices.
<p>Note that this will include the name of the Dashboard user who initiated the command if it was generated
by a Dashboard admin rather than the automatic behavior of the system; you may wish to filter this out
of any reports.</p>
**
https://developer.cisco.com/meraki/api/#!get-network-sm-device-command-logs
- network_id (string)
- id (string)
- total_pages (integer or string): total number of pages to retrieve, -1 or "all" for all pages
- direction (string): direction to paginate, either "next" (default) or "prev" page
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
- startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmDeviceCommandLogs',
}
resource = f'/networks/{network_id}/sm/{id}/deviceCommandLogs'
query_params = ['perPage', 'startingAfter', 'endingBefore']
params = {k: v for (k, v) in kwargs.items() if k in query_params}
return self._session.get_pages(metadata, resource, params, total_pages, direction)
def getNetworkSmPerformanceHistory(self, network_id: str, id: str, total_pages=1, direction='next', **kwargs):
"""
**Return historical records of various Systems Manager client metrics for desktop devices.**
https://developer.cisco.com/meraki/api/#!get-network-sm-performance-history
- network_id (string)
- id (string)
- total_pages (integer or string): total number of pages to retrieve, -1 or "all" for all pages
- direction (string): direction to paginate, either "next" (default) or "prev" page
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
- startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
"""
kwargs.update(locals())
metadata = {
'tags': ['SM'],
'operation': 'getNetworkSmPerformanceHistory',
}
resource = f'/networks/{network_id}/sm/{id}/performanceHistory'
query_params = ['perPage', 'startingAfter', 'endingBefore']
params = {k: v for (k, v) in kwargs.items() if k in query_params}
return self._session.get_pages(metadata, resource, params, total_pages, direction)