Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Int 9900 paginate correctly #71

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jupiterone/graph-airwatch",
"version": "0.6.6",
"version": "0.6.7",
"description": "A graph conversion tool for https://www.air-watch.com/.",
"repository": {
"type": "git",
Expand Down
49 changes: 28 additions & 21 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,34 @@ export default class AirWatchClient {
iteratee: ResourceIteratee<AirwatchProfile>,
groupUuid: string,
): Promise<void> {
const response = await this.makeRequest<AirwatchProfileResponse>(
`/mdm/profiles/search`,
'POST',
JSON.stringify({
profileSearchRequestV3Model: {
organization_group_uuid: groupUuid,
},
}),
'3',
);

for (const profile of response.profiles) {
//If we need to add details, for now its not needed.
// const details = await this.makeRequest<AirwatchProfileResponse>(
// `/mdm/profiles/${profile.uuid}`,
// 'GET',
// undefined,
// '3',
// );
await iteratee(profile);
}
let page = 0;
let response: AirwatchProfileResponse;
let accumulated = 0;
do {
response = await this.makeRequest<AirwatchProfileResponse>(
`/mdm/profiles/search`,
'POST',
JSON.stringify({
profileSearchRequestV3Model: {
organization_group_uuid: groupUuid,
page_number: page,
},
}),
'3',
);
accumulated += response.profiles.length ?? 0;
for (const profile of response.profiles) {
//If we need to add details, for now its not needed.
// const details = await this.makeRequest<AirwatchProfileResponse>(
// `/mdm/profiles/${profile.uuid}`,
// 'GET',
// undefined,
// '3',
// );
await iteratee(profile);
}
page++;
} while (accumulated < response.total_count);
}

public async fetchDevicesForProfile(
Expand Down
4 changes: 0 additions & 4 deletions src/steps/profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ export async function buildDeviceProfileRelationships({
// we don't have a way to test this - I'm using the model provided by the provider
// Let's try logging.
for (const device of response.profileAssignedDevices) {
logger.info(
{ deviceKeys: Object.keys(device) },
'TEMP - Keys of device',
);
if (
device.uuid &&
profileEntity._key &&
Expand Down