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

Commit

Permalink
Merge pull request #71 from JupiterOne/INT-9900-paginate-correctly
Browse files Browse the repository at this point in the history
Int 9900 paginate correctly
  • Loading branch information
Gonzalo-Avalos-Ribas authored Nov 17, 2023
2 parents 6b4eef7 + 34819f6 commit 2cf0d94
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
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

0 comments on commit 2cf0d94

Please sign in to comment.