From 623c526d4250c967d89e7f498ea7346df7bcb581 Mon Sep 17 00:00:00 2001 From: Jehison Prada Date: Tue, 23 Jan 2024 10:18:02 -0500 Subject: [PATCH 1/3] Add ingestion sources --- src/constants.ts | 8 ++++++++ src/ingestionConfig.ts | 26 ++++++++++++++++++++++++++ src/steps/accounts/index.ts | 2 ++ src/steps/devices/index.ts | 4 ++++ src/steps/users/index.ts | 2 ++ 5 files changed, 42 insertions(+) create mode 100644 src/constants.ts create mode 100644 src/ingestionConfig.ts diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..f2ed0b2 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,8 @@ +export const IngestionSources = { + ACCOUNTS: 'accounts', + MACOS_CONFIGURATION_PROFILES: 'macos-configuration-profiles', + MOBILE_DEVICES: 'mobile-devices', + COMPUTERS: 'computers', + GROUPS: 'groups', + ADMINS: 'admins', +}; diff --git a/src/ingestionConfig.ts b/src/ingestionConfig.ts new file mode 100644 index 0000000..62e3eb3 --- /dev/null +++ b/src/ingestionConfig.ts @@ -0,0 +1,26 @@ +import { IntegrationIngestionConfigFieldMap } from '@jupiterone/integration-sdk-core'; +import { IngestionSources } from './constants'; + +export const ingestionConfig: IntegrationIngestionConfigFieldMap = { + [IngestionSources.ACCOUNTS]: { + title: 'Accounts', + description: + 'Users with access, permissions, and roles in device management', + }, + [IngestionSources.MACOS_CONFIGURATION_PROFILES]: { + title: 'MacOS configuration profiles', + description: 'Device behavior settings including network and security', + }, + [IngestionSources.MOBILE_DEVICES]: { + title: 'Mobile devices', + description: 'Apple devices, such as Macs, iPhones, and iPads', + }, + [IngestionSources.COMPUTERS]: { + title: 'Computers', + description: 'Apple Macintosh device, such as a MacBook, iMac, or Mac mini', + }, + [IngestionSources.ADMINS]: { + title: 'Users', + description: 'Users who have admin rights on the devices', + }, +}; diff --git a/src/steps/accounts/index.ts b/src/steps/accounts/index.ts index 56da1df..fe90433 100644 --- a/src/steps/accounts/index.ts +++ b/src/steps/accounts/index.ts @@ -11,6 +11,7 @@ import { IntegrationSteps, } from '../constants'; import { createAccountEntity } from './converters'; +import { IngestionSources } from '../../constants'; export async function fetchAccounts({ instance, @@ -44,6 +45,7 @@ export const accountSteps: IntegrationStep[] = [ name: 'Fetch Accounts', entities: [Entities.ACCOUNT], relationships: [], + ingestionSourceId: IngestionSources.ACCOUNTS, executionHandler: fetchAccounts, }, ]; diff --git a/src/steps/devices/index.ts b/src/steps/devices/index.ts index 2fbfe62..3db3070 100644 --- a/src/steps/devices/index.ts +++ b/src/steps/devices/index.ts @@ -41,6 +41,7 @@ import { setMobileDeviceIdToGraphObjectKeyMap, } from '../../util/device'; import { createComputerEntity } from './computerEntityConverter'; +import { IngestionSources } from '../../constants'; type MacOsConfigurationDetailsById = Map; @@ -615,6 +616,7 @@ export const deviceSteps: IntegrationStep[] = [ name: 'Fetch macOS Configuration Profiles', entities: [Entities.MAC_OS_CONFIGURATION_PROFILE], relationships: [Relationships.ACCOUNT_HAS_MAC_OS_CONFIGURATION_PROFILE], + ingestionSourceId: IngestionSources.MACOS_CONFIGURATION_PROFILES, executionHandler: fetchMacOsConfigurationDetails, dependsOn: [IntegrationSteps.ACCOUNTS], }, @@ -623,6 +625,7 @@ export const deviceSteps: IntegrationStep[] = [ name: 'Fetch Mobile Devices', entities: [Entities.MOBILE_DEVICE], relationships: [Relationships.ACCOUNT_HAS_MOBILE_DEVICE], + ingestionSourceId: IngestionSources.MOBILE_DEVICES, executionHandler: fetchMobileDevices, dependsOn: [IntegrationSteps.ACCOUNTS], }, @@ -639,6 +642,7 @@ export const deviceSteps: IntegrationStep[] = [ MappedRelationships.COMPUTER_INSTALLED_APPLICATION, MappedRelationships.LOCAL_ACCOUNT_USES_COMPUTER, ], + ingestionSourceId: IngestionSources.COMPUTERS, executionHandler: fetchComputers, dependsOn: [ IntegrationSteps.ACCOUNTS, diff --git a/src/steps/users/index.ts b/src/steps/users/index.ts index 09ab4d7..5e9d1e0 100644 --- a/src/steps/users/index.ts +++ b/src/steps/users/index.ts @@ -21,6 +21,7 @@ import { } from '../../util/device'; import pMap from 'p-map'; import { iterator } from './interator'; +import { IngestionSources } from '../../constants'; async function iterateAdminUserProfiles( client: IJamfClient, @@ -250,6 +251,7 @@ export const userSteps: IntegrationStep[] = [ name: 'Fetch Admins', entities: [Entities.USER_ADMIN], relationships: [Relationships.ACCOUNT_HAS_USER_ADMIN], + ingestionSourceId: IngestionSources.ADMINS, executionHandler: fetchAdminUsers, dependsOn: [IntegrationSteps.ACCOUNTS], }, From c7245aab770ec2bdc8f90c308cfbc6bb56cbf4f7 Mon Sep 17 00:00:00 2001 From: Jehison Prada Date: Tue, 23 Jan 2024 11:46:15 -0500 Subject: [PATCH 2/3] Remove accounts from ingestion config since all steps depend on it --- src/constants.ts | 2 -- src/ingestionConfig.ts | 5 ----- src/steps/accounts/index.ts | 2 -- 3 files changed, 9 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index f2ed0b2..af9da2f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,8 +1,6 @@ export const IngestionSources = { - ACCOUNTS: 'accounts', MACOS_CONFIGURATION_PROFILES: 'macos-configuration-profiles', MOBILE_DEVICES: 'mobile-devices', COMPUTERS: 'computers', - GROUPS: 'groups', ADMINS: 'admins', }; diff --git a/src/ingestionConfig.ts b/src/ingestionConfig.ts index 62e3eb3..dcedc25 100644 --- a/src/ingestionConfig.ts +++ b/src/ingestionConfig.ts @@ -2,11 +2,6 @@ import { IntegrationIngestionConfigFieldMap } from '@jupiterone/integration-sdk- import { IngestionSources } from './constants'; export const ingestionConfig: IntegrationIngestionConfigFieldMap = { - [IngestionSources.ACCOUNTS]: { - title: 'Accounts', - description: - 'Users with access, permissions, and roles in device management', - }, [IngestionSources.MACOS_CONFIGURATION_PROFILES]: { title: 'MacOS configuration profiles', description: 'Device behavior settings including network and security', diff --git a/src/steps/accounts/index.ts b/src/steps/accounts/index.ts index fe90433..56da1df 100644 --- a/src/steps/accounts/index.ts +++ b/src/steps/accounts/index.ts @@ -11,7 +11,6 @@ import { IntegrationSteps, } from '../constants'; import { createAccountEntity } from './converters'; -import { IngestionSources } from '../../constants'; export async function fetchAccounts({ instance, @@ -45,7 +44,6 @@ export const accountSteps: IntegrationStep[] = [ name: 'Fetch Accounts', entities: [Entities.ACCOUNT], relationships: [], - ingestionSourceId: IngestionSources.ACCOUNTS, executionHandler: fetchAccounts, }, ]; From e7ba431b13e5a678ce239d3c06c53e1d53ca7f63 Mon Sep 17 00:00:00 2001 From: Jehison Prada Date: Tue, 23 Jan 2024 14:31:04 -0500 Subject: [PATCH 3/3] Add ingestion config to invocation config --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index c6ee7ae..6f5200b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import { deviceSteps } from './steps/devices'; import { groupSteps } from './steps/groups'; import { userSteps } from './steps/users'; import { validateInvocation } from './validator'; +import { ingestionConfig } from './ingestionConfig'; export const invocationConfig: IntegrationInvocationConfig = { @@ -16,4 +17,5 @@ export const invocationConfig: IntegrationInvocationConfig = ...userSteps, ...deviceSteps, ], + ingestionConfig, };